Re: [Question] arch-independent way to differentiate between user andkernel

From: Ingo Molnar
Date: Wed Aug 03 2005 - 07:13:34 EST



* Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:

> On Wed, 2005-08-03 at 06:56 -0400, linux-os (Dick Johnson) wrote:
> > On Wed, 3 Aug 2005, Steven Rostedt wrote:
> > The interrupt handler gets a pointer to a structure called "struct pt_regs".
> > That contains, amongst other things, the registers pushed onto the stack
> > during the interrupt. If the segments were kernel segments, the interrupt
> > occurred while in kernel mode. But..... If you have any code that
> > needs to know, it's horribly and irreparably broken beyond all
> > repair. Interrupts need to be handled NOW, without regard to what
> > got interrupted.
> >
>
> By the time you get to __do_IRQ there's already more stuff on the
> stack. And the pt_regs is arch specific so this doesn't help.

the actual layout of pt_regs is arch-specific, but user_mode(regs) is
pretty much generic across most arches.

Ingo
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/