Changeset b49f4ae in mainline
- Timestamp:
- 2005-09-06T09:56:26Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 50a4e25
- Parents:
- a5d1331
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/amd64/Makefile.inc
ra5d1331 rb49f4ae 11 11 BFD_ARCH=i386:x86-64 12 12 13 DEFS=-DARCH=$(ARCH) 13 DEFS=-DARCH=$(ARCH) -DFPU_LAZY 14 14 15 15 ifdef SMP -
arch/amd64/include/cpu.h
ra5d1331 rb49f4ae 52 52 53 53 54 extern void set_TS_flag(void);55 extern void reset_TS_flag(void);56 54 extern void set_efer_flag(int flag); 57 55 extern __u64 read_efer_flag(void); -
arch/amd64/src/cpu/cpu.c
ra5d1331 rb49f4ae 91 91 * 92 92 */ 93 void set_TS_flag(void)93 void fpu_disable(void) 94 94 { 95 95 __asm__ volatile ( … … 103 103 } 104 104 105 void reset_TS_flag(void)105 void fpu_enable(void) 106 106 { 107 107 __asm__ volatile ( -
arch/amd64/src/fpu_context.c
ra5d1331 rb49f4ae 34 34 void fpu_context_save(fpu_context_t *fctx) 35 35 { 36 } 37 38 void fpu_context_restore(fpu_context_t *fctx) 39 { 40 if(THREAD==CPU->fpu_owner) 41 reset_TS_flag(); 42 else 43 set_TS_flag(); 44 } 45 46 47 void fpu_lazy_context_save(fpu_context_t *fctx) 48 { 49 /* TODO: We need malloc that allocates on 16-byte boundary !! */ 36 /* Align on 16-byte boundary */ 50 37 if (((__u64)fctx) & 0xf) 51 38 fctx = (fpu_context_t *)((((__u64)fctx) | 0xf) + 1); … … 57 44 } 58 45 59 void fpu_ lazy_context_restore(fpu_context_t *fctx)46 void fpu_context_restore(fpu_context_t *fctx) 60 47 { 61 48 /* TODO: We need malloc that allocates on 16-byte boundary !! */ -
arch/amd64/src/interrupt.c
ra5d1331 rb49f4ae 39 39 #include <symtab.h> 40 40 #include <arch/asm.h> 41 41 #include <proc/scheduler.h> 42 42 43 43 … … 139 139 void nm_fault(__u8 n, __native stack[]) 140 140 { 141 reset_TS_flag(); 142 if (CPU->fpu_owner != NULL) { 143 fpu_lazy_context_save(&CPU->fpu_owner->saved_fpu_context); 144 /* don't prevent migration */ 145 CPU->fpu_owner->fpu_context_engaged=0; 146 } 147 if (THREAD->fpu_context_exists) 148 fpu_lazy_context_restore(&THREAD->saved_fpu_context); 149 else { 150 fpu_init(); 151 THREAD->fpu_context_exists=1; 152 } 153 CPU->fpu_owner=THREAD; 154 THREAD->fpu_context_engaged = 1; 141 #ifdef FPU_LAZY 142 scheduler_fpu_lazy_request(); 143 #else 144 panic("fpu fault"); 145 #endif 155 146 } 156 147 -
arch/ia32/Makefile.inc
ra5d1331 rb49f4ae 8 8 9 9 10 DEFS:=-DARCH=$(ARCH) 10 DEFS:=-DARCH=$(ARCH) -DFPU_LAZY 11 11 12 12 ifdef SMP -
arch/ia32/Makefile.inc.cross
ra5d1331 rb49f4ae 8 8 LD=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-ld 9 9 OBJCOPY=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-objcopy 10 OBJDUMP=$(IA-32_BINUTILS_DIR)/$(IA-32_TARGET)-objdump 10 11 11 12 BFD_NAME=elf32-i386 12 13 BFD_ARCH=i386 13 14 14 DEFS:=-DARCH=$(ARCH) 15 DEFS:=-DARCH=$(ARCH) -DFPU_LAZY 15 16 16 17 ifdef SMP … … 25 26 CFLAGS=$(CPPFLAGS) -nostdlib -fno-builtin -fomit-frame-pointer -Werror-implicit-function-declaration -Wmissing-prototypes -Werror -O3 26 27 LFLAGS=-M -no-check-sections 28 29 ../arch/$(ARCH)/_link.ld: ../arch/$(ARCH)/_link.ld.in 30 $(CC) $(CFLAGS) -E -x c $< | grep -v "^\#" > $@ 27 31 28 32 arch_sources= \ -
arch/ia32/include/cpu.h
ra5d1331 rb49f4ae 42 42 }; 43 43 44 45 void set_TS_flag(void);46 void reset_TS_flag(void);47 48 44 #endif -
arch/ia32/include/fpu_context.h
ra5d1331 rb49f4ae 38 38 39 39 40 41 40 #endif -
arch/ia32/src/cpu/cpu.c
ra5d1331 rb49f4ae 63 63 }; 64 64 65 void set_TS_flag(void)65 void fpu_disable(void) 66 66 { 67 asm 68 ( 67 __asm__ volatile ( 69 68 "mov %%cr0,%%eax;" 70 69 "or $8,%%eax;" … … 76 75 } 77 76 78 void reset_TS_flag(void)77 void fpu_enable(void) 79 78 { 80 asm 81 ( 79 __asm__ volatile ( 82 80 "mov %%cr0,%%eax;" 83 81 "and $0xffFFffF7,%%eax;" -
arch/ia32/src/fpu_context.c
ra5d1331 rb49f4ae 34 34 void fpu_context_save(fpu_context_t *fctx) 35 35 { 36 }37 38 39 void fpu_context_restore(fpu_context_t *fctx)40 {41 if (THREAD==CPU->fpu_owner)42 reset_TS_flag();43 else {44 set_TS_flag();45 if (CPU->fpu_owner != NULL)46 (CPU->fpu_owner)->fpu_context_engaged=1;47 }48 }49 50 51 void fpu_lazy_context_save(fpu_context_t *fctx)52 {53 36 __asm__ volatile ( 54 37 "fnsave %0" … … 57 40 } 58 41 59 void fpu_lazy_context_restore(fpu_context_t *fctx) 42 43 void fpu_context_restore(fpu_context_t *fctx) 60 44 { 61 45 __asm__ volatile ( -
arch/ia32/src/interrupt.c
ra5d1331 rb49f4ae 110 110 void nm_fault(__u8 n, __native stack[]) 111 111 { 112 reset_TS_flag(); 113 if (CPU->fpu_owner != NULL) { 114 fpu_lazy_context_save(&((CPU->fpu_owner)->saved_fpu_context)); 115 CPU->fpu_owner->fpu_context_engaged=0; /* don't prevent migration */ 116 } 117 if (THREAD->fpu_context_exists) 118 fpu_lazy_context_restore(&(THREAD->saved_fpu_context)); 119 else { 120 fpu_init(); 121 THREAD->fpu_context_exists=1; 122 } 123 CPU->fpu_owner=THREAD; 112 #ifdef FPU_LAZY 113 scheduler_fpu_lazy_request(); 114 #else 115 panic("fpu fault"); 116 #endif 124 117 } 125 118 -
arch/ia64/src/dummy.s
ra5d1331 rb49f4ae 43 43 .global frame_arch_init 44 44 .global dummy 45 .global fpu_enable 46 .global fpu_disable 47 .gloabl fpu_init 45 48 46 49 before_thread_runs_arch: … … 57 60 cpu_sleep: 58 61 frame_arch_init: 62 fpu_init: 63 fpu_enable: 64 fpu_disable: 59 65 60 66 dummy: -
arch/ia64/src/fpu_context.c
ra5d1331 rb49f4ae 39 39 } 40 40 41 42 void fpu_lazy_context_save(fpu_context_t *fctx)43 {44 }45 46 void fpu_lazy_context_restore(fpu_context_t *fctx)47 {48 } -
arch/mips/src/dummy.s
ra5d1331 rb49f4ae 35 35 .global before_thread_runs_arch 36 36 .global dummy 37 .global fpu_enable 38 .global fpu_disable 39 .global fpu_init 37 40 38 41 before_thread_runs_arch: … … 40 43 calibrate_delay_loop: 41 44 asm_delay_loop: 45 fpu_enable: 46 fpu_disable: 47 fpu_init: 42 48 43 49 dummy: -
arch/mips/src/fpu_context.c
ra5d1331 rb49f4ae 39 39 } 40 40 41 42 void fpu_lazy_context_save(fpu_context_t *fctx)43 {44 }45 46 void fpu_lazy_context_restore(fpu_context_t *fctx)47 {48 } -
arch/ppc/src/dummy.s
ra5d1331 rb49f4ae 33 33 .global before_thread_runs_arch 34 34 .global dummy 35 .global fpu_init 36 .global fpu_enable 37 .global fpu_disable 35 38 36 39 before_thread_runs_arch: 37 40 userspace: 38 41 asm_delay_loop: 42 fpu_init: 43 fpu_enable: 44 fpu_disable: 39 45 40 46 dummy: -
arch/ppc/src/fpu_context.c
ra5d1331 rb49f4ae 38 38 { 39 39 } 40 41 42 void fpu_lazy_context_save(fpu_context_t *fctx)43 {44 }45 46 void fpu_lazy_context_restore(fpu_context_t *fctx)47 {48 49 } -
include/fpu_context.h
ra5d1331 rb49f4ae 36 36 extern void fpu_context_save(fpu_context_t *); 37 37 extern void fpu_context_restore(fpu_context_t *); 38 extern void fpu_lazy_context_save(fpu_context_t *);39 extern void fpu_lazy_context_restore(fpu_context_t *);40 38 extern void fpu_init(void); 39 extern void fpu_enable(void); 40 extern void fpu_disable(void); 41 41 42 42 -
include/proc/scheduler.h
ra5d1331 rb49f4ae 52 52 extern void scheduler_init(void); 53 53 54 extern void scheduler_fpu_lazy_request(void); 54 55 extern void scheduler(void); 55 56 extern void kcpulb(void *arg); -
src/proc/scheduler.c
ra5d1331 rb49f4ae 61 61 void before_thread_runs(void) 62 62 { 63 before_thread_runs_arch(); 64 fpu_context_restore(&(THREAD->saved_fpu_context)); 65 } 66 63 before_thread_runs_arch(); 64 #ifdef FPU_LAZY 65 if(THREAD==CPU->fpu_owner) 66 fpu_enable(); 67 else 68 fpu_disable(); 69 #else 70 fpu_enable(); 71 if (THREAD->fpu_context_exists) 72 fpu_context_restore(&(THREAD->saved_fpu_context)); 73 else { 74 fpu_init(); 75 THREAD->fpu_context_exists=1; 76 } 77 #endif 78 } 79 80 #ifdef FPU_LAZY 81 void scheduler_fpu_lazy_request(void) 82 { 83 fpu_enable(); 84 if (CPU->fpu_owner != NULL) { 85 fpu_context_save(&CPU->fpu_owner->saved_fpu_context); 86 /* don't prevent migration */ 87 CPU->fpu_owner->fpu_context_engaged=0; 88 } 89 if (THREAD->fpu_context_exists) 90 fpu_context_restore(&THREAD->saved_fpu_context); 91 else { 92 fpu_init(); 93 THREAD->fpu_context_exists=1; 94 } 95 CPU->fpu_owner=THREAD; 96 THREAD->fpu_context_engaged = 1; 97 } 98 #endif 67 99 68 100 /** Initialize scheduler … … 241 273 if (THREAD) { 242 274 spinlock_lock(&THREAD->lock); 275 #ifndef FPU_LAZY 243 276 fpu_context_save(&(THREAD->saved_fpu_context)); 277 #endif 244 278 if (!context_save(&THREAD->saved_context)) { 245 279 /*
Note:
See TracChangeset
for help on using the changeset viewer.