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

Ingo Molnar
2005-08-03T12:08:36Z

* Steven Rostedt <rostedt@goodmis.org> 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