Commit 50aaccb1 authored by Anton Blanchard's avatar Anton Blanchard

ppc64: store trap into exception frame, make DSISR 32bit and create

CCR field - from Dave Engebretsen
parent 7e43513d
...@@ -163,14 +163,18 @@ _GLOBAL(__secondary_hold) ...@@ -163,14 +163,18 @@ _GLOBAL(__secondary_hold)
#define EX_R23 40 #define EX_R23 40
#define EX_DAR 48 #define EX_DAR 48
#define EX_DSISR 56 #define EX_DSISR 56
#define EX_CCR 60
#define EX_TRAP 60
#define EXCEPTION_PROLOG_PSERIES(label) \ #define EXCEPTION_PROLOG_PSERIES(n,label) \
mtspr SPRG2,r20; /* use SPRG2 as scratch reg */ \ mtspr SPRG2,r20; /* use SPRG2 as scratch reg */ \
mtspr SPRG1,r21; /* save r21 */ \ mtspr SPRG1,r21; /* save r21 */ \
mfspr r20,SPRG3; /* get paca virt addr */ \ mfspr r20,SPRG3; /* get paca virt addr */ \
ld r21,PACAEXCSP(r20); /* get exception stack ptr */ \ ld r21,PACAEXCSP(r20); /* get exception stack ptr */ \
addi r21,r21,EXC_FRAME_SIZE; /* make exception frame */ \ addi r21,r21,EXC_FRAME_SIZE; /* make exception frame */ \
std r22,EX_R22(r21); /* Save r22 in exc. frame */ \ std r22,EX_R22(r21); /* Save r22 in exc. frame */ \
li r22,n; /* Save the ex # in exc. frame*/ \
stw r22,EX_TRAP(r21); /* */ \
std r23,EX_R23(r21); /* Save r23 in exc. frame */ \ std r23,EX_R23(r21); /* Save r23 in exc. frame */ \
mfspr r22,SRR0; /* EA of interrupted instr */ \ mfspr r22,SRR0; /* EA of interrupted instr */ \
std r22,EX_SRR0(r21); /* Save SRR0 in exc. frame */ \ std r22,EX_SRR0(r21); /* Save SRR0 in exc. frame */ \
...@@ -192,18 +196,20 @@ _GLOBAL(__secondary_hold) ...@@ -192,18 +196,20 @@ _GLOBAL(__secondary_hold)
* This is the start of the interrupt handlers for i_series * This is the start of the interrupt handlers for i_series
* This code runs with relocation on. * This code runs with relocation on.
*/ */
#define EXCEPTION_PROLOG_ISERIES \ #define EXCEPTION_PROLOG_ISERIES(n) \
mtspr SPRG2,r20; /* use SPRG2 as scratch reg */\ mtspr SPRG2,r20; /* use SPRG2 as scratch reg */ \
mtspr SPRG1,r21; /* save r21 */\ mtspr SPRG1,r21; /* save r21 */ \
mfspr r20,SPRG3; /* get paca */\ mfspr r20,SPRG3; /* get paca */ \
ld r21,PACAEXCSP(r20); /* get exception stack ptr */\ ld r21,PACAEXCSP(r20); /* get exception stack ptr */ \
addi r21,r21,EXC_FRAME_SIZE; /* make exception frame */\ addi r21,r21,EXC_FRAME_SIZE; /* make exception frame */ \
std r22,EX_R22(r21); /* save r22 on exception frame */\ std r22,EX_R22(r21); /* save r22 on exception frame */ \
std r23,EX_R23(r21); /* Save r23 in exc. frame */\ li r22,n; /* Save the ex # in exc. frame */ \
ld r22,LPPACA+LPPACASRR0(r20); /* Get SRR0 from ItLpPaca */\ stw r22,EX_TRAP(r21); /* */ \
std r22,EX_SRR0(r21); /* save SRR0 in exc. frame */\ std r23,EX_R23(r21); /* Save r23 in exc. frame */ \
ld r23,LPPACA+LPPACASRR1(r20); /* Get SRR1 from ItLpPaca */\ ld r22,LPPACA+LPPACASRR0(r20); /* Get SRR0 from ItLpPaca */ \
std r23,EX_SRR1(r21); /* save SRR1 in exc. frame */\ std r22,EX_SRR0(r21); /* save SRR0 in exc. frame */ \
ld r23,LPPACA+LPPACASRR1(r20); /* Get SRR1 from ItLpPaca */ \
std r23,EX_SRR1(r21); /* save SRR1 in exc. frame */ \
mfcr r23; /* save CR in r23 */ mfcr r23; /* save CR in r23 */
/* /*
...@@ -225,7 +231,7 @@ _GLOBAL(__secondary_hold) ...@@ -225,7 +231,7 @@ _GLOBAL(__secondary_hold)
std r21,PACAEXCSP(r20); /* update exception stack ptr */ \ std r21,PACAEXCSP(r20); /* update exception stack ptr */ \
/* iff no protection flt */ \ /* iff no protection flt */ \
mfspr r22,DSISR; /* Save DSISR in exc. frame */ \ mfspr r22,DSISR; /* Save DSISR in exc. frame */ \
std r22,EX_DSISR(r21); \ stw r22,EX_DSISR(r21); \
ld r22,EX_SRR1(r21); /* Get SRR1 from exc. frame */ \ ld r22,EX_SRR1(r21); /* Get SRR1 from exc. frame */ \
andi. r22,r22,MSR_PR; /* Set CR for later branch */ \ andi. r22,r22,MSR_PR; /* Set CR for later branch */ \
mr r22,r1; /* Save r1 */ \ mr r22,r1; /* Save r1 */ \
...@@ -251,7 +257,7 @@ _GLOBAL(__secondary_hold) ...@@ -251,7 +257,7 @@ _GLOBAL(__secondary_hold)
std r22,_XER(r1); \ std r22,_XER(r1); \
ld r23,EX_DAR(r21); /* move DAR to stackframe */ \ ld r23,EX_DAR(r21); /* move DAR to stackframe */ \
std r23,_DAR(r1); \ std r23,_DAR(r1); \
ld r22,EX_DSISR(r21); /* move DSISR to stackframe */ \ lwz r22,EX_DSISR(r21); /* move DSISR to stackframe */ \
std r22,_DSISR(r1); \ std r22,_DSISR(r1); \
lbz r22,PACAPROCENABLED(r20); \ lbz r22,PACAPROCENABLED(r20); \
std r22,SOFTE(r1); \ std r22,SOFTE(r1); \
...@@ -277,18 +283,18 @@ _GLOBAL(__secondary_hold) ...@@ -277,18 +283,18 @@ _GLOBAL(__secondary_hold)
. = n; \ . = n; \
.globl label##_Pseries; \ .globl label##_Pseries; \
label##_Pseries: \ label##_Pseries: \
EXCEPTION_PROLOG_PSERIES( label##_common ) EXCEPTION_PROLOG_PSERIES( n, label##_common )
#define STD_EXCEPTION_ISERIES( label ) \ #define STD_EXCEPTION_ISERIES( n, label ) \
.globl label##_Iseries; \ .globl label##_Iseries; \
label##_Iseries: \ label##_Iseries: \
EXCEPTION_PROLOG_ISERIES; \ EXCEPTION_PROLOG_ISERIES( n ); \
b label##_common b label##_common
#define MASKABLE_EXCEPTION_ISERIES( label ) \ #define MASKABLE_EXCEPTION_ISERIES( n, label ) \
.globl label##_Iseries; \ .globl label##_Iseries; \
label##_Iseries: \ label##_Iseries: \
EXCEPTION_PROLOG_ISERIES; \ EXCEPTION_PROLOG_ISERIES( n ); \
lbz r22,PACAPROFENABLED(r20); \ lbz r22,PACAPROFENABLED(r20); \
cmpi 0,r22,0; \ cmpi 0,r22,0; \
bne- label##_Iseries_profile; \ bne- label##_Iseries_profile; \
...@@ -364,7 +370,6 @@ __start_naca: ...@@ -364,7 +370,6 @@ __start_naca:
* For LPAR, the hypervisor must fill in at least one entry * For LPAR, the hypervisor must fill in at least one entry
* before we get control (with relocate on) * before we get control (with relocate on)
*/ */
. = 0x5000 . = 0x5000
.globl __end_naca .globl __end_naca
.globl __start_stab .globl __start_stab
...@@ -403,22 +408,22 @@ __end_stab: ...@@ -403,22 +408,22 @@ __end_stab:
/*** ISeries-LPAR interrupt handlers ***/ /*** ISeries-LPAR interrupt handlers ***/
STD_EXCEPTION_ISERIES( MachineCheck ) STD_EXCEPTION_ISERIES( 0x200, MachineCheck )
STD_EXCEPTION_ISERIES( DataAccess ) STD_EXCEPTION_ISERIES( 0x300, DataAccess )
STD_EXCEPTION_ISERIES( DataAccessSLB ) STD_EXCEPTION_ISERIES( 0x380, DataAccessSLB )
STD_EXCEPTION_ISERIES( InstructionAccess ) STD_EXCEPTION_ISERIES( 0x400, InstructionAccess )
STD_EXCEPTION_ISERIES( InstructionAccessSLB ) STD_EXCEPTION_ISERIES( 0x480, InstructionAccessSLB )
MASKABLE_EXCEPTION_ISERIES( HardwareInterrupt ) MASKABLE_EXCEPTION_ISERIES( 0x500, HardwareInterrupt )
STD_EXCEPTION_ISERIES( Alignment ) STD_EXCEPTION_ISERIES( 0x600, Alignment )
STD_EXCEPTION_ISERIES( ProgramCheck ) STD_EXCEPTION_ISERIES( 0x700, ProgramCheck )
STD_EXCEPTION_ISERIES( FPUnavailable ) STD_EXCEPTION_ISERIES( 0x800, FPUnavailable )
MASKABLE_EXCEPTION_ISERIES( Decrementer ) MASKABLE_EXCEPTION_ISERIES( 0x900, Decrementer )
STD_EXCEPTION_ISERIES( Trap_0a ) STD_EXCEPTION_ISERIES( 0xa00, Trap_0a )
STD_EXCEPTION_ISERIES( Trap_0b ) STD_EXCEPTION_ISERIES( 0xb00, Trap_0b )
STD_EXCEPTION_ISERIES( SystemCall ) STD_EXCEPTION_ISERIES( 0xc00, SystemCall )
STD_EXCEPTION_ISERIES( SingleStep ) STD_EXCEPTION_ISERIES( 0xd00, SingleStep )
STD_EXCEPTION_ISERIES( Trap_0e ) STD_EXCEPTION_ISERIES( 0xe00, Trap_0e )
STD_EXCEPTION_ISERIES( PerformanceMonitor ) STD_EXCEPTION_ISERIES( 0xf00, PerformanceMonitor )
.globl SystemReset_Iseries .globl SystemReset_Iseries
SystemReset_Iseries: SystemReset_Iseries:
...@@ -503,10 +508,10 @@ fwnmi_data_area: ...@@ -503,10 +508,10 @@ fwnmi_data_area:
. = 0x8000 . = 0x8000
.globl SystemReset_FWNMI .globl SystemReset_FWNMI
SystemReset_FWNMI: SystemReset_FWNMI:
//EXCEPTION_PROLOG_PSERIES(0x100, SystemReset_common) EXCEPTION_PROLOG_PSERIES(0x100, SystemReset_common)
.globl MachineCheck_FWNMI .globl MachineCheck_FWNMI
MachineCheck_FWNMI: MachineCheck_FWNMI:
//EXCEPTION_PROLOG_PSERIES(0x200, MachineCheck_common) EXCEPTION_PROLOG_PSERIES(0x200, MachineCheck_common)
/*** Common interrupt handlers ***/ /*** Common interrupt handlers ***/
...@@ -839,7 +844,7 @@ _GLOBAL(do_hash_page_DSI) ...@@ -839,7 +844,7 @@ _GLOBAL(do_hash_page_DSI)
* We assume we aren't going to take any exceptions during this procedure. * We assume we aren't going to take any exceptions during this procedure.
*/ */
_GLOBAL(do_stab_bolted) _GLOBAL(do_stab_bolted)
std r23,EX_DAR(r21) /* save CR in exc. frame */ stw r23,EX_CCR(r21) /* save CR in exc. frame */
mfspr r22,DSISR mfspr r22,DSISR
andis. r22,r22,0x0020 andis. r22,r22,0x0020
...@@ -945,7 +950,7 @@ _GLOBAL(do_stab_bolted) ...@@ -945,7 +950,7 @@ _GLOBAL(do_stab_bolted)
mfsprg r20,3 /* Load the PACA pointer */ mfsprg r20,3 /* Load the PACA pointer */
ld r21,PACAEXCSP(r20) /* Get the exception frame pointer */ ld r21,PACAEXCSP(r20) /* Get the exception frame pointer */
addi r21,r21,EXC_FRAME_SIZE addi r21,r21,EXC_FRAME_SIZE
ld r23,EX_DAR(r21) /* get saved CR */ lwz r23,EX_CCR(r21) /* get saved CR */
/* note that this is almost identical to maskable_exception_exit */ /* note that this is almost identical to maskable_exception_exit */
mtcr r23 /* restore CR */ mtcr r23 /* restore CR */
ld r22,EX_SRR0(r21) /* Get SRR0 from exc. frame */ ld r22,EX_SRR0(r21) /* Get SRR0 from exc. frame */
...@@ -966,7 +971,7 @@ _TRACEBACK(do_stab_bolted) ...@@ -966,7 +971,7 @@ _TRACEBACK(do_stab_bolted)
* We assume we aren't going to take any exceptions during this procedure. * We assume we aren't going to take any exceptions during this procedure.
*/ */
_GLOBAL(do_slb_bolted) _GLOBAL(do_slb_bolted)
std r23,48(r21) /* save CR in exc. frame */ stw r23,EX_CCR(r21) /* save CR in exc. frame */
/* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */ /* (((ea >> 28) & 0x1fff) << 15) | (ea >> 60) */
mfspr r21,DAR mfspr r21,DAR
...@@ -1033,7 +1038,7 @@ SLB_NUM_ENTRIES = 64 ...@@ -1033,7 +1038,7 @@ SLB_NUM_ENTRIES = 64
mfsprg r20,3 /* Load the PACA pointer */ mfsprg r20,3 /* Load the PACA pointer */
ld r21,PACAEXCSP(r20) /* Get the exception frame pointer */ ld r21,PACAEXCSP(r20) /* Get the exception frame pointer */
addi r21,r21,EXC_FRAME_SIZE addi r21,r21,EXC_FRAME_SIZE
ld r23,EX_DAR(r21) /* get saved CR */ lwz r23,EX_CCR(r21) /* get saved CR */
/* note that this is almost identical to maskable_exception_exit */ /* note that this is almost identical to maskable_exception_exit */
mtcr r23 /* restore CR */ mtcr r23 /* restore CR */
ld r22,EX_SRR0(r21) /* Get SRR0 from exc. frame */ ld r22,EX_SRR0(r21) /* Get SRR0 from exc. frame */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment