public inbox for ecos-discuss@sourceware.org
 help / color / mirror / Atom feed
* RE: [ECOS] Where is my stack ?! (for my i386)
@ 2000-10-19 20:33 Fabrice Gautier
  2000-10-19 21:06 ` Jonathan Larmour
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Gautier @ 2000-10-19 20:33 UTC (permalink / raw)
  To: 'Jonathan Larmour'; +Cc: Ecos-List (E-mail)

> -----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 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] Where is my stack ?! (for my i386)
  2000-10-19 20:33 [ECOS] Where is my stack ?! (for my i386) Fabrice Gautier
@ 2000-10-19 21:06 ` Jonathan Larmour
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Larmour @ 2000-10-19 21:06 UTC (permalink / raw)
  To: Fabrice Gautier; +Cc: Ecos-List (E-mail)

Fabrice Gautier wrote:
> 
> > -----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.

True in those cases - I didn't realise you were specifically talking about
those. Patches welcome ;-).

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [ECOS] Where is my stack ?! (for my i386)
  2000-10-19 17:29 Fabrice Gautier
@ 2000-10-19 19:21 ` Jonathan Larmour
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Larmour @ 2000-10-19 19:21 UTC (permalink / raw)
  To: Fabrice Gautier; +Cc: Ecos-List (E-mail)

Fabrice Gautier wrote:
> 
> Hi,
> 
> Where does the startup stack, the one used by cyg_start, is supposed to be ?
> 
> In the i386, it is located just in front of the startup code, and this is
> very bad. At least i think the stack should be in a defined area of the
> memory map and not in the void... Just where I was trying to put the idt,
> the vsr table and the virtual vector tables.

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.

But it's certainly a bad place to put tables that you intend to stick
around.
 
> How is this done in the other arch ? Where is the stack located ?

Well, certainly in front of the startup code seems an unwise place. It
should be a fixed location in memory, which may later be reused. Why don't
you just look at the other archs?
 
> 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?

Jifl
-- 
Red Hat, 35 Cambridge Place, Cambridge, UK. CB2 1NS  Tel: +44 (1223) 728762
"Plan to be spontaneous tomorrow."  ||  These opinions are all my own fault

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [ECOS] Where is my stack ?! (for my i386)
@ 2000-10-19 17:29 Fabrice Gautier
  2000-10-19 19:21 ` Jonathan Larmour
  0 siblings, 1 reply; 4+ messages in thread
From: Fabrice Gautier @ 2000-10-19 17:29 UTC (permalink / raw)
  To: Ecos-List (E-mail)

Hi,

Where does the startup stack, the one used by cyg_start, is supposed to be ?

In the i386, it is located just in front of the startup code, and this is
very bad. At least i think the stack should be in a defined area of the
memory map and not in the void... Just where I was trying to put the idt,
the vsr table and the virtual vector tables.

How is this done in the other arch ? Where is the stack located ?

And is there any way to detect a stack overflow when it happens ?

Thanks

-- 
Fabrice Gautier
fabrice_gautier@sdesigns.com 






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2000-10-19 21:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-10-19 20:33 [ECOS] Where is my stack ?! (for my i386) Fabrice Gautier
2000-10-19 21:06 ` Jonathan Larmour
  -- strict thread matches above, loose matches on Subject: below --
2000-10-19 17:29 Fabrice Gautier
2000-10-19 19:21 ` Jonathan Larmour

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).