pushq %rbp
movq %rsp, %rbp
subq $32, %rsp
I have big question regarding explanation of "$32" in third instruction. The information from search and blogs specifies that in above third instruction we are reserving certain "bytes" of space for stack. From doc, %rsp is 64 bit register and %esp is 32 bit.
Is "$32" means 32 bytes ?($number means constant ?) If yes then how are we allocating 32 bytes on 64 bit register? Above instruction were generated from "otool". I am using macbook pro.
I am just trying to learn a small things about assembly.
Thanks.
These 32 bytes are not allocated on 64 bit register. They are allocated on the stack. By lowering the stackpointer (which is in %rsp) the address range from %rsp to %rsp+31 is at our disposal for storing data.