- /*
- * free VMX and FPU saveareas. do not free user save areas.
- * user VMX and FPU saveareas, if any, i'm told are last in
- * the chain so we just stop if we find them
- * we identify user VMX and FPU saveareas when we find a pcb
- * with a save level of 0. we identify user regular save
- * areas when we find one with MSR_PR set
- */
-
- pcb = act->mact.VMX_pcb; /* Get the top vector savearea */
- while(pcb) { /* Any VMX saved state? */
- svp = (savearea *)pcb; /* save lots of casting later */
- if (svp->save_level_vec == 0) break; /* done when hit user if any */
- pcb = (pcb_t)svp->save_prev_vector; /* Get one underneath our's */
- svp->save_flags &= ~SAVvmxvalid; /* Clear the VMX flag */
- if(!(svp->save_flags & SAVinuse)) { /* Anyone left with this one? */
-
- save_ret(svp); /* release it */
- }
- }
- act->mact.VMX_pcb = pcb;
- if (act->mact.VMX_lvl != 0) {
- for(i=0; i < real_ncpus; i++) { /* Cycle through processors */
- (void)hw_compare_and_store((unsigned int)act, 0, &per_proc_info[i].VMX_thread); /* Clear if ours */
- }
- }
-
- pcb = act->mact.FPU_pcb; /* Get the top floating point savearea */
- while(pcb) { /* Any floating point saved state? */
- svp = (savearea *)pcb;
- if (svp->save_level_fp == 0) break; /* done when hit user if any */
- pcb = (pcb_t)svp->save_prev_float; /* Get one underneath our's */
- svp->save_flags &= ~SAVfpuvalid; /* Clear the floating point flag */
- if(!(svp->save_flags & SAVinuse)) { /* Anyone left with this one? */
- save_ret(svp); /* Nope, release it */
- }
- }
- act->mact.FPU_pcb = pcb;
- if (act->mact.FPU_lvl != 0) {
- for(i=0; i < real_ncpus; i++) { /* Cycle through processors */
- (void)hw_compare_and_store((unsigned int)act, 0, &per_proc_info[i].FPU_thread); /* Clear if ours */
- }
- }
-
- /*
- * free all regular saveareas except a user savearea, if any
- */
-
- pcb = act->mact.pcb;
- userpcb = (pcb_t)0;
- while(pcb) {
- svp = (savearea *)pcb;
- if ((svp->save_srr1 & MASK(MSR_PR))) {
- assert(userpcb == (pcb_t)0);
- userpcb = pcb;
- svp = (savearea *)userpcb;
- npcb = (pcb_t)svp->save_prev;
- svp->save_prev = (struct savearea *)0;
- } else {
- svp->save_flags &= ~SAVattach; /* Clear the attached flag */
- npcb = (pcb_t)svp->save_prev;
- if(!(svp->save_flags & SAVinuse)) /* Anyone left with this one? */
- save_ret(svp);
- }
- pcb = npcb;
- }
- act->mact.pcb = userpcb;
-
-}
-
-