Encapsulated FPU restore instructions.
There is a new procedure restore_fpu_state() in arch/x86/include/asm/tasks_types. Will need this code in lguest, too.
This commit is contained in:
parent
3ff984a21c
commit
7fdb044e9a
2 changed files with 8 additions and 5 deletions
|
@ -68,6 +68,13 @@ static inline void save_fpu_state(union fpu_state* state) {
|
|||
asm volatile ("fsave %0; fwait" : "=m"((*state).fsave));
|
||||
}
|
||||
|
||||
static inline void restore_fpu_state(union fpu_state* state) {
|
||||
if (has_fxsr())
|
||||
asm volatile ("fxrstor %0" :: "m"(state->fxsave));
|
||||
else
|
||||
asm volatile ("frstor %0" :: "m"(state->fsave));
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -196,11 +196,7 @@ static void fpu_handler(struct state *s)
|
|||
task->flags |= TASK_FPU_INIT;
|
||||
}
|
||||
|
||||
// restore the FPU context
|
||||
if (has_fxsr())
|
||||
asm volatile ("fxrstor %0" :: "m"(task->fpu.fxsave));
|
||||
else
|
||||
asm volatile ("frstor %0" :: "m"(task->fpu.fsave));
|
||||
restore_fpu_state(&task->fpu);
|
||||
task->flags |= TASK_FPU_USED;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue