SF 3260589 proposes that uniarch mspgcc change the value of r4 when used as
a frame pointer to be value [A] described below.  Please provide comments on
this change.  This is probably only relevant to you if you believe you need
to decode frame contents in your code.

The following are stack locations that might be returned by
__builtin_frame_address(0):

[A] The return address for the current function

[B] Where the stack pointer was at start of the function prologue

[C] Where the stack pointer was after any register saves but before local
variables are reserved

[D] Where the stack pointer was at the end of the function prologue

 Higher addresses
    .... caller-pushed arguments
[A] .... 1 or 2 words for return address
[B] .... 0 or 1 word for saved status register (ISR or critical)
[C] .... 0 or more words for call-used registers
[D] .... 0 or more words for local variables
sp  .... other stack use (call args, alloca, ...)
 Lower addresses

Further data:

[A] and [B] are different for interrupts.  [A] is what most of the world
expects "frame pointer" to reference (except when it points to the frame
pointer of the caller, which is normally pushed right after the return
address).  [D] is what mspgcc uses.

mspgcc puts the frame pointer in r4 when it's used, but gcc eliminates the
use by substituting references based on sp where possible.

Since __bic_status_register_on_exit, __builtin_{frame,return}_address, and
similar functions have been implemented as builtins, there should be no need
for C code to reference r4 explicitly.

If it turns out the caller's frame pointer has to be saved, it'll be at the
top of [C] (an intentional or fortuitous consequence of assigning it to
r4).  There is currently no provision for user code to obtain this value; if
it becomes necessary, it'll be done by non-zero arguments to
__builtin_frame_address, which will inhibit -fomit-frame-pointer and
probably require special compilation of libc.  (The required information to
reconstruct call chain frame pointers will be made available to the debugger
as it always has.)

Dunno what's going to happen when exception handling is validated.
------------------------------------------------------------------------------
Create and publish websites with WebMatrix
Use the most popular FREE web apps or write code yourself; 
WebMatrix provides all the features you need to develop and 
publish your website. http://p.sf.net/sfu/ms-webmatrix-sf
_______________________________________________
Mspgcc-users mailing list
Mspgcc-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mspgcc-users

Reply via email to