/*
- * Copyright (c) 2000-2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (c) 2000-2010 Apple Inc. All rights reserved.
*
* @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
#include <mach/exception_types.h>
#include <mach/i386/thread_status.h>
#include <mach/i386/fp_reg.h>
+#include <mach/branch_predicates.h>
#include <kern/mach_param.h>
#include <kern/processor.h>
struct x86_fx_thread_state *ifps;
assert(ml_get_interrupts_enabled() == FALSE);
- ifps = (thread)->machine.pcb->ifps;
+ ifps = (thread)->machine.ifps;
#if DEBUG
if (ifps && ((ifps->fp_valid != FALSE) && (ifps->fp_valid != TRUE))) {
panic("ifps->fp_valid: %u\n", ifps->fp_valid);
*/
clear_ts();
/* registers are in FPU - save to memory */
- fpu_store_registers(ifps, (thread_is_64bit(thread) && is_saved_state64(thread->machine.pcb->iss)));
+ fpu_store_registers(ifps, (thread_is_64bit(thread) && is_saved_state64(thread->machine.iss)));
ifps->fp_valid = TRUE;
}
set_ts();
state = (x86_float_state64_t *)tstate;
assert(thr_act != THREAD_NULL);
- pcb = thr_act->machine.pcb;
+ pcb = THREAD_TO_PCB(thr_act);
if (state == NULL) {
/*
state = (x86_float_state64_t *)tstate;
assert(thr_act != THREAD_NULL);
- pcb = thr_act->machine.pcb;
+ pcb = THREAD_TO_PCB(thr_act);
simple_lock(&pcb->lock);
boolean_t intr;
pcb_t ppcb;
- ppcb = parent->machine.pcb;
+ ppcb = THREAD_TO_PCB(parent);
if (ppcb->ifps == NULL)
return;
- if (child->machine.pcb->ifps)
+ if (child->machine.ifps)
panic("fpu_dup_fxstate: child's ifps non-null");
new_ifps = fp_state_alloc();
(void)ml_set_interrupts_enabled(intr);
if (ifps->fp_valid) {
- child->machine.pcb->ifps = new_ifps;
+ child->machine.ifps = new_ifps;
assert((fp_register_state_size == sizeof(struct x86_fx_thread_state)) ||
(fp_register_state_size == sizeof(struct x86_avx_thread_state)));
bcopy((char *)(ppcb->ifps),
- (char *)(child->machine.pcb->ifps), fp_register_state_size);
+ (char *)(child->machine.ifps), fp_register_state_size);
/* Mark the new fp saved state as non-live. */
/* Temporarily disabled: radar 4647827
struct x86_fx_thread_state *ifps = 0;
thr_act = current_thread();
- pcb = thr_act->machine.pcb;
+ pcb = THREAD_TO_PCB(thr_act);
assert(fp_register_state_size != 0);
clear_ts(); /* Enable FPU use */
- if (get_interrupt_level()) {
+ if (__improbable(get_interrupt_level())) {
/*
* Save current coprocessor context if valid
* Initialize coprocessor live context
* This is a non-recoverable error.
* Invalidate the thread`s FPU state.
*/
- pcb = thr_act->machine.pcb;
+ pcb = THREAD_TO_PCB(thr_act);
simple_lock(&pcb->lock);
ifps = pcb->ifps;
pcb->ifps = 0;
fpexterrflt(void)
{
thread_t thr_act = current_thread();
- struct x86_fx_thread_state *ifps = thr_act->machine.pcb->ifps;
+ struct x86_fx_thread_state *ifps = thr_act->machine.ifps;
boolean_t intr;
intr = ml_set_interrupts_enabled(FALSE);
fp_save(
thread_t thr_act)
{
- pcb_t pcb = thr_act->machine.pcb;
+ pcb_t pcb = THREAD_TO_PCB(thr_act);
struct x86_fx_thread_state *ifps = pcb->ifps;
assert(ifps != 0);
fp_load(
thread_t thr_act)
{
- pcb_t pcb = thr_act->machine.pcb;
+ pcb_t pcb = THREAD_TO_PCB(thr_act);
struct x86_fx_thread_state *ifps = pcb->ifps;
assert(ifps);
fpSSEexterrflt(void)
{
thread_t thr_act = current_thread();
- struct x86_fx_thread_state *ifps = thr_act->machine.pcb->ifps;
+ struct x86_fx_thread_state *ifps = thr_act->machine.ifps;
boolean_t intr;
intr = ml_set_interrupts_enabled(FALSE);
void
fp_setvalid(boolean_t value) {
thread_t thr_act = current_thread();
- struct x86_fx_thread_state *ifps = thr_act->machine.pcb->ifps;
+ struct x86_fx_thread_state *ifps = thr_act->machine.ifps;
if (ifps) {
ifps->fp_valid = value;
}
}
-boolean_t
+__private_extern__ boolean_t
ml_fpu_avx_enabled(void) {
return (fpu_YMM_present == TRUE);
}