2005-04-16 15:20:36 -07:00
/ * entry. S : F R - V e n t r y
*
* Copyright ( C ) 2 0 0 3 R e d H a t , I n c . A l l R i g h t s R e s e r v e d .
* Written b y D a v i d H o w e l l s ( d h o w e l l s @redhat.com)
*
* This p r o g r a m i s f r e e s o f t w a r e ; you can redistribute it and/or
* modify i t u n d e r t h e t e r m s o f t h e G N U G e n e r a l P u b l i c L i c e n s e
* as p u b l i s h e d b y t h e F r e e S o f t w a r e F o u n d a t i o n ; either version
* 2 of t h e L i c e n s e , o r ( a t y o u r o p t i o n ) a n y l a t e r v e r s i o n .
*
*
* Entry t o t h e k e r n e l i s " i n t e r e s t i n g " :
* ( 1 ) There a r e n o s t a c k p o i n t e r s , n o t e v e n f o r t h e k e r n e l
* ( 2 ) General R e g i s t e r s s h o u l d n o t b e c l o b b e r e d
* ( 3 ) There a r e n o k e r n e l - o n l y d a t a r e g i s t e r s
* ( 4 ) Since a l l a d d r e s s i n g m o d e s a r e w r t t o a G e n e r a l R e g i s t e r , n o g l o b a l
* variables c a n b e r e a c h e d
*
* We d e a l w i t h t h i s b y d e c l a r i n g t h a t w e s h a l l k i l l G R 2 8 o n e n t e r i n g t h e
* kernel f r o m u s e r s p a c e
*
* However, s i n c e b r e a k i n t e r r u p t s c a n i n t e r r u p t t h e C P U e v e n w h e n P S R . E T = =0 ,
* they c a n ' t r e l y o n G R 2 8 t o b e a n y t h i n g u s e f u l , a n d s o n e e d t o c l o b b e r a
* separate r e g i s t e r ( G R 3 1 ) . B r e a k i n t e r r u p t s a r e m a n a g e d i n b r e a k . S
*
* GR2 9 _ i s _ s a v e d , a n d h o l d s t h e c u r r e n t t a s k p o i n t e r g l o b a l l y
*
* /
# include < l i n u x / l i n k a g e . h >
# include < a s m / t h r e a d _ i n f o . h >
# include < a s m / s e t u p . h >
# include < a s m / s e g m e n t . h >
# include < a s m / p t r a c e . h >
# include < a s m / e r r n o . h >
# include < a s m / c a c h e . h >
# include < a s m / s p r - r e g s . h >
# define n r _ s y s c a l l s ( ( s y s c a l l _ t a b l e _ s i z e ) / 4 )
.text
.balign 4
.macro LEDS val
# sethi. p % h i ( 0 x e 1 2 0 0 0 0 4 ) ,g r30
# setlo % l o ( 0 x e 1 2 0 0 0 0 4 ) ,g r30
# setlos #~ \ v a l , g r 31
# st g r31 ,@(gr30,gr0)
# sethi. p % h i ( 0 x f f c00 1 0 0 ) ,g r30
# setlo % l o ( 0 x f f c00 1 0 0 ) ,g r30
# sth g r0 ,@(gr30,gr0)
# membar
.endm
.macro LEDS32
# not g r31 ,g r31
# sethi. p % h i ( 0 x e 1 2 0 0 0 0 4 ) ,g r30
# setlo % l o ( 0 x e 1 2 0 0 0 0 4 ) ,g r30
# st. p g r31 ,@(gr30,gr0)
# srli g r31 ,#16 ,g r31
# sethi. p % h i ( 0 x f f c00 1 0 0 ) ,g r30
# setlo % l o ( 0 x f f c00 1 0 0 ) ,g r30
# sth g r31 ,@(gr30,gr0)
# membar
.endm
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# entry p o i n t f o r E x t e r n a l i n t e r r u p t s r e c e i v e d w h i l s t e x e c u t i n g u s e r s p a c e c o d e
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_uspace_external_interrupt
.type _ _ entry_ u s p a c e _ e x t e r n a l _ i n t e r r u p t ,@function
__entry_uspace_external_interrupt :
LEDS 0 x62 0 0
sethi. p % h i ( _ _ k e r n e l _ f r a m e 0 _ p t r ) ,g r28
setlo % l o ( _ _ k e r n e l _ f r a m e 0 _ p t r ) ,g r28
ldi @(gr28,#0),gr28
# handle h / w s i n g l e - s t e p t h r o u g h e x c e p t i o n s
sti g r0 ,@(gr28,#REG__STATUS)
.globl __entry_uspace_external_interrupt_reentry
__entry_uspace_external_interrupt_reentry :
LEDS 0 x62 0 1
setlos #R E G _ _ E N D , g r 30
dcpl g r28 ,g r30 ,#0
# finish b u i l d i n g t h e e x c e p t i o n f r a m e
sti s p , @(gr28,#REG_SP)
stdi g r2 , @(gr28,#REG_GR(2))
stdi g r4 , @(gr28,#REG_GR(4))
stdi g r6 , @(gr28,#REG_GR(6))
stdi g r8 , @(gr28,#REG_GR(8))
stdi g r10 ,@(gr28,#REG_GR(10))
stdi g r12 ,@(gr28,#REG_GR(12))
stdi g r14 ,@(gr28,#REG_GR(14))
stdi g r16 ,@(gr28,#REG_GR(16))
stdi g r18 ,@(gr28,#REG_GR(18))
stdi g r20 ,@(gr28,#REG_GR(20))
stdi g r22 ,@(gr28,#REG_GR(22))
stdi g r24 ,@(gr28,#REG_GR(24))
stdi g r26 ,@(gr28,#REG_GR(26))
sti g r0 , @(gr28,#REG_GR(28))
sti g r29 ,@(gr28,#REG_GR(29))
stdi. p g r30 ,@(gr28,#REG_GR(30))
# set u p t h e k e r n e l s t a c k p o i n t e r
ori g r28 ,0 ,s p
movsg t b r ,g r20
movsg p s r ,g r22
movsg p c s r ,g r21
movsg i s r ,g r23
movsg c c r ,g r24
movsg c c c r ,g r25
movsg l r ,g r26
movsg l c r ,g r27
setlos. p #- 1 ,g r4
andi g r22 ,#P S R _ P S , g r 5 / * t r y t o r e b u i l d o r i g i n a l P S R v a l u e * /
andi. p g r22 ,#~ ( P S R _ P S | P S R _ S ) , g r 6
slli g r5 ,#1 ,g r5
or g r6 ,g r5 ,g r5
andi g r5 ,#~ P S R _ E T , g r 5
sti g r20 ,@(gr28,#REG_TBR)
sti g r21 ,@(gr28,#REG_PC)
sti g r5 ,@(gr28,#REG_PSR)
sti g r23 ,@(gr28,#REG_ISR)
stdi g r24 ,@(gr28,#REG_CCR)
stdi g r26 ,@(gr28,#REG_LR)
sti g r4 ,@(gr28,#REG_SYSCALLNO)
movsg i a c c0 h ,g r4
movsg i a c c0 l ,g r5
stdi g r4 ,@(gr28,#REG_IACC0)
movsg g n e r0 ,g r4
movsg g n e r1 ,g r5
[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 13:53:20 -08:00
stdi. p g r4 ,@(gr28,#REG_GNER0)
# interrupts s t a r t o f f f u l l y d i s a b l e d i n t h e i n t e r r u p t h a n d l e r
subcc g r0 ,g r0 ,g r0 ,i c c2 / * s e t Z a n d c l e a r C * /
2005-04-16 15:20:36 -07:00
# set u p k e r n e l g l o b a l r e g i s t e r s
sethi. p % h i ( _ _ k e r n e l _ c u r r e n t _ t a s k ) ,g r5
setlo % l o ( _ _ k e r n e l _ c u r r e n t _ t a s k ) ,g r5
sethi. p % h i ( _ g p ) ,g r16
setlo % l o ( _ g p ) ,g r16
ldi @(gr5,#0),gr29
ldi. p @(gr29,#4),gr15 ; __current_thread_info = current->thread_info
# make s u r e w e ( t h e k e r n e l ) g e t d i v - z e r o a n d m i s a l i g n m e n t e x c e p t i o n s
setlos #I S R _ E D E | I S R _ D T T _ D I V B Y Z E R O | I S R _ E M A M _ E X C E P T I O N , g r 5
movgs g r5 ,i s r
# switch t o t h e k e r n e l t r a p t a b l e
sethi. p % h i ( _ _ e n t r y _ k e r n e l t r a p _ t a b l e ) ,g r6
setlo % l o ( _ _ e n t r y _ k e r n e l t r a p _ t a b l e ) ,g r6
movgs g r6 ,t b r
# set t h e r e t u r n a d d r e s s
sethi. p % h i ( _ _ e n t r y _ r e t u r n _ f r o m _ u s e r _ i n t e r r u p t ) ,g r4
setlo % l o ( _ _ e n t r y _ r e t u r n _ f r o m _ u s e r _ i n t e r r u p t ) ,g r4
movgs g r4 ,l r
# raise t h e m i n i m u m i n t e r r u p t p r i o r i t y t o 1 5 ( N M I o n l y ) a n d e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ P I L _ 14 ,g r4
movgs g r4 ,p s r
ori g r4 ,#P S R _ P I L _ 14 | P S R _ E T ,g r4
movgs g r4 ,p s r
LEDS 0 x62 0 2
bra d o _ I R Q
.size _ _ entry_ u s p a c e _ e x t e r n a l _ i n t e r r u p t ,. - _ _ e n t r y _ u s p a c e _ e x t e r n a l _ i n t e r r u p t
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# entry p o i n t f o r E x t e r n a l i n t e r r u p t s r e c e i v e d w h i l s t e x e c u t i n g k e r n e l c o d e
# - on a r r i v i n g h e r e , t h e f o l l o w i n g r e g i s t e r s s h o u l d a l r e a d y b e s e t u p :
# GR1 5 - c u r r e n t t h r e a d _ i n f o s t r u c t p o i n t e r
# GR1 6 - k e r n e l G P - R E L p o i n t e r
# GR2 9 - c u r r e n t t a s k s t r u c t p o i n t e r
# TBR - k e r n e l t r a p v e c t o r t a b l e
# ISR - k e r n e l ' s p r e f e r r e d i n t e g e r c o n t r o l s
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_kernel_external_interrupt
.type _ _ entry_ k e r n e l _ e x t e r n a l _ i n t e r r u p t ,@function
__entry_kernel_external_interrupt :
LEDS 0 x62 1 0
[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 13:53:20 -08:00
/ / sub s p ,g r15 ,g r31
/ / LEDS3 2
2005-04-16 15:20:36 -07:00
# set u p t h e s t a c k p o i n t e r
or. p s p ,g r0 ,g r30
subi s p ,#R E G _ _ E N D , s p
sti g r30 ,@(sp,#REG_SP)
# handle h / w s i n g l e - s t e p t h r o u g h e x c e p t i o n s
sti g r0 ,@(sp,#REG__STATUS)
.globl __entry_kernel_external_interrupt_reentry
__entry_kernel_external_interrupt_reentry :
LEDS 0 x62 1 1
# set u p t h e e x c e p t i o n f r a m e
setlos #R E G _ _ E N D , g r 30
dcpl s p ,g r30 ,#0
sti. p g r28 ,@(sp,#REG_GR(28))
ori s p ,0 ,g r28
# finish b u i l d i n g t h e e x c e p t i o n f r a m e
stdi g r2 ,@(gr28,#REG_GR(2))
stdi g r4 ,@(gr28,#REG_GR(4))
stdi g r6 ,@(gr28,#REG_GR(6))
stdi g r8 ,@(gr28,#REG_GR(8))
stdi g r10 ,@(gr28,#REG_GR(10))
stdi g r12 ,@(gr28,#REG_GR(12))
stdi g r14 ,@(gr28,#REG_GR(14))
stdi g r16 ,@(gr28,#REG_GR(16))
stdi g r18 ,@(gr28,#REG_GR(18))
stdi g r20 ,@(gr28,#REG_GR(20))
stdi g r22 ,@(gr28,#REG_GR(22))
stdi g r24 ,@(gr28,#REG_GR(24))
stdi g r26 ,@(gr28,#REG_GR(26))
sti g r29 ,@(gr28,#REG_GR(29))
[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 13:53:20 -08:00
stdi. p g r30 ,@(gr28,#REG_GR(30))
# note v i r t u a l i n t e r r u p t s w i l l b e f u l l y e n a b l e d u p o n r e t u r n
subicc g r0 ,#1 ,g r0 ,i c c2 / * c l e a r Z , s e t C * /
2005-04-16 15:20:36 -07:00
movsg t b r ,g r20
movsg p s r ,g r22
movsg p c s r ,g r21
movsg i s r ,g r23
movsg c c r ,g r24
movsg c c c r ,g r25
movsg l r ,g r26
movsg l c r ,g r27
setlos. p #- 1 ,g r4
andi g r22 ,#P S R _ P S , g r 5 / * t r y t o r e b u i l d o r i g i n a l P S R v a l u e * /
andi. p g r22 ,#~ ( P S R _ P S | P S R _ S ) , g r 6
slli g r5 ,#1 ,g r5
or g r6 ,g r5 ,g r5
andi. p g r5 ,#~ P S R _ E T , g r 5
# set C C C R . C C 3 t o U n d e f i n e d t o a b o r t a t o m i c - m o d i f y c o m p l e t i o n i n s i d e t h e k e r n e l
# - for a n e x p l a n a t i o n o f h o w i t w o r k s , s e e : D o c u m e n t a t i o n / f u j i t s u / f r v / a t o m i c - o p s . t x t
andi g r25 ,#~ 0xc0 ,g r25
sti g r20 ,@(gr28,#REG_TBR)
sti g r21 ,@(gr28,#REG_PC)
sti g r5 ,@(gr28,#REG_PSR)
sti g r23 ,@(gr28,#REG_ISR)
stdi g r24 ,@(gr28,#REG_CCR)
stdi g r26 ,@(gr28,#REG_LR)
sti g r4 ,@(gr28,#REG_SYSCALLNO)
movsg i a c c0 h ,g r4
movsg i a c c0 l ,g r5
stdi g r4 ,@(gr28,#REG_IACC0)
movsg g n e r0 ,g r4
movsg g n e r1 ,g r5
[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 13:53:20 -08:00
stdi. p g r4 ,@(gr28,#REG_GNER0)
# interrupts s t a r t o f f f u l l y d i s a b l e d i n t h e i n t e r r u p t h a n d l e r
subcc g r0 ,g r0 ,g r0 ,i c c2 / * s e t Z a n d c l e a r C * /
2005-04-16 15:20:36 -07:00
# set t h e r e t u r n a d d r e s s
sethi. p % h i ( _ _ e n t r y _ r e t u r n _ f r o m _ k e r n e l _ i n t e r r u p t ) ,g r4
setlo % l o ( _ _ e n t r y _ r e t u r n _ f r o m _ k e r n e l _ i n t e r r u p t ) ,g r4
movgs g r4 ,l r
# clear p o w e r - s a v i n g m o d e f l a g s
movsg h s r0 ,g r4
andi g r4 ,#~ H S R 0 _ P D M ,g r4
movgs g r4 ,h s r0
# raise t h e m i n i m u m i n t e r r u p t p r i o r i t y t o 1 5 ( N M I o n l y ) a n d e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ P I L _ 14 ,g r4
movgs g r4 ,p s r
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
LEDS 0 x62 1 2
bra d o _ I R Q
.size _ _ entry_ k e r n e l _ e x t e r n a l _ i n t e r r u p t ,. - _ _ e n t r y _ k e r n e l _ e x t e r n a l _ i n t e r r u p t
[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 13:53:20 -08:00
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# deal w i t h i n t e r r u p t s t h a t w e r e a c t u a l l y v i r t u a l l y d i s a b l e d
# - we n e e d t o r e a l l y d i s a b l e t h e m , f l a g t h e f a c t a n d r e t u r n i m m e d i a t e l y
# - if y o u c h a n g e t h i s , y o u m u s t a l t e r b r e a k . S a l s o
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.balign L1_CACHE_BYTES
.globl __entry_kernel_external_interrupt_virtually_disabled
.type _ _ entry_ k e r n e l _ e x t e r n a l _ i n t e r r u p t _ v i r t u a l l y _ d i s a b l e d ,@function
__entry_kernel_external_interrupt_virtually_disabled :
movsg p s r ,g r30
andi g r30 ,#~ P S R _ P I L , g r 30
ori g r30 ,#P S R _ P I L _ 14 ,g r30 ; debugging interrupts only
movgs g r30 ,p s r
subcc g r0 ,g r0 ,g r0 ,i c c2 ; leave Z set, clear C
rett #0
.size _ _ entry_ k e r n e l _ e x t e r n a l _ i n t e r r u p t _ v i r t u a l l y _ d i s a b l e d ,. - _ _ e n t r y _ k e r n e l _ e x t e r n a l _ i n t e r r u p t _ v i r t u a l l y _ d i s a b l e d
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# deal w i t h r e - e n a b l e m e n t o f i n t e r r u p t s t h a t w e r e p e n d i n g w h e n v i r t u a l l y r e - e n a b l e d
# - set I C C 2 . C , r e - e n a b l e t h e r e a l i n t e r r u p t s a n d r e t u r n
# - we c a n c l e a r I C C 2 . Z b e c a u s e w e s h o u l d n ' t b e h e r e i f i t ' s n o t 0 [ d u e t o T I H I ]
# - if y o u c h a n g e t h i s , y o u m u s t a l t e r b r e a k . S a l s o
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.balign L1_CACHE_BYTES
.globl __entry_kernel_external_interrupt_virtual_reenable
.type _ _ entry_ k e r n e l _ e x t e r n a l _ i n t e r r u p t _ v i r t u a l _ r e e n a b l e ,@function
__entry_kernel_external_interrupt_virtual_reenable :
movsg p s r ,g r30
andi g r30 ,#~ P S R _ P I L , g r 30 ; re-enable interrupts
movgs g r30 ,p s r
subicc g r0 ,#1 ,g r0 ,i c c2 ; clear Z, set C
rett #0
.size _ _ entry_ k e r n e l _ e x t e r n a l _ i n t e r r u p t _ v i r t u a l _ r e e n a b l e ,. - _ _ e n t r y _ k e r n e l _ e x t e r n a l _ i n t e r r u p t _ v i r t u a l _ r e e n a b l e
2005-04-16 15:20:36 -07:00
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# entry p o i n t f o r S o f t w a r e a n d P r o g a m i n t e r r u p t s g e n e r a t e d w h i l s t e x e c u t i n g u s e r s p a c e c o d e
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_uspace_softprog_interrupt
.type _ _ entry_ u s p a c e _ s o f t p r o g _ i n t e r r u p t ,@function
.globl __entry_uspace_handle_mmu_fault
__entry_uspace_softprog_interrupt :
LEDS 0 x60 0 0
# ifdef C O N F I G _ M M U
movsg e a r0 ,g r28
__entry_uspace_handle_mmu_fault :
movgs g r28 ,s c r2
# endif
sethi. p % h i ( _ _ k e r n e l _ f r a m e 0 _ p t r ) ,g r28
setlo % l o ( _ _ k e r n e l _ f r a m e 0 _ p t r ) ,g r28
ldi @(gr28,#0),gr28
# handle h / w s i n g l e - s t e p t h r o u g h e x c e p t i o n s
sti g r0 ,@(gr28,#REG__STATUS)
.globl __entry_uspace_softprog_interrupt_reentry
__entry_uspace_softprog_interrupt_reentry :
LEDS 0 x60 0 1
setlos #R E G _ _ E N D , g r 30
dcpl g r28 ,g r30 ,#0
# set u p t h e k e r n e l s t a c k p o i n t e r
sti. p s p ,@(gr28,#REG_SP)
ori g r28 ,0 ,s p
sti g r0 ,@(gr28,#REG_GR(28))
stdi g r20 ,@(gr28,#REG_GR(20))
stdi g r22 ,@(gr28,#REG_GR(22))
movsg t b r ,g r20
movsg p c s r ,g r21
movsg p s r ,g r22
sethi. p % h i ( _ _ e n t r y _ r e t u r n _ f r o m _ u s e r _ e x c e p t i o n ) ,g r23
setlo % l o ( _ _ e n t r y _ r e t u r n _ f r o m _ u s e r _ e x c e p t i o n ) ,g r23
[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 13:53:20 -08:00
2005-04-16 15:20:36 -07:00
bra _ _ e n t r y _ c o m m o n
.size _ _ entry_ u s p a c e _ s o f t p r o g _ i n t e r r u p t ,. - _ _ e n t r y _ u s p a c e _ s o f t p r o g _ i n t e r r u p t
# single- s t e p p i n g w a s d i s a b l e d o n e n t r y t o a T L B h a n d l e r t h a t t h e n f a u l t e d
# ifdef C O N F I G _ M M U
.globl __entry_uspace_handle_mmu_fault_sstep
__entry_uspace_handle_mmu_fault_sstep :
movgs g r28 ,s c r2
sethi. p % h i ( _ _ k e r n e l _ f r a m e 0 _ p t r ) ,g r28
setlo % l o ( _ _ k e r n e l _ f r a m e 0 _ p t r ) ,g r28
ldi @(gr28,#0),gr28
# flag s i n g l e - s t e p r e - e n a b l e m e n t
sti g r0 ,@(gr28,#REG__STATUS)
bra _ _ e n t r y _ u s p a c e _ s o f t p r o g _ i n t e r r u p t _ r e e n t r y
# endif
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# entry p o i n t f o r S o f t w a r e a n d P r o g a m i n t e r r u p t s g e n e r a t e d w h i l s t e x e c u t i n g k e r n e l c o d e
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_kernel_softprog_interrupt
.type _ _ entry_ k e r n e l _ s o f t p r o g _ i n t e r r u p t ,@function
__entry_kernel_softprog_interrupt :
LEDS 0 x60 0 4
# ifdef C O N F I G _ M M U
movsg e a r0 ,g r30
movgs g r30 ,s c r2
# endif
.globl __entry_kernel_handle_mmu_fault
__entry_kernel_handle_mmu_fault :
# set u p t h e s t a c k p o i n t e r
subi s p ,#R E G _ _ E N D , s p
sti s p ,@(sp,#REG_SP)
sti s p ,@(sp,#REG_SP-4)
andi s p ,#~ 7 ,s p
# handle h / w s i n g l e - s t e p t h r o u g h e x c e p t i o n s
sti g r0 ,@(sp,#REG__STATUS)
.globl __entry_kernel_softprog_interrupt_reentry
__entry_kernel_softprog_interrupt_reentry :
LEDS 0 x60 0 5
setlos #R E G _ _ E N D , g r 30
dcpl s p ,g r30 ,#0
# set u p t h e e x c e p t i o n f r a m e
sti. p g r28 ,@(sp,#REG_GR(28))
ori s p ,0 ,g r28
stdi g r20 ,@(gr28,#REG_GR(20))
stdi g r22 ,@(gr28,#REG_GR(22))
ldi @(sp,#REG_SP),gr22 /* reconstruct the old SP */
addi g r22 ,#R E G _ _ E N D , g r 22
sti g r22 ,@(sp,#REG_SP)
# set C C C R . C C 3 t o U n d e f i n e d t o a b o r t a t o m i c - m o d i f y c o m p l e t i o n i n s i d e t h e k e r n e l
# - for a n e x p l a n a t i o n o f h o w i t w o r k s , s e e : D o c u m e n t a t i o n / f u j i t s u / f r v / a t o m i c - o p s . t x t
movsg c c c r ,g r20
andi g r20 ,#~ 0xc0 ,g r20
movgs g r20 ,c c c r
movsg t b r ,g r20
movsg p c s r ,g r21
movsg p s r ,g r22
sethi. p % h i ( _ _ e n t r y _ r e t u r n _ f r o m _ k e r n e l _ e x c e p t i o n ) ,g r23
setlo % l o ( _ _ e n t r y _ r e t u r n _ f r o m _ k e r n e l _ e x c e p t i o n ) ,g r23
bra _ _ e n t r y _ c o m m o n
.size _ _ entry_ k e r n e l _ s o f t p r o g _ i n t e r r u p t ,. - _ _ e n t r y _ k e r n e l _ s o f t p r o g _ i n t e r r u p t
# single- s t e p p i n g w a s d i s a b l e d o n e n t r y t o a T L B h a n d l e r t h a t t h e n f a u l t e d
# ifdef C O N F I G _ M M U
.globl __entry_kernel_handle_mmu_fault_sstep
__entry_kernel_handle_mmu_fault_sstep :
# set u p t h e s t a c k p o i n t e r
subi s p ,#R E G _ _ E N D , s p
sti s p ,@(sp,#REG_SP)
sti s p ,@(sp,#REG_SP-4)
andi s p ,#~ 7 ,s p
# flag s i n g l e - s t e p r e - e n a b l e m e n t
sethi #R E G _ _ S T A T U S _ S T E P , g r 30
sti g r30 ,@(sp,#REG__STATUS)
bra _ _ e n t r y _ k e r n e l _ s o f t p r o g _ i n t e r r u p t _ r e e n t r y
# endif
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# the r e s t o f t h e k e r n e l e n t r y p o i n t c o d e
# - on a r r i v i n g h e r e , t h e f o l l o w i n g r e g i s t e r s s h o u l d b e s e t u p :
# GR1 - k e r n e l s t a c k p o i n t e r
# GR7 - s y s c a l l n u m b e r ( t r a p 0 o n l y )
# GR8 - 1 3 - s y s c a l l a r g s ( t r a p 0 o n l y )
# GR2 0 - s a v e d T B R
# GR2 1 - s a v e d P C
# GR2 2 - s a v e d P S R
# GR2 3 - r e t u r n h a n d l e r a d d r e s s
# GR2 8 - e x c e p t i o n f r a m e o n s t a c k
# SCR2 - s a v e d E A R 0 w h e r e a p p l i c a b l e ( c l o b b e r e d b y I C I & I C E F i n s n s o n F R 4 5 1 )
# PSR - P S R . S 1 , P S R . E T 0
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_common
.type _ _ entry_ c o m m o n ,@function
__entry_common :
LEDS 0 x60 0 8
# finish b u i l d i n g t h e e x c e p t i o n f r a m e
stdi g r2 ,@(gr28,#REG_GR(2))
stdi g r4 ,@(gr28,#REG_GR(4))
stdi g r6 ,@(gr28,#REG_GR(6))
stdi g r8 ,@(gr28,#REG_GR(8))
stdi g r10 ,@(gr28,#REG_GR(10))
stdi g r12 ,@(gr28,#REG_GR(12))
stdi g r14 ,@(gr28,#REG_GR(14))
stdi g r16 ,@(gr28,#REG_GR(16))
stdi g r18 ,@(gr28,#REG_GR(18))
stdi g r24 ,@(gr28,#REG_GR(24))
stdi g r26 ,@(gr28,#REG_GR(26))
sti g r29 ,@(gr28,#REG_GR(29))
stdi g r30 ,@(gr28,#REG_GR(30))
movsg l c r ,g r27
movsg l r ,g r26
movgs g r23 ,l r
movsg c c c r ,g r25
movsg c c r ,g r24
movsg i s r ,g r23
setlos. p #- 1 ,g r4
andi g r22 ,#P S R _ P S , g r 5 / * t r y t o r e b u i l d o r i g i n a l P S R v a l u e * /
andi. p g r22 ,#~ ( P S R _ P S | P S R _ S ) , g r 6
slli g r5 ,#1 ,g r5
or g r6 ,g r5 ,g r5
andi g r5 ,#~ P S R _ E T , g r 5
sti g r20 ,@(gr28,#REG_TBR)
sti g r21 ,@(gr28,#REG_PC)
sti g r5 ,@(gr28,#REG_PSR)
sti g r23 ,@(gr28,#REG_ISR)
stdi g r24 ,@(gr28,#REG_CCR)
stdi g r26 ,@(gr28,#REG_LR)
sti g r4 ,@(gr28,#REG_SYSCALLNO)
movsg i a c c0 h ,g r4
movsg i a c c0 l ,g r5
stdi g r4 ,@(gr28,#REG_IACC0)
movsg g n e r0 ,g r4
movsg g n e r1 ,g r5
[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 13:53:20 -08:00
stdi. p g r4 ,@(gr28,#REG_GNER0)
# set u p v i r t u a l i n t e r r u p t d i s a b l e m e n t
subicc g r0 ,#1 ,g r0 ,i c c2 / * c l e a r Z f l a g , s e t C f l a g * /
2005-04-16 15:20:36 -07:00
# set u p k e r n e l g l o b a l r e g i s t e r s
sethi. p % h i ( _ _ k e r n e l _ c u r r e n t _ t a s k ) ,g r5
setlo % l o ( _ _ k e r n e l _ c u r r e n t _ t a s k ) ,g r5
sethi. p % h i ( _ g p ) ,g r16
setlo % l o ( _ g p ) ,g r16
ldi @(gr5,#0),gr29
ldi @(gr29,#4),gr15 ; __current_thread_info = current->thread_info
# switch t o t h e k e r n e l t r a p t a b l e
sethi. p % h i ( _ _ e n t r y _ k e r n e l t r a p _ t a b l e ) ,g r6
setlo % l o ( _ _ e n t r y _ k e r n e l t r a p _ t a b l e ) ,g r6
movgs g r6 ,t b r
# make s u r e w e ( t h e k e r n e l ) g e t d i v - z e r o a n d m i s a l i g n m e n t e x c e p t i o n s
setlos #I S R _ E D E | I S R _ D T T _ D I V B Y Z E R O | I S R _ E M A M _ E X C E P T I O N , g r 5
movgs g r5 ,i s r
# clear p o w e r - s a v i n g m o d e f l a g s
movsg h s r0 ,g r4
andi g r4 ,#~ H S R 0 _ P D M ,g r4
movgs g r4 ,h s r0
# multiplex a g a i n u s i n g o l d T B R a s a g u i d e
setlos. p #T B R _ T T , g r 3
sethi % h i ( _ _ e n t r y _ v e c t o r _ t a b l e ) ,g r6
and. p g r20 ,g r3 ,g r5
setlo % l o ( _ _ e n t r y _ v e c t o r _ t a b l e ) ,g r6
srli g r5 ,#2 ,g r5
ld @(gr5,gr6),gr5
LEDS 0 x60 0 9
jmpl @(gr5,gr0)
.size _ _ entry_ c o m m o n ,. - _ _ e n t r y _ c o m m o n
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle i n s t r u c t i o n M M U f a u l t
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# ifdef C O N F I G _ M M U
.globl __entry_insn_mmu_fault
__entry_insn_mmu_fault :
LEDS 0 x60 1 0
setlos #0 ,g r8
movsg e s r0 ,g r9
movsg s c r2 ,g r10
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
sethi. p % h i ( d o _ p a g e _ f a u l t ) ,g r5
setlo % l o ( d o _ p a g e _ f a u l t ) ,g r5
jmpl @(gr5,gr0) ; call do_page_fault(0,esr0,ear0)
# endif
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle i n s t r u c t i o n a c c e s s e r r o r
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_insn_access_error
__entry_insn_access_error :
LEDS 0 x60 1 1
sethi. p % h i ( i n s n _ a c c e s s _ e r r o r ) ,g r5
setlo % l o ( i n s n _ a c c e s s _ e r r o r ) ,g r5
movsg e s f r1 ,g r8
movsg e p c r0 ,g r9
movsg e s r0 ,g r10
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call insn_access_error(esfr1,epcr0,esr0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle v a r i o u s i n s t r u c t i o n s o f d u b i o u s l e g a l i t y
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_unsupported_trap
.globl __entry_illegal_instruction
.globl __entry_privileged_instruction
.globl __entry_debug_exception
__entry_unsupported_trap :
subi g r21 ,#4 ,g r21
sti g r21 ,@(gr28,#REG_PC)
__entry_illegal_instruction :
__entry_privileged_instruction :
__entry_debug_exception :
LEDS 0 x60 1 2
sethi. p % h i ( i l l e g a l _ i n s t r u c t i o n ) ,g r5
setlo % l o ( i l l e g a l _ i n s t r u c t i o n ) ,g r5
movsg e s f r1 ,g r8
movsg e p c r0 ,g r9
movsg e s r0 ,g r10
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call ill_insn(esfr1,epcr0,esr0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle m e d i a e x c e p t i o n
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_media_exception
__entry_media_exception :
LEDS 0 x60 1 3
sethi. p % h i ( m e d i a _ e x c e p t i o n ) ,g r5
setlo % l o ( m e d i a _ e x c e p t i o n ) ,g r5
movsg m s r0 ,g r8
movsg m s r1 ,g r9
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call media_excep(msr0,msr1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle d a t a M M U f a u l t
# handle d a t a D A T f a u l t ( w r i t e - p r o t e c t e x c e p t i o n )
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
# ifdef C O N F I G _ M M U
.globl __entry_data_mmu_fault
__entry_data_mmu_fault :
.globl __entry_data_dat_fault
__entry_data_dat_fault :
LEDS 0 x60 1 4
setlos #1 ,g r8
movsg e s r0 ,g r9
movsg s c r2 ,g r10 ; saved EAR0
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
sethi. p % h i ( d o _ p a g e _ f a u l t ) ,g r5
setlo % l o ( d o _ p a g e _ f a u l t ) ,g r5
jmpl @(gr5,gr0) ; call do_page_fault(1,esr0,ear0)
# endif
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle d a t a a n d i n s t r u c t i o n a c c e s s e x c e p t i o n s
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_insn_access_exception
.globl __entry_data_access_exception
__entry_insn_access_exception :
__entry_data_access_exception :
LEDS 0 x60 1 6
sethi. p % h i ( m e m o r y _ a c c e s s _ e x c e p t i o n ) ,g r5
setlo % l o ( m e m o r y _ a c c e s s _ e x c e p t i o n ) ,g r5
movsg e s r0 ,g r8
movsg s c r2 ,g r9 ; saved EAR0
movsg e p c r0 ,g r10
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call memory_access_error(esr0,ear0,epcr0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle d a t a a c c e s s e r r o r
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_data_access_error
__entry_data_access_error :
LEDS 0 x60 1 6
sethi. p % h i ( d a t a _ a c c e s s _ e r r o r ) ,g r5
setlo % l o ( d a t a _ a c c e s s _ e r r o r ) ,g r5
movsg e s f r1 ,g r8
movsg e s r15 ,g r9
movsg e a r15 ,g r10
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call data_access_error(esfr1,esr15,ear15)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle d a t a s t o r e e r r o r
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_data_store_error
__entry_data_store_error :
LEDS 0 x60 1 7
sethi. p % h i ( d a t a _ s t o r e _ e r r o r ) ,g r5
setlo % l o ( d a t a _ s t o r e _ e r r o r ) ,g r5
movsg e s f r1 ,g r8
movsg e s r14 ,g r9
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call data_store_error(esfr1,esr14)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle d i v i s i o n e x c e p t i o n
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_division_exception
__entry_division_exception :
LEDS 0 x60 1 8
sethi. p % h i ( d i v i s i o n _ e x c e p t i o n ) ,g r5
setlo % l o ( d i v i s i o n _ e x c e p t i o n ) ,g r5
movsg e s f r1 ,g r8
movsg e s r0 ,g r9
movsg i s r ,g r10
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call div_excep(esfr1,esr0,isr)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle c o m p o u n d e x c e p t i o n
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_compound_exception
__entry_compound_exception :
LEDS 0 x60 1 9
sethi. p % h i ( c o m p o u n d _ e x c e p t i o n ) ,g r5
setlo % l o ( c o m p o u n d _ e x c e p t i o n ) ,g r5
movsg e s f r1 ,g r8
movsg e s r0 ,g r9
movsg e s r14 ,g r10
movsg e s r15 ,g r11
movsg m s r0 ,g r12
movsg m s r1 ,g r13
# now t h a t w e ' v e a c c e s s e d t h e e x c e p t i o n r e g s , w e c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
jmpl @(gr5,gr0) ; call comp_excep(esfr1,esr0,esr14,esr15,msr0,msr1)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# handle i n t e r r u p t s a n d N M I s
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_do_IRQ
__entry_do_IRQ :
LEDS 0 x60 2 0
# we c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
bra d o _ I R Q
.globl __entry_do_NMI
__entry_do_NMI :
LEDS 0 x60 2 1
# we c a n e n a b l e e x c e p t i o n s
movsg p s r ,g r4
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
bra d o _ N M I
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# the r e t u r n p a t h f o r a n e w l y f o r k e d c h i l d p r o c e s s
# - _ _ switch_ t o ( ) s a v e d t h e o l d c u r r e n t p o i n t e r i n G R 8 f o r u s
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl ret_from_fork
ret_from_fork :
LEDS 0 x61 0 0
call s c h e d u l e _ t a i l
# fork & c o . r e t u r n 0 t o c h i l d
setlos. p #0 ,g r8
bra _ _ s y s c a l l _ e x i t
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# Return t o u s e r m o d e i s n o t a s c o m p l e x a s a l l t h i s l o o k s ,
# but w e w a n t t h e d e f a u l t p a t h f o r a s y s t e m c a l l r e t u r n t o
# go a s q u i c k l y a s p o s s i b l e w h i c h i s w h y s o m e o f t h i s i s
# less c l e a r t h a n i t o t h e r w i s e s h o u l d b e .
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.balign L1_CACHE_BYTES
.globl system_call
system_call :
LEDS 0 x61 0 1
movsg p s r ,g r4 ; enable exceptions
ori g r4 ,#P S R _ E T , g r 4
movgs g r4 ,p s r
sti g r7 ,@(gr28,#REG_SYSCALLNO)
sti. p g r8 ,@(gr28,#REG_ORIG_GR8)
subicc g r7 ,#n r _ s y s c a l l s , g r 0 ,i c c0
bnc i c c0 ,#0 ,_ _ s y s c a l l _ b a d s y s
ldi @(gr15,#TI_FLAGS),gr4
ori g r4 ,#_ T I F _ S Y S C A L L _ T R A C E , g r 4
andicc g r4 ,#_ T I F _ S Y S C A L L _ T R A C E , g r 0 ,i c c0
bne i c c0 ,#0 ,_ _ s y s c a l l _ t r a c e _ e n t r y
__syscall_call :
slli. p g r7 ,#2 ,g r7
sethi % h i ( s y s _ c a l l _ t a b l e ) ,g r5
setlo % l o ( s y s _ c a l l _ t a b l e ) ,g r5
ld @(gr5,gr7),gr4
calll @(gr4,gr0)
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# return t o i n t e r r u p t e d p r o c e s s
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
__syscall_exit :
LEDS 0 x63 0 0
sti g r8 ,@(gr28,#REG_GR(8)) ; save return value
# rebuild s a v e d p s r - e x e c v e w i l l c h a n g e i t f o r i n i t / m a i n . c
ldi @(gr28,#REG_PSR),gr22
srli g r22 ,#1 ,g r5
andi. p g r22 ,#~ P S R _ P S , g r 22
andi g r5 ,#P S R _ P S , g r 5
or g r5 ,g r22 ,g r22
ori g r22 ,#P S R _ S , g r 22
# keep c u r r e n t P S R i n G R 2 3
movsg p s r ,g r23
# make s u r e w e d o n ' t m i s s a n i n t e r r u p t s e t t i n g n e e d _ r e s c h e d o r s i g p e n d i n g b e t w e e n
# sampling a n d t h e R E T T
ori g r23 ,#P S R _ P I L _ 14 ,g r23
movgs g r23 ,p s r
ldi @(gr15,#TI_FLAGS),gr4
sethi. p % h i ( _ T I F _ A L L W O R K _ M A S K ) ,g r5
setlo % l o ( _ T I F _ A L L W O R K _ M A S K ) ,g r5
andcc g r4 ,g r5 ,g r0 ,i c c0
bne i c c0 ,#0 ,_ _ s y s c a l l _ e x i t _ w o r k
# restore a l l r e g i s t e r s a n d r e t u r n
__entry_return_direct :
LEDS 0 x63 0 1
andi g r22 ,#~ P S R _ E T , g r 22
movgs g r22 ,p s r
ldi @(gr28,#REG_ISR),gr23
lddi @(gr28,#REG_CCR),gr24
lddi @(gr28,#REG_LR) ,gr26
ldi @(gr28,#REG_PC) ,gr21
ldi @(gr28,#REG_TBR),gr20
movgs g r20 ,t b r
movgs g r21 ,p c s r
movgs g r23 ,i s r
movgs g r24 ,c c r
movgs g r25 ,c c c r
movgs g r26 ,l r
movgs g r27 ,l c r
lddi @(gr28,#REG_GNER0),gr4
movgs g r4 ,g n e r0
movgs g r5 ,g n e r1
lddi @(gr28,#REG_IACC0),gr4
movgs g r4 ,i a c c0 h
movgs g r5 ,i a c c0 l
lddi @(gr28,#REG_GR(4)) ,gr4
lddi @(gr28,#REG_GR(6)) ,gr6
lddi @(gr28,#REG_GR(8)) ,gr8
lddi @(gr28,#REG_GR(10)),gr10
lddi @(gr28,#REG_GR(12)),gr12
lddi @(gr28,#REG_GR(14)),gr14
lddi @(gr28,#REG_GR(16)),gr16
lddi @(gr28,#REG_GR(18)),gr18
lddi @(gr28,#REG_GR(20)),gr20
lddi @(gr28,#REG_GR(22)),gr22
lddi @(gr28,#REG_GR(24)),gr24
lddi @(gr28,#REG_GR(26)),gr26
ldi @(gr28,#REG_GR(29)),gr29
lddi @(gr28,#REG_GR(30)),gr30
# check t o s e e i f a d e b u g g i n g r e t u r n i s r e q u i r e d
LEDS 0 x67 f0
movsg c c r ,g r2
ldi @(gr28,#REG__STATUS),gr3
andicc g r3 ,#R E G _ _ S T A T U S _ S T E P , g r 0 ,i c c0
bne i c c0 ,#0 ,_ _ e n t r y _ r e t u r n _ s i n g l e s t e p
movgs g r2 ,c c r
ldi @(gr28,#REG_SP) ,sp
lddi @(gr28,#REG_GR(2)) ,gr2
ldi @(gr28,#REG_GR(28)),gr28
LEDS 0 x67 f e
/ / movsg p c s r ,g r31
/ / LEDS3 2
# if 0
# store t h e c u r r e n t f r a m e i n t h e w o r k r a m o n t h e F R 4 5 1
movgs g r28 ,s c r2
sethi. p % h i ( 0 x f e 8 0 0 0 0 0 ) ,g r28
setlo % l o ( 0 x f e 8 0 0 0 0 0 ) ,g r28
stdi g r2 ,@(gr28,#REG_GR(2))
stdi g r4 ,@(gr28,#REG_GR(4))
stdi g r6 ,@(gr28,#REG_GR(6))
stdi g r8 ,@(gr28,#REG_GR(8))
stdi g r10 ,@(gr28,#REG_GR(10))
stdi g r12 ,@(gr28,#REG_GR(12))
stdi g r14 ,@(gr28,#REG_GR(14))
stdi g r16 ,@(gr28,#REG_GR(16))
stdi g r18 ,@(gr28,#REG_GR(18))
stdi g r24 ,@(gr28,#REG_GR(24))
stdi g r26 ,@(gr28,#REG_GR(26))
sti g r29 ,@(gr28,#REG_GR(29))
stdi g r30 ,@(gr28,#REG_GR(30))
movsg t b r ,g r30
sti g r30 ,@(gr28,#REG_TBR)
movsg p c s r ,g r30
sti g r30 ,@(gr28,#REG_PC)
movsg p s r ,g r30
sti g r30 ,@(gr28,#REG_PSR)
movsg i s r ,g r30
sti g r30 ,@(gr28,#REG_ISR)
movsg c c r ,g r30
movsg c c c r ,g r31
stdi g r30 ,@(gr28,#REG_CCR)
movsg l r ,g r30
movsg l c r ,g r31
stdi g r30 ,@(gr28,#REG_LR)
sti g r0 ,@(gr28,#REG_SYSCALLNO)
movsg s c r2 ,g r28
# endif
rett #0
# return v i a b r e a k . S
__entry_return_singlestep :
movgs g r2 ,c c r
lddi @(gr28,#REG_GR(2)) ,gr2
ldi @(gr28,#REG_SP) ,sp
ldi @(gr28,#REG_GR(28)),gr28
LEDS 0 x67 f f
break
.globl __entry_return_singlestep_breaks_here
__entry_return_singlestep_breaks_here :
nop
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# return t o a p r o c e s s i n t e r r u p t e d i n k e r n e l s p a c e
# - we n e e d t o c o n s i d e r p r e e m p t i o n i f t h a t i s e n a b l e d
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.balign L1_CACHE_BYTES
__entry_return_from_kernel_exception :
LEDS 0 x63 0 2
movsg p s r ,g r23
ori g r23 ,#P S R _ P I L _ 14 ,g r23
movgs g r23 ,p s r
bra _ _ e n t r y _ r e t u r n _ d i r e c t
.balign L1_CACHE_BYTES
__entry_return_from_kernel_interrupt :
LEDS 0 x63 0 3
movsg p s r ,g r23
ori g r23 ,#P S R _ P I L _ 14 ,g r23
movgs g r23 ,p s r
# ifdef C O N F I G _ P R E E M P T
ldi @(gr15,#TI_PRE_COUNT),gr5
subicc g r5 ,#0 ,g r0 ,i c c0
beq i c c0 ,#0 ,_ _ e n t r y _ r e t u r n _ d i r e c t
__entry_preempt_need_resched :
ldi @(gr15,#TI_FLAGS),gr4
andicc g r4 ,#_ T I F _ N E E D _ R E S C H E D , g r 0 ,i c c0
beq i c c0 ,#1 ,_ _ e n t r y _ r e t u r n _ d i r e c t
setlos #P R E E M P T _ A C T I V E , g r 5
sti g r5 ,@(gr15,#TI_FLAGS)
andi g r23 ,#~ P S R _ P I L , g r 23
movgs g r23 ,p s r
call s c h e d u l e
sti g r0 ,@(gr15,#TI_PRE_COUNT)
movsg p s r ,g r23
ori g r23 ,#P S R _ P I L _ 14 ,g r23
movgs g r23 ,p s r
bra _ _ e n t r y _ p r e e m p t _ n e e d _ r e s c h e d
# else
bra _ _ e n t r y _ r e t u r n _ d i r e c t
# endif
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# perform w o r k t h a t n e e d s t o b e d o n e i m m e d i a t e l y b e f o r e r e s u m p t i o n
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.globl __entry_return_from_user_exception
.balign L1_CACHE_BYTES
__entry_return_from_user_exception :
LEDS 0 x65 0 1
__entry_resume_userspace :
# make s u r e w e d o n ' t m i s s a n i n t e r r u p t s e t t i n g n e e d _ r e s c h e d o r s i g p e n d i n g b e t w e e n
# sampling a n d t h e R E T T
movsg p s r ,g r23
ori g r23 ,#P S R _ P I L _ 14 ,g r23
movgs g r23 ,p s r
__entry_return_from_user_interrupt :
LEDS 0 x64 0 2
ldi @(gr15,#TI_FLAGS),gr4
sethi. p % h i ( _ T I F _ W O R K _ M A S K ) ,g r5
setlo % l o ( _ T I F _ W O R K _ M A S K ) ,g r5
andcc g r4 ,g r5 ,g r0 ,i c c0
beq i c c0 ,#1 ,_ _ e n t r y _ r e t u r n _ d i r e c t
__entry_work_pending :
LEDS 0 x64 0 4
andicc g r4 ,#_ T I F _ N E E D _ R E S C H E D , g r 0 ,i c c0
beq i c c0 ,#1 ,_ _ e n t r y _ w o r k _ n o t i f y s i g
__entry_work_resched :
LEDS 0 x64 0 8
movsg p s r ,g r23
andi g r23 ,#~ P S R _ P I L , g r 23
movgs g r23 ,p s r
call s c h e d u l e
movsg p s r ,g r23
ori g r23 ,#P S R _ P I L _ 14 ,g r23
movgs g r23 ,p s r
LEDS 0 x64 0 1
ldi @(gr15,#TI_FLAGS),gr4
sethi. p % h i ( _ T I F _ W O R K _ M A S K ) ,g r5
setlo % l o ( _ T I F _ W O R K _ M A S K ) ,g r5
andcc g r4 ,g r5 ,g r0 ,i c c0
beq i c c0 ,#1 ,_ _ e n t r y _ r e t u r n _ d i r e c t
andicc g r4 ,#_ T I F _ N E E D _ R E S C H E D , g r 0 ,i c c0
bne i c c0 ,#1 ,_ _ e n t r y _ w o r k _ r e s c h e d
__entry_work_notifysig :
LEDS 0 x64 1 0
ori. p g r4 ,#0 ,g r8
call d o _ n o t i f y _ r e s u m e
2006-01-06 00:11:44 -08:00
bra _ _ e n t r y _ r e s u m e _ u s e r s p a c e
2005-04-16 15:20:36 -07:00
# perform s y s c a l l e n t r y t r a c i n g
__syscall_trace_entry :
LEDS 0 x63 2 0
setlos. p #0 ,g r8
call d o _ s y s c a l l _ t r a c e
ldi @(gr28,#REG_SYSCALLNO),gr7
lddi @(gr28,#REG_GR(8)) ,gr8
lddi @(gr28,#REG_GR(10)),gr10
lddi. p @(gr28,#REG_GR(12)),gr12
subicc g r7 ,#n r _ s y s c a l l s , g r 0 ,i c c0
bnc i c c0 ,#0 ,_ _ s y s c a l l _ b a d s y s
bra _ _ s y s c a l l _ c a l l
# perform s y s c a l l e x i t t r a c i n g
__syscall_exit_work :
LEDS 0 x63 4 0
andicc g r4 ,#_ T I F _ S Y S C A L L _ T R A C E , g r 0 ,i c c0
beq i c c0 ,#1 ,_ _ e n t r y _ w o r k _ p e n d i n g
movsg p s r ,g r23
andi g r23 ,#~ P S R _ P I L , g r 23 ; could let do_syscall_trace() call schedule()
movgs g r23 ,p s r
setlos. p #1 ,g r8
call d o _ s y s c a l l _ t r a c e
bra _ _ e n t r y _ r e s u m e _ u s e r s p a c e
__syscall_badsys :
LEDS 0 x63 8 0
setlos #- E N O S Y S , g r 8
sti g r8 ,@(gr28,#REG_GR(8)) ; save return value
bra _ _ e n t r y _ r e s u m e _ u s e r s p a c e
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
#
# syscall v e c t o r t a b l e
#
# # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #
.section .rodata
ALIGN
.globl sys_call_table
sys_call_table :
.long sys_restart_syscall /* 0 - old "setup()" system call, used for restarting */
.long sys_exit
.long sys_fork
.long sys_read
.long sys_write
.long sys_open /* 5 */
.long sys_close
.long sys_waitpid
.long sys_creat
.long sys_link
.long sys_unlink /* 10 */
.long sys_execve
.long sys_chdir
.long sys_time
.long sys_mknod
.long sys_chmod /* 15 */
.long sys_lchown16
.long sys_ni_syscall /* old break syscall holder */
.long sys_stat
.long sys_lseek
.long sys_getpid /* 20 */
.long sys_mount
.long sys_oldumount
.long sys_setuid16
.long sys_getuid16
.long sys_ni_syscall / / sys_ s t i m e / * 2 5 * /
.long sys_ptrace
.long sys_alarm
.long sys_fstat
.long sys_pause
.long sys_utime /* 30 */
.long sys_ni_syscall /* old stty syscall holder */
.long sys_ni_syscall /* old gtty syscall holder */
.long sys_access
.long sys_nice
.long sys_ni_syscall /* 35 */ /* old ftime syscall holder */
.long sys_sync
.long sys_kill
.long sys_rename
.long sys_mkdir
.long sys_rmdir /* 40 */
.long sys_dup
.long sys_pipe
.long sys_times
.long sys_ni_syscall /* old prof syscall holder */
.long sys_brk /* 45 */
.long sys_setgid16
.long sys_getgid16
.long sys_ni_syscall / / sys_ s i g n a l
.long sys_geteuid16
.long sys_getegid16 /* 50 */
.long sys_acct
.long sys_umount /* recycled never used phys( */
.long sys_ni_syscall /* old lock syscall holder */
.long sys_ioctl
.long sys_fcntl /* 55 */
.long sys_ni_syscall /* old mpx syscall holder */
.long sys_setpgid
.long sys_ni_syscall /* old ulimit syscall holder */
.long sys_ni_syscall /* old old uname syscall */
.long sys_umask /* 60 */
.long sys_chroot
.long sys_ustat
.long sys_dup2
.long sys_getppid
.long sys_getpgrp /* 65 */
.long sys_setsid
.long sys_sigaction
.long sys_ni_syscall / / sys_ s g e t m a s k
.long sys_ni_syscall / / sys_ s s e t m a s k
.long sys_setreuid16 /* 70 */
.long sys_setregid16
.long sys_sigsuspend
.long sys_ni_syscall / / sys_ s i g p e n d i n g
.long sys_sethostname
.long sys_setrlimit /* 75 */
.long sys_ni_syscall / / sys_ o l d _ g e t r l i m i t
.long sys_getrusage
.long sys_gettimeofday
.long sys_settimeofday
.long sys_getgroups16 /* 80 */
.long sys_setgroups16
.long sys_ni_syscall /* old_select slot */
.long sys_symlink
.long sys_lstat
.long sys_readlink /* 85 */
.long sys_uselib
.long sys_swapon
.long sys_reboot
.long sys_ni_syscall / / old_ r e a d d i r
.long sys_ni_syscall /* 90 */ /* old_mmap slot */
.long sys_munmap
.long sys_truncate
.long sys_ftruncate
.long sys_fchmod
.long sys_fchown16 /* 95 */
.long sys_getpriority
.long sys_setpriority
.long sys_ni_syscall /* old profil syscall holder */
.long sys_statfs
.long sys_fstatfs /* 100 */
.long sys_ni_syscall /* ioperm for i386 */
.long sys_socketcall
.long sys_syslog
.long sys_setitimer
.long sys_getitimer /* 105 */
.long sys_newstat
.long sys_newlstat
.long sys_newfstat
.long sys_ni_syscall /* obsolete olduname( syscall */
.long sys_ni_syscall /* iopl for i386 */ /* 110 */
.long sys_vhangup
.long sys_ni_syscall /* obsolete idle( syscall */
.long sys_ni_syscall /* vm86old for i386 */
.long sys_wait4
.long sys_swapoff /* 115 */
.long sys_sysinfo
.long sys_ipc
.long sys_fsync
.long sys_sigreturn
.long sys_clone /* 120 */
.long sys_setdomainname
.long sys_newuname
.long sys_ni_syscall /* old "cacheflush" */
.long sys_adjtimex
2006-04-10 22:53:06 -07:00
.long sys_mprotect /* 125 */
2005-04-16 15:20:36 -07:00
.long sys_sigprocmask
.long sys_ni_syscall /* old "create_module" */
.long sys_init_module
.long sys_delete_module
.long sys_ni_syscall /* old "get_kernel_syms" */
.long sys_quotactl
.long sys_getpgid
.long sys_fchdir
.long sys_bdflush
.long sys_sysfs /* 135 */
.long sys_personality
.long sys_ni_syscall /* for afs_syscall */
.long sys_setfsuid16
.long sys_setfsgid16
.long sys_llseek /* 140 */
.long sys_getdents
.long sys_select
.long sys_flock
2006-04-10 22:53:06 -07:00
.long sys_msync
2005-04-16 15:20:36 -07:00
.long sys_readv /* 145 */
.long sys_writev
.long sys_getsid
.long sys_fdatasync
.long sys_sysctl
2006-04-10 22:53:06 -07:00
.long sys_mlock /* 150 */
.long sys_munlock
.long sys_mlockall
.long sys_munlockall
2005-04-16 15:20:36 -07:00
.long sys_sched_setparam
.long sys_sched_getparam /* 155 */
.long sys_sched_setscheduler
.long sys_sched_getscheduler
.long sys_sched_yield
.long sys_sched_get_priority_max
.long sys_sched_get_priority_min /* 160 */
.long sys_sched_rr_get_interval
.long sys_nanosleep
2006-04-10 22:53:06 -07:00
.long sys_mremap
2005-04-16 15:20:36 -07:00
.long sys_setresuid16
.long sys_getresuid16 /* 165 */
.long sys_ni_syscall /* for vm86 */
.long sys_ni_syscall /* Old sys_query_module */
.long sys_poll
.long sys_nfsservctl
.long sys_setresgid16 /* 170 */
.long sys_getresgid16
.long sys_prctl
.long sys_rt_sigreturn
.long sys_rt_sigaction
.long sys_rt_sigprocmask /* 175 */
.long sys_rt_sigpending
.long sys_rt_sigtimedwait
.long sys_rt_sigqueueinfo
.long sys_rt_sigsuspend
.long sys_pread64 /* 180 */
.long sys_pwrite64
.long sys_chown16
.long sys_getcwd
.long sys_capget
.long sys_capset /* 185 */
.long sys_sigaltstack
.long sys_sendfile
.long sys_ni_syscall /* streams1 */
.long sys_ni_syscall /* streams2 */
.long sys_vfork /* 190 */
.long sys_getrlimit
.long sys_mmap2
.long sys_truncate64
.long sys_ftruncate64
.long sys_stat64 /* 195 */
.long sys_lstat64
.long sys_fstat64
.long sys_lchown
.long sys_getuid
.long sys_getgid /* 200 */
.long sys_geteuid
.long sys_getegid
.long sys_setreuid
.long sys_setregid
.long sys_getgroups /* 205 */
.long sys_setgroups
.long sys_fchown
.long sys_setresuid
.long sys_getresuid
.long sys_setresgid /* 210 */
.long sys_getresgid
.long sys_chown
.long sys_setuid
.long sys_setgid
.long sys_setfsuid /* 215 */
.long sys_setfsgid
.long sys_pivot_root
2006-04-10 22:53:06 -07:00
.long sys_mincore
.long sys_madvise
2005-04-16 15:20:36 -07:00
.long sys_getdents64 /* 220 */
.long sys_fcntl64
.long sys_ni_syscall /* reserved for TUX */
.long sys_ni_syscall /* Reserved for Security */
.long sys_gettid
.long sys_readahead /* 225 */
.long sys_setxattr
.long sys_lsetxattr
.long sys_fsetxattr
.long sys_getxattr
.long sys_lgetxattr /* 230 */
.long sys_fgetxattr
.long sys_listxattr
.long sys_llistxattr
.long sys_flistxattr
.long sys_removexattr /* 235 */
.long sys_lremovexattr
.long sys_fremovexattr
.long sys_tkill
.long sys_sendfile64
.long sys_futex /* 240 */
.long sys_sched_setaffinity
.long sys_sched_getaffinity
.long sys_ni_syscall / / sys_ s e t _ t h r e a d _ a r e a
.long sys_ni_syscall / / sys_ g e t _ t h r e a d _ a r e a
.long sys_io_setup /* 245 */
.long sys_io_destroy
.long sys_io_getevents
.long sys_io_submit
.long sys_io_cancel
.long sys_fadvise64 /* 250 */
.long sys_ni_syscall
.long sys_exit_group
.long sys_lookup_dcookie
.long sys_epoll_create
.long sys_epoll_ctl /* 255 */
.long sys_epoll_wait
2006-04-10 22:53:06 -07:00
.long sys_remap_file_pages
2005-04-16 15:20:36 -07:00
.long sys_set_tid_address
.long sys_timer_create
.long sys_timer_settime /* 260 */
.long sys_timer_gettime
.long sys_timer_getoverrun
.long sys_timer_delete
.long sys_clock_settime
.long sys_clock_gettime /* 265 */
.long sys_clock_getres
.long sys_clock_nanosleep
.long sys_statfs64
.long sys_fstatfs64
.long sys_tgkill /* 270 */
.long sys_utimes
.long sys_fadvise64_64
.long sys_ni_syscall /* sys_vserver */
.long sys_mbind
.long sys_get_mempolicy
.long sys_set_mempolicy
.long sys_mq_open
.long sys_mq_unlink
.long sys_mq_timedsend
.long sys_mq_timedreceive /* 280 */
.long sys_mq_notify
.long sys_mq_getsetattr
.long sys_ni_syscall /* reserved for kexec */
.long sys_waitid
.long sys_ni_syscall /* 285 */ /* available */
.long sys_add_key
.long sys_request_key
.long sys_keyctl
2006-02-14 13:53:18 -08:00
.long sys_ioprio_set
.long sys_ioprio_get /* 290 */
.long sys_inotify_init
.long sys_inotify_add_watch
.long sys_inotify_rm_watch
.long sys_migrate_pages
.long sys_openat /* 295 */
.long sys_mkdirat
.long sys_mknodat
.long sys_fchownat
.long sys_futimesat
2006-06-23 02:04:07 -07:00
.long sys_fstatat64 /* 300 */
2006-02-14 13:53:18 -08:00
.long sys_unlinkat
.long sys_renameat
.long sys_linkat
.long sys_symlinkat
.long sys_readlinkat /* 305 */
.long sys_fchmodat
.long sys_faccessat
.long sys_pselect6
.long sys_ppoll
2007-05-08 20:27:02 -07:00
.long sys_unshare /* 310 */
.long sys_set_robust_list
.long sys_get_robust_list
.long sys_splice
.long sys_sync_file_range
.long sys_tee /* 315 */
.long sys_vmsplice
.long sys_move_pages
.long sys_getcpu
.long sys_epoll_pwait
2007-07-15 23:38:27 -07:00
.long sys_utimensat /* 320 */
.long sys_signalfd
.long sys_timerfd
.long sys_eventfd
2007-08-10 13:00:50 -07:00
.long sys_fallocate
2005-04-16 15:20:36 -07:00
syscall_ t a b l e _ s i z e = ( . - s y s _ c a l l _ t a b l e )