On Mon, Jul 02, 2007 at 12:38:48AM +0100, Pedro Alves wrote:
> Kevin O'Connor escreveu:
> > Is it safe to enter an exception handler using the calling program's
> > stack?  That is, if you set the pc to a handler and call
> > EXCEPTION_CONTINUE_EXECUTION that handler will alter the stack and
> > registers of the function that raised the exception.  Are we
> > guarenteed that this is okay?
> > 
> 
> Of course, just changing the pc is not enough.  We have to setup a
> new stack frame.  Really, you should look at newlib/libc/sys/wince/startup.c:
> 
> DWORD* sp = (DWORD*)ContextRecord->Sp;
>    *--sp = ContextRecord->Pc;
[...]

Sp is the stack of the main code, and the exception handler writes to
that stack space.  Are we guarenteed that if we longjmp back to the
main code that it wont corrupt anything?  (In general, I wouldn't
think it would be a problem because the stack grows down - but do we
have a guarantee that gcc always decrements sp before using it?)

Thanks for looking at this.
-Kevin

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Cegcc-devel mailing list
Cegcc-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cegcc-devel

Reply via email to