flat assembler
Message board for the users of flat assembler.

Index > Main > A question about PUSHAD

Author
Thread Post new topic Reply to topic
int0x50



Joined: 19 Jul 2019
Posts: 54
int0x50 24 Jul 2019, 09:10
PUSHAD pushes all the values of the registers. The registers are stored on the stack in the following order: EAX, ECX, EDX, EBX, EBP, ESP (original value), EBP, ESI, and EDI (if the current operand-size attribute is 32).

How does the original value of ESP is stored?
Post 24 Jul 2019, 09:10
View user's profile Send private message Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 24 Jul 2019, 17:25
It’s all there, in Intel SDM:

Intel SDM wrote:
Code:
IF OperandSize = 32 (* PUSHAD instruction *)
THEN
  Temp ← (ESP);
  Push(EAX);
  Push(ECX);
  Push(EDX);
  Push(EBX);
  Push(Temp);
  Push(EBP);
  Push(ESI);
  Push(EDI);
ELSE
...    


Saving original value is not a problem, there’s a whole bunch of internal registers inside the processor that are used to ensure operand values are set up on the wires before they get processed. Not even mentioning modern pipelined processors.
Post 24 Jul 2019, 17:25
View user's profile Send private message Visit poster's website Reply with quote
int0x50



Joined: 19 Jul 2019
Posts: 54
int0x50 25 Jul 2019, 07:40
Thank you DimonSoft. My bad that I didn't see it before asking. As you rightly said it is in the SDM volume 2b, section 4-510, page number 1194. Thank you for pointing me there.
Post 25 Jul 2019, 07:40
View user's profile Send private message Reply with quote
guignol



Joined: 06 Dec 2008
Posts: 763
guignol 26 Jul 2019, 11:33
EVY
Post 26 Jul 2019, 11:33
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
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


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.