Repository navigation
stack offset #9602
Replies: 1 comment
|
The offset is a byte offset from incoming SP, not a word index. wordsize=2 does not change that. With growth="positive", Ghidra allocates from the high end of [offset, offset+maxsize) downward, so: offset = H - maxsize where H is the exclusive high edge of the argument region (usually 0, -2, or -4, depending on where the saved return address sits relative to incoming SP). 0xfffffe0a is just −502 wrapped, copied from PIC24’s maxsize="500" (H = −2). With your maxsize="1000" that puts args at +498, which is wrong. Use offset="-1002" for the same convention (H = −2), or offset="-1000" if the first stack arg is immediately below SP. Prefer a signed literal; 0xfffffe0a only means −502 on a 32-bit byte-addressed stack and is invalid or a huge positive offset when wordsize=2. |
Uh oh!
There was an error while loading. Please reload this page.
How do I calculate the stack offset in a cspec file? My processor's stack grows upward, and the minimum addressable unit is a word (16 bits), i.e., wordsize=2.
As shown below, what should this offset be?
All reactions