when I started on FASM (and I'm still a "beginner"), some members introduced me to codes whose general purpose registers were used as stack pointers :
eax, ecx, ebx, edx, ...
However, isn't it better to use registers such as these :
rax, rsi, rdx, ...
In fact, what is the concrete purpose of the general registers, presented in the documentation?
How are these registers related to “stack pointers”?
General purpose registers are… uhm… general purpose. You’re generally allowed to use them for whatever purpose. All of them. But you should keep in mind that certain GRPs are used implicitly by certain instructions and/or CPU mechanisms.
For example, xSP is used as a pointer to the top of the stack. xSI and xDI are used by string-handling instructions. (I)MUL and (I)DIV may use xAX and xDX. LOOP uses xCX. (xCX stands for CX/ECX/RCX, the same for other examples).
But I guess all this stuff is described in Intel SDM, so, please, give more detail on what you want to read in response.
Depends on the instruction, some have special implicit register requirements, but most of the time yes, you're correct.
The only thing is that you need the stack pointer to point to valid stack memory in some OSes when exceptions or signals get thrown, so it's not a good idea to play with the stack pointer for "other purposes".
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum