Search code examples
assemblyrecordactivation

Activation record in HLA


In HLA, how exactly the parameters stored in the activation record?

I've read about the topic a lot, but the problem is, when the parameters are any of "smaller-than-4-bytes" datatypes.

For example:

Procedure proc(VAL i:int32; VAL j:int16; VAL k:int16);@nodisplay;

(note, that all parameters are VAL)

since it isn't mentioned anywhere, that all parameters allocate (at least) a 4-bytes blocks, I would expect k to be on EBP+8, j on EBP+10 and i on EBP+12.

But according to a few stdout.puts, it's not the case. (At least not on my system) k is on EBP+8, j is on EBP+12, and i is on EBP+16.

Is there any resource pointing out, that parameters allocate 4-bytes blocks? Or is my HLA misbehaving?


Solution

  • Local variables and parameters are stored on the stack, and the stack is allocated a fixed 32 bits at a time in 32-bit mode. Even if your parameters are smaller than 32 bits, they still occupy 32 bits on the stack.