Earthbound27
Earthbound27

Reputation: 19

Assembly Push Instruction

QUESTION

Thinking in terms of the GCC compiler, AT&T syntax and 32bit assembly, what two instructions would be equivalent to:

Push %eax 

ATTEMPT:

I'm think it is these two below:

Addl $0x4, %esp
movl %eax, -0x4(%esp)

Can someone confirm? If it is wrong could someone please point me in the right direction. Thank you!

Upvotes: 1

Views: 530

Answers (1)

Yogi
Yogi

Reputation: 476

It should be,

leal -4(%esp), %esp;
movl %eax, (%esp);

sub may change the flags!

Upvotes: 1

Related Questions