summaryrefslogtreecommitdiffstats
path: root/sys/powerpc/aim
diff options
context:
space:
mode:
authorgrehan <grehan@FreeBSD.org>2002-10-21 05:27:41 +0000
committergrehan <grehan@FreeBSD.org>2002-10-21 05:27:41 +0000
commit0ef7fc1c4a36a733fbf9852e4f971a058997ae11 (patch)
tree156f761baa36237a5a5a2bba3417cf0fd11a1fa2 /sys/powerpc/aim
parentc3675872ba169579604baac393492ee7b66bc8bb (diff)
downloadFreeBSD-src-0ef7fc1c4a36a733fbf9852e4f971a058997ae11.zip
FreeBSD-src-0ef7fc1c4a36a733fbf9852e4f971a058997ae11.tar.gz
Add the USER_SR segment register to pcb state. Initialize correctly,
and save/restore during a context switch. The USER_SR could be overwritten when the current thread was switched out with a faulting copyin/copyout. Approved by: Benno
Diffstat (limited to 'sys/powerpc/aim')
-rw-r--r--sys/powerpc/aim/swtch.S6
-rw-r--r--sys/powerpc/aim/vm_machdep.c1
2 files changed, 7 insertions, 0 deletions
diff --git a/sys/powerpc/aim/swtch.S b/sys/powerpc/aim/swtch.S
index e02367a..188d5cf 100644
--- a/sys/powerpc/aim/swtch.S
+++ b/sys/powerpc/aim/swtch.S
@@ -83,6 +83,9 @@ ENTRY(cpu_switch)
stw %r16,PCB_CR(%r3)
mflr %r16 /* Save the link register */
stw %r16,PCB_LR(%r3)
+ mfsr %r16,USER_SR /* Save USER_SR for copyin/out */
+ isync
+ stw %r16,PCB_USR(%r3)
stw %r1,PCB_SP(%r3) /* Save the stack pointer */
#if 0
@@ -128,6 +131,9 @@ ENTRY(cpu_switch)
mtcr %r5
lwz %r5,PCB_LR(%r3) /* Load the link register */
mtlr %r5
+ lwz %r5,PCB_USR(%r3) /* Load the USER_SR segment reg */
+ mtsr USER_SR,%r5
+ isync
lwz %r1,PCB_SP(%r3) /* Load the stack pointer */
blr
diff --git a/sys/powerpc/aim/vm_machdep.c b/sys/powerpc/aim/vm_machdep.c
index 5d4f6eb..284a031 100644
--- a/sys/powerpc/aim/vm_machdep.c
+++ b/sys/powerpc/aim/vm_machdep.c
@@ -166,6 +166,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct thread *td2, int flags)
pcb->pcb_sp = (register_t)cf;
pcb->pcb_lr = (register_t)fork_trampoline;
+ pcb->pcb_usr = kernel_pmap->pm_sr[USER_SR];
/*
* Now cpu_switch() can schedule the new process.
OpenPOWER on IntegriCloud