This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Separate interrupt stack for i386


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]