To get started, I need to write a build function (Intel IA-32) that returns the contents of the caller's frame pointer. I don't think I'm doing it right, but what I came up with was
pushl %ebp movl %esp, %ebp movl %eax, 4(ebp) leave ret
However, I have to use this in function c to count the number of frames on the stack, and I'm really not sure how this should work. Should I go to the value in the old ebp and then call the function again? Any guidance would be greatly appreciated.
source share