[ECOS] Where is my stack ?! (for my i386)

Fabrice Gautier Fabrice_Gautier@sdesigns.com
Thu Oct 19 20:33:00 GMT 2000


> -----Original Message-----
> From: Jonathan Larmour [ mailto:jlarmour@redhat.com ]
> Sent: Thursday, October 19, 2000 7:20 PM
> To: Fabrice Gautier
> Cc: Ecos-List (E-mail)
> Subject: Re: [ECOS] Where is my stack ?! (for my i386)
> 
> Fabrice Gautier wrote:
> > 
> 
> It's the startup stack. It's meant to exist very transiently 
> and then get zapped. It's size should be configurable, but it's no big 
> deal if it is discarded later. On some archs the interrupt stack is used
as 
> the startup stack.

Well, it doesn't seem so transient to me. In fact, at least for the x86, as
long as there is no threads, there is only one stack, this one.
So Redboot uses this stack, the standalone stub too.


> > And is there any way to detect a stack overflow when it happens ?
> 
> Generally no, but I believe the x86 can be setup to do this?

It is certainly possible to detect stack overflow for code running in non
privileged level, but for a stack overflow occuring in system mode, I'm not
sure how this can be handled.

For any exception triggered the CPU will try to push some values on this
stack that caused an exception.
Eventually the only way may be to use debug register to set hardware
watchpoint a few byte before the overflow so that the CPU and exception
handler can use the few reamining on the stack. But I don't know if this
idea has ever been used or if this would really work. 


-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 


More information about the Ecos-discuss mailing list