From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrice Gautier To: 'Jonathan Larmour' Cc: "Ecos-List (E-mail)" Subject: RE: [ECOS] Where is my stack ?! (for my i386) Date: Thu, 19 Oct 2000 20:33:00 -0000 Message-id: <5AF611D83988D4118ACF00E0B10400540557D9@mr-intranet.sdesigns.net> X-SW-Source: 2000-10/msg00229.html > -----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