This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Separate interrupt stack for i386
- To: ecos-discuss at sourceware dot cygnus dot com
- Subject: Re: [ECOS] Separate interrupt stack for i386
- From: Nick Garnett <nickg at cygnus dot co dot uk>
- Date: 29 Nov 2000 10:57:50 +0000
- Newsgroups: cygnus.sourceware.ecos.d
- Organization: Red Hat UK
- References: <B1F6452C89AFD411AE0800A0CC734C23015040@EMAIL1>
Fabrice Gautier <Fabrice_Gautier@sdesigns.com> writes:
> Hi,
>
> As far as i know there is no separate interrupt stack for the i386-PC
> target, am I right?
>
> So how should this be done ? Any advice ? Someone already thought of that?
>
The basic advice here is to take a look at an architecture that
already has this done, I always suggest MIPS. Take a look at the bits
surrounded by the CYGIMP_HAL_COMMON_INTERRUPTS_USE_INTERRUPT_STACK
ifdefs in vectors.S.
There are basically three pieces of code that need to be written:
1. Early in the interrupt VSR detect whether you are already on the
interrupt stack and move to it if not.
2. Before calling interrupt_end() move back to the thread stack for
the last nested interrupt to be returned from. The technique of
always pushing the original stack address in step 1 and just
popping it here makes this very simple.
3. Write the hal_interrupt_stack_call_pending_DSRs function. This just
switches to the interrupt stack, enables interrupts and calls back
into the kernel to call DSRs. The only complication here is to make
sure that the original interrupt state is restored before
returning.
And that's all there it to it.
--
Nick Garnett, eCos Kernel Architect
Red Hat, Cambridge, UK