* dummy frame on stack and SPARC
@ 2003-03-05 19:47 Andrew Cagney
0 siblings, 0 replies; only message in thread
From: Andrew Cagney @ 2003-03-05 19:47 UTC (permalink / raw)
To: gdb
(thinking out loud)
The sparc architecture, when calling a struct return function has a
sequence like:
call struct_return_function, return address = pc + 8
nop
.word sizeof returned object
return_address:
... next instruction ....
That is, the return address is several instructions beyond the call
instruction and, more importantly, one of those "instructions" is an a
word to inform the callee of additional ABI information (from memory,
how much space the return structure needs).
When correctly implemeting sparc dummy calls, this behavior needs to be
implemented. Hence the call needs 2 words (the struct return size and
the breakpoint)instead of just one (the breakpoint) and the code dummy
no longer fits in _start. Conseqently, the SPARC, by default, pushes
the code dummy on the stack.
Problem is, this assumes that the target has an executable stack
(security?). As a consequence, the SPARC either:
- writes a two word code dummy onto the stack and correctly handls
struct return
- writes a one word code dummy into _start and fails when given a struct
return function
Instead of doing this, would it be possible to always write the code
dummy onto the stack and, when the stack isn't executable, recognize the
sigseg (?) as an attempt to return to the call dummy?
The only thing I'm not sure about is exactly when a SPARC will recognize
the segmentation violation and abort. It, thanks to the delayed branch
code, could be a cycle too early :-(
Andrew
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-03-05 19:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-03-05 19:47 dummy frame on stack and SPARC Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).