One thing that people have not mentioned is addressing, in 32-bit protected mode, segment registers make sense, and SS DS and CS can be different from each other. In 64-bit protected mode, which cannot happen. The only registers that can be offset (but without limitation) are FS and GS. This means that in 32-bit mode, ds: [ebx] and cs: [ebx] can have a different value, which allows some muck. But usually the OS does not do this.
Another thing that people have not mentioned here is that if you change the 32-bit register in 64 bit mode, it will clear the upper half, but only if you change 32 bits. for example mov eax, 0 will cause rax to be 0, while mov ax, 0 will not touch the upper half. So it's a little complicated looking at the assembly.
As for the stack, this is more of an OS issue than a processor. ABI windows for x64 are different from those used by everyone else (linux, mac ...). You probably need to take a deeper look at the "calling conventions" and ABI (application binary interface). However, on x64 RSP there should be 16 bytes aligned at the function input, so you will often see dummy rsp decrees. This is to ensure that 16 byte values on the stack are always aligned. But at the CPU level anyway, RSP decrements, pressing is still "sp- = word_size; ram [sp] = value". Oh, and on x64 RSP has no limit, on x32 you can tell the CPU that the stack pointer cannot go below a certain address, so accessing the stack with lower addresses will lead to an error.
I'm not sure what exactly you are asking. Perhaps a more specific question will allow a more specific answer.
Martin
source share