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.
This commit is contained in:
Marcel Moolenaar 2003-07-27 23:45:48 +00:00
parent cdedf48666
commit de22416ef6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=118101
3 changed files with 9 additions and 3 deletions

View file

@ -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

View file

@ -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.
*/

View file

@ -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;
/*