/*
* Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License"). You may not use this file except in compliance with the
- * License. Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
*
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ *
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
* EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
* INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
*
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
*/
/*
* @OSF_COPYRIGHT@
thread = current_thread();
- toss_live_fpu(thread->machine.curctx); /* Toss my floating point if live anywhere */
- toss_live_vec(thread->machine.curctx); /* Toss my vector if live anywhere */
+ act_machine_sv_free(thread); /* Blow away any current kernel FP or vector.
+ We do not support those across a vfork */
+ toss_live_fpu(thread->machine.curctx); /* Toss my floating point if live anywhere */
+ toss_live_vec(thread->machine.curctx); /* Toss my vector if live anywhere */
sv->save_hdr.save_misc2 = 0; /* Eye catcher for debug */
sv->save_hdr.save_misc3 = 0; /* Eye catcher for debug */
sv->save_hdr.save_act = thread;
- spc = (unsigned int)thread->map->pmap->space; /* Get the space we're in */
+ spc = (unsigned int)thread->map->pmap->space; /* Get the space we're in */
- osv = thread->machine.pcb; /* Get the top general savearea */
+ osv = thread->machine.pcb; /* Get the top general savearea */
psv = 0;
while(osv) { /* Any saved state? */
if(osv->save_srr1 & MASK(MSR_PR)) break; /* Leave if this is user state */
if(ovsv) { /* Did we find one? */
if(pvsv) pvsv->save_hdr.save_prev = 0; /* Yes, clear pointer to it (it should always be last) or */
- else thread->machine.curctx->VMXsave = 0; /* to the start if the only one */
+ else thread->machine.curctx->VMXsave = 0; /* to the start if the only one */
save_release((savearea *)ovsv); /* Nope, release it */
}
if(vsv) { /* Are we sticking any vector on this one? */
if(pvsv) pvsv->save_hdr.save_prev = (addr64_t)((uintptr_t)vsv); /* Yes, chain us to the end or */
- else thread->machine.curctx->VMXsave = vsv; /* to the start if the only one */
+ else {
+ thread->machine.curctx->VMXsave = vsv; /* to the start if the only one */
+ thread->machine.curctx->VMXlevel = 0; /* Insure that we don't have a leftover level */
+ }
vsv->save_hdr.save_misc2 = 0; /* Eye catcher for debug */
vsv->save_hdr.save_misc3 = 0; /* Eye catcher for debug */
vsv->save_hdr.save_act = thread;
}
- ofsv = thread->machine.curctx->FPUsave; /* Get the top float savearea */
+ ofsv = thread->machine.curctx->FPUsave; /* Get the top float savearea */
pfsv = 0;
while(ofsv) { /* Any float saved state? */
if(ofsv) { /* Did we find one? */
if(pfsv) pfsv->save_hdr.save_prev = 0; /* Yes, clear pointer to it (it should always be last) or */
- else thread->machine.curctx->FPUsave = 0; /* to the start if the only one */
+ else thread->machine.curctx->FPUsave = 0; /* to the start if the only one */
save_release((savearea *)ofsv); /* Nope, release it */
}
if(fsv) { /* Are we sticking any vector on this one? */
if(pfsv) pfsv->save_hdr.save_prev = (addr64_t)((uintptr_t)fsv); /* Yes, chain us to the end or */
- else thread->machine.curctx->FPUsave = fsv; /* to the start if the only one */
+ else {
+ thread->machine.curctx->FPUsave = fsv; /* to the start if the only one */
+ thread->machine.curctx->FPUlevel = 0; /* Insure that we don't have a leftover level */
+ }
fsv->save_hdr.save_misc2 = 0; /* Eye catcher for debug */
fsv->save_hdr.save_misc3 = 0; /* Eye catcher for debug */