Enable saving/restoring XMMs so that Clang works

This commit is contained in:
Ali Mashtizadeh 2015-02-24 16:57:30 -08:00
parent ce7e8ec194
commit a357b2f034
3 changed files with 10 additions and 1 deletions

View File

@ -369,6 +369,11 @@ static INLINE void write_gs(uint16_t val)
* Floating Point
*/
static INLINE void clts()
{
asm volatile("clts");
}
static INLINE void fxsave(struct XSAVEArea *xsa)
{
asm volatile("fxsave %0"

View File

@ -139,6 +139,7 @@ void Machine_Init()
Machine_TSSInit();
Trap_Init();
Machine_SyscallInit();
clts(); // Enable FPU/XMM
PAlloc_AddRegion(DMPA2VA(16*1024*1024), 16*1024*1024);
PMap_Init();
@ -192,6 +193,7 @@ void Machine_InitAP()
Machine_GDTInit();
Machine_TSSInit();
Machine_SyscallInit();
clts(); // Enable FPU/XMM
// Setup LAPIC
LAPIC_Init();

View File

@ -19,7 +19,7 @@ extern void switchstack(uint64_t *oldrsp, uint64_t rsp);
void
Thread_InitArch(Thread *thr)
{
thr->arch.useFP = false;
thr->arch.useFP = true;
}
void
@ -93,6 +93,8 @@ Thread_SwitchArch(Thread *oldthr, Thread *newthr)
fxrstor(&newthr->arch.xsa);
}
clts();
// Jump to trapframe
switchstack(&oldthr->arch.rsp, newthr->arch.rsp);