kernel_optimize_test/include/asm-frv
David Howells 28baebae73 [PATCH] FRV: Use virtual interrupt disablement
Make the FRV arch use virtual interrupt disablement because accesses to the
processor status register (PSR) are relatively slow and because we will
soon have the need to deal with multiple interrupt controls at the same
time (separate h/w and inter-core interrupts).

The way this is done is to dedicate one of the four integer condition code
registers (ICC2) to maintaining a virtual interrupt disablement state
whilst inside the kernel.  This uses the ICC2.Z flag (Zero) to indicate
whether the interrupts are virtually disabled and the ICC2.C flag (Carry)
to indicate whether the interrupts are physically disabled.

ICC2.Z is set to indicate interrupts are virtually disabled.  ICC2.C is set
to indicate interrupts are physically enabled.  Under normal running
conditions Z==0 and C==1.

Disabling interrupts with local_irq_disable() doesn't then actually
physically disable interrupts - it merely sets ICC2.Z to 1.  Should an
interrupt then happen, the exception prologue will note ICC2.Z is set and
branch out of line using one instruction (an unlikely BEQ).  Here it will
physically disable interrupts and clear ICC2.C.

When it comes time to enable interrupts (local_irq_enable()), this simply
clears the ICC2.Z flag and invokes a trap #2 if both Z and C flags are
clear (the HI integer condition).  This can be done with the TIHI
conditional trap instruction.

The trap then physically reenables interrupts and sets ICC2.C again.  Upon
returning the interrupt will be taken as interrupts will then be enabled.
Note that whilst processing the trap, the whole exceptions system is
disabled, and so an interrupt can't happen till it returns.

If no pending interrupt had happened, ICC2.C would still be set, the HI
condition would not be fulfilled, and no trap will happen.

Saving interrupts (local_irq_save) is simply a matter of pulling the ICC2.Z
flag out of the CCR register, shifting it down and masking it off.  This
gives a result of 0 if interrupts were enabled and 1 if they weren't.

Restoring interrupts (local_irq_restore) is then a matter of taking the
saved value mentioned previously and XOR'ing it against 1.  If it was one,
the result will be zero, and if it was zero the result will be non-zero.
This result is then used to affect the ICC2.Z flag directly (it is a
condition code flag after all).  An XOR instruction does not affect the
Carry flag, and so that bit of state is unchanged.  The two flags can then
be sampled to see if they're both zero using the trap (TIHI) as for the
unconditional reenablement (local_irq_enable).

This patch also:

 (1) Modifies the debugging stub (break.S) to handle single-stepping crossing
     into the trap #2 handler and into virtually disabled interrupts.

 (2) Removes superseded fixup pointers from the second instructions in the trap
     tables (there's no a separate fixup table for this).

 (3) Declares the trap #3 vector for use in .org directives in the trap table.

 (4) Moves irq_enter() and irq_exit() in do_IRQ() to avoid problems with
     virtual interrupt handling, and removes the duplicate code that has now
     been folded into irq_exit() (softirq and preemption handling).

 (5) Tells the compiler in the arch Makefile that ICC2 is now reserved.

 (6) Documents the in-kernel ABI, including the virtual interrupts.

 (7) Renames the old irq management functions to different names.

Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-14 16:09:35 -08:00
..
a.out.h
atomic.h [PATCH] FRV: Miscellaneous fixes 2006-02-14 16:09:35 -08:00
auxvec.h
ax88796.h
bitops.h [PATCH] include/asm-*/bitops.h: fix more "~0UL >> size" typos 2006-02-03 08:32:02 -08:00
bug.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
bugs.h
busctl-regs.h
byteorder.h
cache.h
cacheflush.h [PATCH] FRV: Miscellaneous fixes 2006-02-14 16:09:35 -08:00
checksum.h
cpu-irqs.h
cpumask.h
cputime.h
current.h
delay.h
div64.h
dm9000.h
dma-mapping.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
dma.h
elf.h
emergency-restart.h
errno.h
fcntl.h
fpu.h
futex.h [PATCH] FRV: Implement futex operations for FRV 2006-01-06 08:33:33 -08:00
gdb-stub.h
gpio-regs.h
hardirq.h
highmem.h
hw_irq.h
ide.h
init.h
io.h [PATCH] FRV: Miscellaneous fixes 2006-02-14 16:09:35 -08:00
ioctl.h [PATCH] Generic ioctl.h 2006-01-10 08:01:34 -08:00
ioctls.h
ipc.h
ipcbuf.h
irc-regs.h
irq-routing.h
irq.h
kmap_types.h
linkage.h
local.h
math-emu.h
mb-regs.h [PATCH] frv: supply various missing I/O access primitives 2006-01-08 20:13:36 -08:00
mb86943a.h
mb93091-fpga-irqs.h
mb93093-fpga-irqs.h
mb93493-irqs.h
mb93493-regs.h
mc146818rtc.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
mem-layout.h
mman.h [PATCH] madvise MADV_DONTFORK/MADV_DOFORK 2006-02-14 16:09:34 -08:00
mmu_context.h
mmu.h
module.h [PATCH] frv: add module support stubs 2006-01-08 20:13:37 -08:00
msgbuf.h
mutex.h [PATCH] mutex subsystem, add default include/asm-*/mutex.h files 2006-01-09 15:59:19 -08:00
namei.h
page.h
param.h
pci.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
percpu.h
pgalloc.h
pgtable.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
poll.h
posix_types.h
processor.h
ptrace.h
registers.h
resource.h
scatterlist.h
sections.h
segment.h
semaphore.h
sembuf.h
serial-regs.h
serial.h
setup.h
shmbuf.h
shmparam.h
sigcontext.h
siginfo.h
signal.h [PATCH] frv: improve signal handling 2006-01-06 08:33:33 -08:00
smp.h
socket.h
sockios.h
spinlock.h
spr-regs.h [PATCH] FRV: Use virtual interrupt disablement 2006-02-14 16:09:35 -08:00
stat.h
statfs.h
string.h
suspend.h
system.h [PATCH] FRV: Use virtual interrupt disablement 2006-02-14 16:09:35 -08:00
termbits.h
termios.h
thread_info.h [PATCH] Handle TIF_RESTORE_SIGMASK for FRV 2006-01-18 19:20:29 -08:00
timer-regs.h
timex.h
tlb.h
tlbflush.h
topology.h
types.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
uaccess.h [PATCH] FRV: Miscellaneous fixes 2006-02-14 16:09:35 -08:00
ucontext.h
unaligned.h
unistd.h [PATCH] FRV: Miscellaneous fixes 2006-02-14 16:09:35 -08:00
user.h
vga.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00
virtconvert.h
xor.h [PATCH] frv: miscellaneous changes 2006-01-08 20:13:38 -08:00