|
-
March 16th, 2004, 07:17 AM
#1
Help with memory addressing
Im having dificulty understanding memory addressing during function calls in c/c++
An article states that a frame pointer inside the stack sits between the function parameters and the local variables. So that using the frame pointer, adding and subtracting from it alows the function to access any paramters or local variables.
It states the top of the stack is the lowest memory address and the bottom is the highest, and that paramteters are a positive refernce from frame pointer, and local variables are negitive refernce from frame pointer.
I don't understand is how 0xfffffffb(%ebp) is a negitave refernce and 0x8(%ebp) is a positive refernce.
What makes the fffffffb negative ?
Also acording to one site (http://www.cee.hw.ac.uk/~alison/SysL...1/topic11.html) using the gcc -S option the assembly produced resembles the ebp refernces in the format -1(%ebp), +4(%ebp).
Where another site (http://www.phrack.org/show.php?p=49&a=14) produces asembly where ebp refernces are in the format 0x8(%ebp), 0xfffffffd(%ebp)
Also I am useing djgpp compiler for windows since it gives me the gcc compiler. Its output format resembles that of the second site.
How can I produce the refernces in format -2(%ebp) instead of 0xfffffffd(%ebp)
Is there any gcc port for windows that will give the assembly format -2(%ebp) ?
Any guidence in this matter is apreciated.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|