/SPARTAN/trunk/arch/ia32/include/cpu.h |
---|
30,6 → 30,7 |
#define __ia32_CPU_H__ |
#include <config.h> |
#include <proc/thread.h> |
#include <typedefs.h> |
#include <arch/pm.h> |
#include <arch/asm.h> |
46,7 → 47,11 |
int model; |
int stepping; |
struct tss *tss; |
thread_t *fpu_owner; |
}; |
void set_TS_flag(void); |
void reset_TS_flag(void); |
#endif |
/SPARTAN/trunk/arch/ia32/src/fpu_context.c |
---|
29,7 → 29,10 |
*/ |
#include <fpu_context.h> |
#include <arch.h> |
#include <cpu.h> |
void fpu_context_save(fpu_context_t *fctx) |
{ |
} |
37,6 → 40,8 |
void fpu_context_restore(fpu_context_t *fctx) |
{ |
if(THREAD==CPU->arch.fpu_owner) reset_TS_flag(); |
else set_TS_flag(); |
} |
/SPARTAN/trunk/arch/ia32/src/cpu/cpu.c |
---|
61,9 → 61,38 |
"GenuineIntel" |
}; |
void set_TS_flag(void) |
{ |
asm |
( |
"mov %%cr0,%%eax;" |
"or $8,%%eax;" |
"mov %%eax,%%cr0;" |
: |
: |
:"%eax" |
); |
} |
void reset_TS_flag(void) |
{ |
asm |
( |
"mov %%cr0,%%eax;" |
"and $0xffFFffF7,%%eax;" |
"mov %%eax,%%cr0;" |
: |
: |
:"%eax" |
); |
} |
void cpu_arch_init(void) |
{ |
CPU->arch.tss = tss_p; |
CPU->arch.fpu_owner=NULL; |
} |