From 92e814dcb6cbad14823629d2ee7e05f2956654f2 Mon Sep 17 00:00:00 2001 From: Doug Rabson Date: Thu, 14 Mar 2002 19:33:03 +0000 Subject: [PATCH] * Save and restore PCPU_GET(current_pmap) in pcb_pmap so that we don't lose if a process is preempted while pmap is temporarily switched to another pmap. * For SMP, drop the high-fp state when a thread is switched away from so that if another cpu resumes that thread, it doesn't have to play games with IPI to get ahold of the correct register values. --- sys/ia64/ia64/swtch.s | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/sys/ia64/ia64/swtch.s b/sys/ia64/ia64/swtch.s index 47a3545f8c5c..33a37c7242ba 100644 --- a/sys/ia64/ia64/swtch.s +++ b/sys/ia64/ia64/swtch.s @@ -164,8 +164,11 @@ ENTRY(cpu_switch, 0) st8 [r17]=r2,8 ;; // ar.pfs st8 [r17]=r18,8 ;; // ar.bspstore st8 [r17]=r19,8 ;; // our NaT bits + add r3=PC_CURRENT_PMAP,r13 st8 [r17]=r16,8 ;; // ar.rnat - st8 [r17]=r20 ;; // pr + ld8 r3=[r3] + st8 [r17]=r20,8 ;; // pr + st8 [r17]=r3 // current pmap mov ar.rsc=3 // turn RSE back on @@ -196,21 +199,30 @@ ENTRY(cpu_switch, 0) br.call.sptk.few rp=choosethread 3: - add r14=PC_CURTHREAD,r13 ;; - - st8 [r14]=ret0 // set r13->pc_curthread - mov ar.k7=ret0 + alloc r15=ar.pfs,0,0,2,0 // create temporary output frame mov r4=ret0 // save from call - ;; - alloc r15=ar.pfs,0,0,1,0 // create temporary output frame #ifdef SMP ;; - mov out0=1 // clear fpcurthread - br.call.sptk.few rp=ia64_fpstate_save -#endif + add r14=PC_CURTHREAD,r13 ;; - mov out0=r4 - br.call.sptk.few rp=pmap_activate // install RIDs etc. + ld8 out0=[r14] + mov out1=1 + br.call.sptk.few rp=ia64_fpstate_save // clear fpcurthread +#endif + ;; + add r14=PC_CURTHREAD,r13 ;; + + st8 [r14]=r4 // set r13->pc_curthread + mov ar.k7=r4 + ;; + add r15=TD_PCB,r4 + ;; + ld8 r15=[r15] + ;; + add r15=PCB_PMAP,r15 // &pcb_pmap + ;; + ld8 out0=[r15] + br.call.sptk.few rp=pmap_install // install RIDs etc. add r15=TD_PCB,r4 add r16=TD_KSTACK,r4 ;;