lkml.org 
[lkml]   [2000]   [Oct]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Calling current() from interrupt context
On Tue, Oct 10, 2000 at 12:55:33AM +0200, Andi Kleen wrote:
> On Mon, Oct 09, 2000 at 11:45:18PM +0100, Kenn Humborg wrote:
> > Simple. Each interrupt stack is, say, 8 pages. You have an array
> > of N interrupt stacks. Then you calculate
> >
> > cpu_id = (sp & ~(INT_STACK_SIZE-1)) >> (PAGE_SHIFT + 3);
> >
> > Actually, I'd put the interrupt stack and any other per-cpu data
> > structures together in this region.
>
>
> So your smp_processor_id() looks like:
>
> #define smp_processor_id() \
> (in_interrupt() ? (sp & ~(INT_STACK_SIZE-1)) >> (PAGE_SHIFT + 3) :
> (struct task_struct *)(sp & -8192)->current_cpu)
>
>
> ?

Nope.

> There is just an ugly problem: in_interrupt already requires the CPU id
> to look up the table of interrupt counters.

The PSL (processor status longword) has a bit that tells you whether you're
currently on the interrupt stack or not. You can test this in two
instructions:

movpsl r0 # get PSL
bbs $0x25, r0, <dst> # branch if I bit set (bit 25)

Later,
Kenn

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

\
 
 \ /
  Last update: 2005-03-22 12:39    [from the cache]
©2003-2011 Jasper Spaans