| View previous topic :: View next topic |
| Author |
Message |
vng21092 Grandmaster Cheater
Reputation: 15
Joined: 05 Apr 2013 Posts: 644
|
Posted: Mon Jul 13, 2015 7:02 pm Post subject: Quick question |
|
|
if I push EAX, and THEN I push EBX, when I pop them. Should I pop EBX first, and THEN pop EAX? Or is it the other way around? This is how I see it that's why, just want to confirm
| Code: | push eax
mov eax,[rdi]
push ebx
mov ebx,[rdi+4]
.
.
blah blah
.
.
pop ebx
pop eax |
|
|
| Back to top |
|
 |
Zanzer I post too much
Reputation: 126
Joined: 09 Jun 2013 Posts: 3278
|
Posted: Mon Jul 13, 2015 9:00 pm Post subject: |
|
|
Last In First Out (LIFO)
Last one you push to the stack (EBX) is the first one popped out.
push eax
push ebx
pop ebx
pop eax
|
|
| Back to top |
|
 |
aikoncwd Grandmaster Cheater
Reputation: 23
Joined: 21 Dec 2012 Posts: 591 Location: Spain (Barcelona)
|
Posted: Tue Jul 14, 2015 1:22 am Post subject: |
|
|
Imagine the stack as stack of papers. You put a papers on top, when you want to work you will take the firt paper of the stack. Thats how a LIFO works
_________________
Hey Hitler
Test here your skill with CheatEngine, I coded a challenge for you. Try to beat it!
HERE |
|
| Back to top |
|
 |
STN I post too much
Reputation: 43
Joined: 09 Nov 2005 Posts: 2676
|
Posted: Tue Jul 14, 2015 3:04 am Post subject: |
|
|
You are correct.
If lifo confuses you, just remember the last push is the first pop . Works for me
_________________
|
|
| Back to top |
|
 |
|