summaryrefslogtreecommitdiffstats
path: root/pk/ppe42/ppe42_exceptions.S
diff options
context:
space:
mode:
Diffstat (limited to 'pk/ppe42/ppe42_exceptions.S')
-rw-r--r--pk/ppe42/ppe42_exceptions.S32
1 files changed, 18 insertions, 14 deletions
diff --git a/pk/ppe42/ppe42_exceptions.S b/pk/ppe42/ppe42_exceptions.S
index 272c0e41..f8f68d99 100644
--- a/pk/ppe42/ppe42_exceptions.S
+++ b/pk/ppe42/ppe42_exceptions.S
@@ -201,21 +201,8 @@ dec_handler:
b check_for_ext_interrupt
program_exception_handler:
- ## first check if exception was caused by an illegal 'sc' instruction
- mfspr %r3, SPRN_EDR
- _liw %r4, PPE42_SC_INST
- cmpwbeq %r3, %r4, __sc_helper
_pk_panic PPE42_ILLEGAL_INSTRUCTION
- ## Saved SRR0 is currently pointing to the 'sc' instruction. We need to advance it
- ## to the next instruction so that we don't end up in an endless loop (something
- ## that the ppc sc instruction does automatically).
-__sc_helper:
- mfsrr0 %r4
- _lwzsd %r3, __pk_saved_sp
- addi %r4, %r4, 4
- stw %r4, PK_CTX_SRR0(%r3)
-
.global __pk_next_thread_resume
__pk_next_thread_resume:
@@ -305,6 +292,23 @@ ctx_discard:
## (r3, r4, lr, and cr have already been saved for us) and
## r3 contains the interrupted kernel context
+ .global __ctx_switch
+__ctx_switch:
+ stwu %r1, -PK_CTX_SIZE(%r1)
+ stvd %d3, PK_CTX_GPR3(%r1)
+ mfcr %r3
+ mflr %r4
+ stvd %d3, PK_CTX_CR(%r1)
+ _liw %r3 __pk_next_thread_resume
+ mtlr %r3
+ ## emulate what interrupt would do
+ mtsrr0 %r4
+ mfmsr %r3
+ mtsrr1 %r3
+
+ ## ctx_continue_push expects r3 to be value of sprg0
+ mfsprg0 %r3
+
ctx_continue_push:
stvd %d5, PK_CTX_GPR5(%r1)
@@ -488,7 +492,7 @@ ctx_pop:
lvd %d5, PK_CTX_GPR5(%r1)
lvd %d3, PK_CTX_CR(%r1)
mtlr %r4
- mtcr %r3
+ mtcr0 %r3
lvd %d3, PK_CTX_GPR3(%r1)
addi %r1, %r1, PK_CTX_SIZE
OpenPOWER on IntegriCloud