Basic syntax & instructions in Intel syntax assembly.
Align stack to 16-bit for certain library calls
- Save EBP value on stack
- Save ESP value into EBP
- Now:
- EBP points to top of stack
- ESP points to top of stack
- Truncate ESP bottom 4 bits for alignment (this makes sure the address is a multiple of 16; since stack grows towards 0, no data will be overwritten)
- Now:
- EBP points to original top-of-stack
- ESP points to newly aligned top-of-stack
- Do stuff with library calls
- Restore ESP from EBP register
- Restore EBP from stack