Changeset View
Changeset View
Standalone View
Standalone View
powerpc/aim/trap_subr64.S
Context not available. | |||||
insrdi %r9,%r8,1,0 | insrdi %r9,%r8,1,0 | ||||
mtmsrd %r9 | mtmsrd %r9 | ||||
isync | isync | ||||
bl 1f | |||||
ba cpu_reset | .llong cpu_reset | ||||
1: mflr %r9 | |||||
ld %r9,0(%r9) | |||||
mtlr %r9 | |||||
blr | |||||
CNAME(rstsize) = . - CNAME(rstcode) | CNAME(rstsize) = . - CNAME(rstcode) | ||||
cpu_reset: | cpu_reset: | ||||
Context not available. | |||||
/* | /* | ||||
* This code gets copied to all the trap vectors | * This code gets copied to all the trap vectors | ||||
* (except ISI/DSI, ALI, and the interrupts) | * (except ISI/DSI, ALI, and the interrupts). Has to fit in 8 instructions! | ||||
*/ | */ | ||||
.globl CNAME(trapcode),CNAME(trapsize) | .globl CNAME(trapcode),CNAME(trapsize) | ||||
.p2align 3 | |||||
CNAME(trapcode): | CNAME(trapcode): | ||||
mtsprg1 %r1 /* save SP */ | mtsprg1 %r1 /* save SP */ | ||||
mflr %r1 /* Save the old LR in r1 */ | mflr %r1 /* Save the old LR in r1 */ | ||||
mtsprg2 %r1 /* And then in SPRG2 */ | mtsprg2 %r1 /* And then in SPRG2 */ | ||||
li %r1,TRAP_GENTRAP | |||||
ld %r1,0(%r1) | |||||
mtlr %r1 | |||||
li %r1, 0xA0 /* How to get the vector from LR */ | li %r1, 0xA0 /* How to get the vector from LR */ | ||||
bla generictrap /* LR & SPRG3 is exception # */ | blrl /* Branch to generictrap */ | ||||
CNAME(trapsize) = .-CNAME(trapcode) | CNAME(trapsize) = .-CNAME(trapcode) | ||||
/* | /* | ||||
Context not available. | |||||
* the only time this can be called. | * the only time this can be called. | ||||
*/ | */ | ||||
.globl CNAME(slbtrap),CNAME(slbtrapsize) | .globl CNAME(slbtrap),CNAME(slbtrapsize) | ||||
.p2align 3 | |||||
CNAME(slbtrap): | CNAME(slbtrap): | ||||
mtsprg1 %r1 /* save SP */ | mtsprg1 %r1 /* save SP */ | ||||
GET_CPUINFO(%r1) | GET_CPUINFO(%r1) | ||||
Context not available. | |||||
std %r2,(PC_SLBSAVE+104)(%r1) | std %r2,(PC_SLBSAVE+104)(%r1) | ||||
mfsrr1 %r2 /* test kernel mode */ | mfsrr1 %r2 /* test kernel mode */ | ||||
mtcr %r2 | mtcr %r2 | ||||
bf 17,1f /* branch if PSL_PR is false */ | bf 17,2f /* branch if PSL_PR is false */ | ||||
/* User mode */ | /* User mode */ | ||||
ld %r2,(PC_SLBSAVE+104)(%r1) /* Restore CR */ | ld %r2,(PC_SLBSAVE+104)(%r1) /* Restore CR */ | ||||
mtcr %r2 | mtcr %r2 | ||||
Context not available. | |||||
ld %r2,(PC_SLBSAVE+16)(%r1) /* Restore R2 */ | ld %r2,(PC_SLBSAVE+16)(%r1) /* Restore R2 */ | ||||
mflr %r1 /* Save the old LR in r1 */ | mflr %r1 /* Save the old LR in r1 */ | ||||
mtsprg2 %r1 /* And then in SPRG2 */ | mtsprg2 %r1 /* And then in SPRG2 */ | ||||
/* 52 bytes so far */ | |||||
bl 1f | |||||
.llong generictrap | |||||
1: mflr %r1 | |||||
ld %r1,0(%r1) | |||||
mtlr %r1 | |||||
li %r1, 0x80 /* How to get the vector from LR */ | li %r1, 0x80 /* How to get the vector from LR */ | ||||
bla generictrap /* LR & SPRG3 is exception # */ | blrl /* Branch to generictrap */ | ||||
1: mflr %r2 /* Save the old LR in r2 */ | /* 84 bytes */ | ||||
bla kern_slbtrap | 2: mflr %r2 /* Save the old LR in r2 */ | ||||
nop | |||||
bl 3f /* Begin dance to jump to kern_slbtrap*/ | |||||
.llong kern_slbtrap | |||||
3: mflr %r1 | |||||
ld %r1,0(%r1) | |||||
mtlr %r1 | |||||
GET_CPUINFO(%r1) | |||||
blrl /* 124 bytes -- 4 to spare */ | |||||
CNAME(slbtrapsize) = .-CNAME(slbtrap) | CNAME(slbtrapsize) = .-CNAME(slbtrap) | ||||
kern_slbtrap: | kern_slbtrap: | ||||
Context not available. | |||||
mflr %r28 /* save LR */ | mflr %r28 /* save LR */ | ||||
mfcr %r29 /* save CR */ | mfcr %r29 /* save CR */ | ||||
/* Begin dance to branch to s_trap in a bit */ | |||||
b 1f | |||||
.p2align 3 | |||||
1: nop | |||||
bl 1f | |||||
.llong s_trap | |||||
1: mflr %r31 | |||||
ld %r31,0(%r31) | |||||
mtlr %r31 | |||||
/* Put our exception vector in SPRG3 */ | /* Put our exception vector in SPRG3 */ | ||||
li %r31, EXC_ALI | li %r31, EXC_ALI | ||||
mtsprg3 %r31 | mtsprg3 %r31 | ||||
Context not available. | |||||
/* Test whether we already had PR set */ | /* Test whether we already had PR set */ | ||||
mfsrr1 %r31 | mfsrr1 %r31 | ||||
mtcr %r31 | mtcr %r31 | ||||
bla s_trap | blrl | ||||
CNAME(alisize) = .-CNAME(alitrap) | CNAME(alisize) = .-CNAME(alitrap) | ||||
/* | /* | ||||
* Similar to the above for DSI | * Similar to the above for DSI | ||||
* Has to handle BAT spills | * Has to handle standard pagetable spills | ||||
* and standard pagetable spills | |||||
*/ | */ | ||||
.globl CNAME(dsitrap),CNAME(dsisize) | .globl CNAME(dsitrap),CNAME(dsisize) | ||||
CNAME(dsitrap): | CNAME(dsitrap): | ||||
Context not available. | |||||
std %r29,(PC_DISISAVE+CPUSAVE_R29)(%r1) | std %r29,(PC_DISISAVE+CPUSAVE_R29)(%r1) | ||||
std %r30,(PC_DISISAVE+CPUSAVE_R30)(%r1) | std %r30,(PC_DISISAVE+CPUSAVE_R30)(%r1) | ||||
std %r31,(PC_DISISAVE+CPUSAVE_R31)(%r1) | std %r31,(PC_DISISAVE+CPUSAVE_R31)(%r1) | ||||
mfsprg1 %r1 /* restore SP */ | |||||
mfcr %r29 /* save CR */ | mfcr %r29 /* save CR */ | ||||
mfxer %r30 /* save XER */ | mfxer %r30 /* save XER */ | ||||
mtsprg2 %r30 /* in SPRG2 */ | mtsprg2 %r30 /* in SPRG2 */ | ||||
Context not available. | |||||
mfsrr1 %r31 /* test kernel mode */ | mfsrr1 %r31 /* test kernel mode */ | ||||
mtcr %r31 | mtcr %r31 | ||||
mflr %r28 /* save LR (SP already saved) */ | mflr %r28 /* save LR (SP already saved) */ | ||||
bla disitrap | bl 1f /* Begin branching to disitrap */ | ||||
.llong disitrap | |||||
1: mflr %r1 | |||||
ld %r1,0(%r1) | |||||
mtlr %r1 | |||||
blrl /* Branch to generictrap */ | |||||
CNAME(dsisize) = .-CNAME(dsitrap) | CNAME(dsisize) = .-CNAME(dsitrap) | ||||
/* | /* | ||||
Context not available. | |||||
bl restore_kernsrs /* enable kernel mapping */ | bl restore_kernsrs /* enable kernel mapping */ | ||||
mfsprg2 %r29 | mfsprg2 %r29 | ||||
mr %r28,%r27 | mr %r28,%r27 | ||||
ba s_trap | b s_trap | ||||
/* | /* | ||||
* generictrap does some standard setup for trap handling to minimize | * generictrap does some standard setup for trap handling to minimize | ||||
Context not available. | |||||
* SPRG2 - Original LR | * SPRG2 - Original LR | ||||
*/ | */ | ||||
.globl CNAME(trapcode2) | |||||
trapcode2: | |||||
generictrap: | generictrap: | ||||
/* Save R1 for computing the exception vector */ | /* Save R1 for computing the exception vector */ | ||||
mtsprg3 %r1 | mtsprg3 %r1 | ||||
Context not available. | |||||
mfsprg3 %r31 | mfsprg3 %r31 | ||||
ori %r31,%r31,0xff00 | ori %r31,%r31,0xff00 | ||||
mflr %r30 | mflr %r30 | ||||
addi %r30,%r30,-4 /* The branch instruction, not the next */ | |||||
and %r30,%r30,%r31 | and %r30,%r30,%r31 | ||||
mtsprg3 %r30 | mtsprg3 %r30 | ||||
Context not available. | |||||
mfsprg2 %r29 /* ... and r29 */ | mfsprg2 %r29 /* ... and r29 */ | ||||
mflr %r1 /* save LR */ | mflr %r1 /* save LR */ | ||||
mtsprg2 %r1 /* And then in SPRG2 */ | mtsprg2 %r1 /* And then in SPRG2 */ | ||||
nop /* Begin branching to generictrap */ | |||||
bl 9f | |||||
.llong generictrap | |||||
9: mflr %r1 | |||||
ld %r1,0(%r1) | |||||
mtlr %r1 | |||||
li %r1, 0 /* How to get the vector from LR */ | li %r1, 0 /* How to get the vector from LR */ | ||||
blrl /* Branch to generictrap */ | |||||
bla generictrap /* and we look like a generic trap */ | |||||
1: | 1: | ||||
GET_CPUINFO(%r1) | GET_CPUINFO(%r1) | ||||
std %r27,(PC_DBSAVE+CPUSAVE_R27)(%r1) /* free r27 */ | std %r27,(PC_DBSAVE+CPUSAVE_R27)(%r1) /* free r27 */ | ||||
Context not available. | |||||
std %r30,(PC_DBSAVE+CPUSAVE_R30)(%r1) /* free r30 */ | std %r30,(PC_DBSAVE+CPUSAVE_R30)(%r1) /* free r30 */ | ||||
std %r31,(PC_DBSAVE+CPUSAVE_R31)(%r1) /* free r31 */ | std %r31,(PC_DBSAVE+CPUSAVE_R31)(%r1) /* free r31 */ | ||||
mflr %r28 /* save LR */ | mflr %r28 /* save LR */ | ||||
bla dbtrap | bl 9f /* Begin branch */ | ||||
.llong dbtrap | |||||
9: mflr %r1 | |||||
ld %r1,0(%r1) | |||||
mtlr %r1 | |||||
blrl /* Branch to generictrap */ | |||||
CNAME(dbsize) = .-CNAME(dblow) | CNAME(dbsize) = .-CNAME(dblow) | ||||
#endif /* KDB */ | #endif /* KDB */ | ||||
Context not available. |