Disassemble such a simple program:
push ebp mov ebp, esp and esp, 0FFFFFFF0h sub esp, 10h mov eax, offset aHelloWorld ; "hello, world\n"
The string and esp, 0FFFFFFF0h
I always had eyesore, and its meaning is not explained in books on the reverse. They write that this is the alignment of the value in ESP
along the 16-byte boundary, but the “alignment”, “zeroing of the first four bits” and “16 bytes” I do not add up to a complete idea. What's going on here? What is this for? Why is it necessary to reset 4 bits for alignment to 16 bytes?
Alignment, I understand as filling pieces of memory to the multiplicity of a number. For example, the aligned sections in PE are filled with zeros at the end, as shown by hiew.
Resetting the first four bits of ESP
is like multiplying by 2^4
. But why is it not a pity for the compiler to squander so many addresses?