[M3devel] processing stack/context

Tony Hosking hosking at cs.purdue.edu
Thu Dec 3 20:02:34 CET 2009


Ah, yes, understood.  I think in general one can assume that the signal handler context is on the actual stack (we are not using sigaltstack here), but yes it might be safer to explicitly extract a "top" value in the signal handler, independently of the context and pass it in as another parameter to ProcessStopped.

Antony Hosking | Associate Professor | Computer Science | Purdue University
305 N. University Street | West Lafayette | IN 47907 | USA
Office +1 765 494 6001 | Mobile +1 765 427 5484




On 3 Dec 2009, at 13:33, Jay K wrote:

> Tony, Understood, but you use the context as one end of the stack.
>  
> void
> ThreadPThread__ProcessStopped (m3_pthread_t mt, char *bottom, char *context,
>                                void (*p)(void *start, void *limit))
> {
>   /* process stack */
>   if (stack_grows_down) {
>     assert(context < bottom);
>     p(context, bottom);   here
>   } else {
>     assert(bottom < context);
>     p(bottom, context);            here 
>   }
>   /* process register context */
>   p(context, context + sizeof(ucontext_t));
> }
> 
>  
>   - Jay
> 
>  
> From: hosking at cs.purdue.edu
> Date: Thu, 3 Dec 2009 10:05:33 -0500
> To: jay.krell at cornell.edu
> CC: m3devel at elegosoft.com
> Subject: Re: [M3devel] processing stack/context
> 
> Actually, in the latest version I explicitly process the signal context as well as the stack.
> 
> On 3 Dec 2009, at 06:09, Jay K wrote:
> 
> Tony, it looks like you assume the context passed to a signal handler is on the stack.
> Is that really guaranteed? It couldn't be in some thread local for some reason?
>  (signals can nest? Therefore that would be problematic?)
> We can just use the address of a local, right?
>  
> And we can assume the signal stack is the regular stack?
> By default?
> (I know sigstack/sigaltstack can fiddle with it; we should assume it isn't used.)
>  
> I noticed this in structure ThreadWin32.m3 a bit more like ThreadPosix.m3.
>  
>  - Jay
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://m3lists.elegosoft.com/pipermail/m3devel/attachments/20091203/88b78b54/attachment-0002.html>


More information about the M3devel mailing list