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
This commit is contained in:
parent
c3675872ba
commit
0ef7fc1c4a
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
@ -42,6 +42,7 @@ struct pcb {
|
||||
register_t pcb_cr; /* Condition register */
|
||||
register_t pcb_sp; /* stack pointer */
|
||||
register_t pcb_lr; /* link register */
|
||||
register_t pcb_usr; /* USER_SR segment register */
|
||||
struct pmap *pcb_pm; /* pmap of our vmspace */
|
||||
struct pmap *pcb_pmreal; /* real address of above */
|
||||
faultbuf *pcb_onfault; /* For use during
|
||||
|
@ -134,6 +134,7 @@ ASSYM(PCB_CR, offsetof(struct pcb, pcb_cr));
|
||||
ASSYM(PCB_PMR, offsetof(struct pcb, pcb_pmreal));
|
||||
ASSYM(PCB_SP, offsetof(struct pcb, pcb_sp));
|
||||
ASSYM(PCB_LR, offsetof(struct pcb, pcb_lr));
|
||||
ASSYM(PCB_USR, offsetof(struct pcb, pcb_usr));
|
||||
ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault));
|
||||
ASSYM(PCB_FLAGS, offsetof(struct pcb, pcb_flags));
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user