/SPARTAN/trunk/arch/ia32/include/fpu_context.h |
---|
37,5 → 37,4 |
}; |
#endif |
/SPARTAN/trunk/arch/ia32/include/cpu.h |
---|
41,8 → 41,4 |
struct tss *tss; |
}; |
void set_TS_flag(void); |
void reset_TS_flag(void); |
#endif |
/SPARTAN/trunk/arch/ia32/Makefile.inc |
---|
7,7 → 7,7 |
BFD_ARCH=i386 |
DEFS:=-DARCH=$(ARCH) |
DEFS:=-DARCH=$(ARCH) -DFPU_LAZY |
ifdef SMP |
DEFS+=-D$(SMP) |
/SPARTAN/trunk/arch/ia32/src/fpu_context.c |
---|
33,23 → 33,6 |
void fpu_context_save(fpu_context_t *fctx) |
{ |
} |
void fpu_context_restore(fpu_context_t *fctx) |
{ |
if (THREAD==CPU->fpu_owner) |
reset_TS_flag(); |
else { |
set_TS_flag(); |
if (CPU->fpu_owner != NULL) |
(CPU->fpu_owner)->fpu_context_engaged=1; |
} |
} |
void fpu_lazy_context_save(fpu_context_t *fctx) |
{ |
__asm__ volatile ( |
"fnsave %0" |
: "=m"(*fctx) |
56,7 → 39,8 |
); |
} |
void fpu_lazy_context_restore(fpu_context_t *fctx) |
void fpu_context_restore(fpu_context_t *fctx) |
{ |
__asm__ volatile ( |
"frstor %0" |
/SPARTAN/trunk/arch/ia32/src/cpu/cpu.c |
---|
62,10 → 62,9 |
"GenuineIntel" |
}; |
void set_TS_flag(void) |
void fpu_disable(void) |
{ |
asm |
( |
__asm__ volatile ( |
"mov %%cr0,%%eax;" |
"or $8,%%eax;" |
"mov %%eax,%%cr0;" |
75,10 → 74,9 |
); |
} |
void reset_TS_flag(void) |
void fpu_enable(void) |
{ |
asm |
( |
__asm__ volatile ( |
"mov %%cr0,%%eax;" |
"and $0xffFFffF7,%%eax;" |
"mov %%eax,%%cr0;" |
/SPARTAN/trunk/arch/ia32/src/interrupt.c |
---|
109,18 → 109,11 |
void nm_fault(__u8 n, __native stack[]) |
{ |
reset_TS_flag(); |
if (CPU->fpu_owner != NULL) { |
fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context)); |
CPU->fpu_owner->fpu_context_engaged=0; /* don't prevent migration */ |
} |
if (THREAD->fpu_context_exists) |
fpu_lazy_context_restore(&(THREAD->saved_fpu_context)); |
else { |
fpu_init(); |
THREAD->fpu_context_exists=1; |
} |
CPU->fpu_owner=THREAD; |
#ifdef FPU_LAZY |
scheduler_fpu_lazy_request(); |
#else |
panic("fpu fault"); |
#endif |
} |
/SPARTAN/trunk/arch/ia32/Makefile.inc.cross |
---|
7,11 → 7,12 |
AS=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-as |
LD=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-ld |
OBJCOPY=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-objcopy |
OBJDUMP=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-objdump |
BFD_NAME=elf32-i386 |
BFD_ARCH=i386 |
DEFS:=-DARCH=$(ARCH) |
DEFS:=-DARCH=$(ARCH) -DFPU_LAZY |
ifdef SMP |
DEFS+=-D$(SMP) |
25,6 → 26,9 |
CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 |
LFLAGS=-M -no-check-sections |
../arch/$(ARCH)/_link.ld: ../arch/$(ARCH)/_link.ld.in |
$(CC) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@ |
arch_sources= \ |
arch/context.s \ |
arch/debug/panic.s \ |