summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2003-07-27 23:45:48 +0000
committermarcel <marcel@FreeBSD.org>2003-07-27 23:45:48 +0000
commit442f943b5f19cad84d536402dda45728d865b70f (patch)
tree2b6422df5fabb1497a0a5066d4dae2c3ac1779c9 /sys
parent77428ed1a0e9bb2a0f37953186c743a7e53e805a (diff)
downloadFreeBSD-src-442f943b5f19cad84d536402dda45728d865b70f.zip
FreeBSD-src-442f943b5f19cad84d536402dda45728d865b70f.tar.gz
Reset the per-CPU unique value at boot and clear it in the PCB of the
child when forking. This provides a consistent initial state. Note that cpu_set_upcall() does not clear the per-CPU unique value as it is followed by a call to set_mcontext(), which sets it accordingly.
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/machdep.c8
-rw-r--r--sys/alpha/alpha/mp_machdep.c3
-rw-r--r--sys/alpha/alpha/vm_machdep.c1
3 files changed, 9 insertions, 3 deletions
diff --git a/sys/alpha/alpha/machdep.c b/sys/alpha/alpha/machdep.c
index ba40437..64148f9 100644
--- a/sys/alpha/alpha/machdep.c
+++ b/sys/alpha/alpha/machdep.c
@@ -548,6 +548,9 @@ alpha_init(pfn, ptb, bim, bip, biv)
alpha_pal_wrmces(alpha_pal_rdmces() &
~(ALPHA_MCES_DSC|ALPHA_MCES_DPC));
+ /* Clear userland thread pointer */
+ alpha_pal_wrunique(0);
+
/*
* Find out what hardware we're on, and do basic initialization.
*/
@@ -2028,7 +2031,7 @@ get_mcontext(struct thread *td, mcontext_t *mcp, int clear_ret)
mcp->mc_regs[FRAME_SP] = alpha_pal_rdusp();
mcp->mc_thrptr = alpha_pal_rdunique();
} else
- mcp->mc_thrptr = td->td_pcb->pcb_hw.apcb_unique;
+ mcp->mc_thrptr = 0;
mcp->mc_format = _MC_REV0_TRAPFRAME;
PROC_LOCK(curthread->td_proc);
@@ -2069,8 +2072,7 @@ set_mcontext(struct thread *td, const mcontext_t *mcp)
if (td == curthread) {
alpha_pal_wrusp(mcp->mc_regs[FRAME_SP]);
alpha_pal_wrunique(mcp->mc_thrptr);
- } else
- td->td_pcb->pcb_hw.apcb_unique = mcp->mc_thrptr;
+ }
/*
* The context is a trapframe, so just copy it over the
diff --git a/sys/alpha/alpha/mp_machdep.c b/sys/alpha/alpha/mp_machdep.c
index 609fa85..f37d0f1 100644
--- a/sys/alpha/alpha/mp_machdep.c
+++ b/sys/alpha/alpha/mp_machdep.c
@@ -137,6 +137,9 @@ smp_init_secondary(void)
*/
alpha_pal_wrval((u_int64_t) pcpup);
+ /* Clear userland thread pointer. */
+ alpha_pal_wrunique(0);
+
/*
* Point interrupt/exception vectors to our own.
*/
diff --git a/sys/alpha/alpha/vm_machdep.c b/sys/alpha/alpha/vm_machdep.c
index 3df1388..b0ed146 100644
--- a/sys/alpha/alpha/vm_machdep.c
+++ b/sys/alpha/alpha/vm_machdep.c
@@ -145,6 +145,7 @@ cpu_fork(td1, p2, td2, flags)
*/
bcopy(td1->td_pcb, td2->td_pcb, sizeof(struct pcb));
td2->td_pcb->pcb_hw.apcb_usp = alpha_pal_rdusp();
+ td2->td_pcb->pcb_hw.apcb_unique = 0;
td2->td_pcb->pcb_hw.apcb_flags &= ~ALPHA_PCB_FLAGS_FEN;
/*
OpenPOWER on IntegriCloud