EBP ESP and ESI?
Hello assembly section.
I'm having a little trouble with these 3 registers I've mentioned. I was looking at calling conventions and it seems that this is what it looks like.
I have a few questions relevant to that little piece of code.
1)First off, we're pushing ebp onto the stack to save it, I think. What is the point of saving the old base pointer...? Also, does the old base pointer still point to the old parameters? If so, why would we need them and what the hell is the point of it?
2)Why are we moving esp to ebp? I understand that ebp+8 is the first parameter, ebp+0xC is the second etc etc.. But, why can't we just do esp+8 instead? What's the point of having that extra instruction?
3)I can't really find a detailed explanation on exactly how calling a function works, so if anyone could take their time to explain it that would be awesome.
Moving on to the ESI register. I have absolutely no idea what the hell we would ever use this for...
I'm having a little trouble with these 3 registers I've mentioned. I was looking at calling conventions and it seems that this is what it looks like.
Code:
push ebp mov ebp,esp
1)First off, we're pushing ebp onto the stack to save it, I think. What is the point of saving the old base pointer...? Also, does the old base pointer still point to the old parameters? If so, why would we need them and what the hell is the point of it?
2)Why are we moving esp to ebp? I understand that ebp+8 is the first parameter, ebp+0xC is the second etc etc.. But, why can't we just do esp+8 instead? What's the point of having that extra instruction?
3)I can't really find a detailed explanation on exactly how calling a function works, so if anyone could take their time to explain it that would be awesome.
Moving on to the ESI register. I have absolutely no idea what the hell we would ever use this for...
