Changeset 6eabb6e6 in mainline
- Timestamp:
- 2006-09-13T13:16:30Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34d9469e
- Parents:
- 9a5b556
- Location:
- kernel
- Files:
-
- 1 added
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/amd64/include/arch.h
r9a5b556 r6eabb6e6 27 27 */ 28 28 29 29 /** @addtogroup amd64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __amd64_ARCH_H__36 #define __amd64_ARCH_H__35 #ifndef KERN_amd64_ARCH_H_ 36 #define KERN_amd64_ARCH_H_ 37 37 38 38 #endif 39 39 40 40 /** @} 41 41 */ 42 -
kernel/arch/ia32/include/arch.h
r9a5b556 r6eabb6e6 27 27 */ 28 28 29 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __ia32_ARCH_H__36 #define __ia32_ARCH_H__35 #ifndef KERN_ia32_ARCH_H_ 36 #define KERN_ia32_ARCH_H_ 37 37 38 38 #endif 39 39 40 40 /** @} 41 41 */ 42 -
kernel/arch/ia64/include/arch.h
r9a5b556 r6eabb6e6 27 27 */ 28 28 29 29 /** @addtogroup ia64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __ia64_ARCH_H__36 #define __ia64_ARCH_H__35 #ifndef KERN_ia64_ARCH_H_ 36 #define KERN_ia64_ARCH_H_ 37 37 38 38 #define LOADED_PROG_STACK_PAGES_NO 2 … … 42 42 #endif 43 43 44 44 /** @} 45 45 */ 46 -
kernel/arch/ia64/src/interrupt.c
r9a5b556 r6eabb6e6 158 158 159 159 switch (istate->cr_isr.ge_code) { 160 160 case GE_ILLEGALOP: 161 161 desc = "Illegal Operation fault"; 162 162 break; 163 163 case GE_PRIVOP: 164 164 desc = "Privileged Operation fault"; 165 165 break; 166 166 case GE_PRIVREG: 167 167 desc = "Privileged Register fault"; 168 168 break; 169 169 case GE_RESREGFLD: 170 170 desc = "Reserved Register/Field fault"; 171 171 break; 172 172 case GE_DISBLDISTRAN: 173 173 desc = "Disabled Instruction Set Transition fault"; 174 174 break; 175 175 case GE_ILLEGALDEP: 176 176 desc = "Illegal Dependency fault"; 177 177 break; 178 179 178 default: 179 desc = "unknown"; 180 180 break; 181 181 } … … 186 186 panic("General Exception (%s)\n", desc); 187 187 } 188 189 void fpu_enable(void);190 188 191 189 void disabled_fp_register(uint64_t vector, istate_t *istate) … … 204 202 { 205 203 } 206 207 204 208 205 … … 243 240 244 241 switch(ivr.vector) { 245 242 case INTERRUPT_TIMER: 246 243 it_interrupt(); 247 248 244 break; 245 case INTERRUPT_SPURIOUS: 249 246 printf("cpu%d: spurious interrupt\n", CPU->id); 250 247 break; 251 248 default: 252 249 panic("\nUnhandled External Interrupt Vector %d\n", ivr.vector); 253 250 break; … … 255 252 } 256 253 257 void virtual_interrupt(uint64_t irq, void *param)254 void virtual_interrupt(uint64_t irq, void *param) 258 255 { 259 256 switch(irq) { 260 case IRQ_KBD: 261 if(kbd_uspace) ipc_irq_send_notif(irq); 262 break; 263 default: 264 panic("\nUnhandled Virtual Interrupt request %d\n", irq); 257 case IRQ_KBD: 258 if (kbd_uspace) 259 ipc_irq_send_notif(irq); 260 break; 261 default: 262 panic("\nUnhandled Virtual Interrupt request %d\n", irq); 265 263 break; 266 264 } … … 270 268 void irq_ipc_bind_arch(unative_t irq) 271 269 { 272 if(irq ==IRQ_KBD) {273 kbd_uspace =1;270 if(irq == IRQ_KBD) { 271 kbd_uspace = 1; 274 272 return; 275 273 } … … 281 279 /** @} 282 280 */ 283 -
kernel/arch/mips32/include/arch.h
r9a5b556 r6eabb6e6 33 33 */ 34 34 35 #ifndef __mips32_ARCH_H__36 #define __mips32_ARCH_H__35 #ifndef KERN_mips32_ARCH_H_ 36 #define KERN_mips32_ARCH_H_ 37 37 38 38 #endif -
kernel/arch/mips32/src/fpu_context.c
r9a5b556 r6eabb6e6 27 27 */ 28 28 29 29 /** @addtogroup mips32 30 30 * @{ 31 31 */ … … 58 58 } 59 59 60 60 /** @} 61 61 */ 62 -
kernel/arch/ppc32/include/arch.h
r9a5b556 r6eabb6e6 33 33 */ 34 34 35 #ifndef __ppc32_ARCH_H__36 #define __ppc32_ARCH_H__35 #ifndef KERN_ppc32_ARCH_H_ 36 #define KERN_ppc32_ARCH_H_ 37 37 38 38 #include <arch/drivers/cuda.h> -
kernel/arch/ppc64/include/arch.h
r9a5b556 r6eabb6e6 27 27 */ 28 28 29 29 /** @addtogroup ppc64 30 30 * @{ 31 31 */ … … 33 33 */ 34 34 35 #ifndef __ppc64_ARCH_H__36 #define __ppc64_ARCH_H__35 #ifndef KERN_ppc64_ARCH_H_ 36 #define KERN_ppc64_ARCH_H_ 37 37 38 38 #endif 39 39 40 40 /** @} 41 41 */ 42 -
kernel/arch/sparc64/Makefile.inc
r9a5b556 r6eabb6e6 88 88 arch/$(ARCH)/src/console.c \ 89 89 arch/$(ARCH)/src/context.S \ 90 arch/$(ARCH)/src/fpu_context.c \ 90 91 arch/$(ARCH)/src/dummy.s \ 91 92 arch/$(ARCH)/src/mm/as.c \ -
kernel/arch/sparc64/include/asm.h
r9a5b556 r6eabb6e6 109 109 } 110 110 111 /** Read FPRS Register. 112 * 113 * @return Value of FPRS register. 114 */ 115 static inline uint64_t fprs_read(void) 116 { 117 uint64_t v; 118 119 __asm__ volatile ("rd %%fprs, %0\n" : "=r" (v)); 120 121 return v; 122 } 123 124 /** Write FPRS Register. 125 * 126 * @param v New value of FPRS register. 127 */ 128 static inline void fprs_write(uint64_t v) 129 { 130 __asm__ volatile ("wr %0, %1, %%fprs\n" : : "r" (v), "i" (0)); 131 } 132 111 133 /** Read SOFTINT Register. 112 134 * -
kernel/arch/sparc64/include/fpu_context.h
r9a5b556 r6eabb6e6 38 38 #include <arch/types.h> 39 39 40 #define ARCH_HAS_FPU 41 #define FPU_CONTEXT_ALIGN 8 42 40 43 struct fpu_context { 44 uint64_t d[32]; 45 uint64_t fsr; 41 46 }; 42 47 -
kernel/arch/sparc64/include/regdef.h
r9a5b556 r6eabb6e6 44 44 45 45 #define PSTATE_PRIV_BIT (1<<2) 46 #define PSTATE_PEF_BIT (1<<4) 46 47 47 48 #define TSTATE_PSTATE_SHIFT 8 48 49 #define TSTATE_PRIV_BIT (PSTATE_PRIV_BIT<<TSTATE_PSTATE_SHIFT) 49 50 #define TSTATE_IE_BIT (PSTATE_IE_BIT<<TSTATE_PSTATE_SHIFT) 51 #define TSTATE_PEF_BIT (PSTATE_PEF_BIT<<TSTATE_PSTATE_SHIFT) 50 52 51 53 #define TSTATE_CWP_MASK 0x1f -
kernel/arch/sparc64/include/register.h
r9a5b556 r6eabb6e6 88 88 uint64_t value; 89 89 struct { 90 unsigned int_dis : 1; /**< TICK_INT interrupt disabled flag. */90 unsigned int_dis : 1; /**< TICK_INT interrupt disabled flag. */ 91 91 uint64_t tick_cmpr : 63; /**< Compare value for TICK interrupts. */ 92 92 } __attribute__ ((packed)); … … 106 106 typedef union softint_reg softint_reg_t; 107 107 108 /** Floating-point Registers State Register. */ 109 union fprs_reg { 110 uint64_t value; 111 struct { 112 uint64_t : 61; 113 unsigned fef : 1; 114 unsigned du : 1; 115 unsigned dl : 1; 116 } __attribute__ ((packed)); 117 }; 118 typedef union fprs_reg fprs_reg_t; 119 108 120 #endif 109 121 -
kernel/arch/sparc64/include/trap/exception.h
r9a5b556 r6eabb6e6 41 41 #define TT_ILLEGAL_INSTRUCTION 0x10 42 42 #define TT_PRIVILEGED_OPCODE 0x11 43 #define TT_FP_DISABLED 0x20 43 44 #define TT_DIVISION_BY_ZERO 0x28 44 45 #define TT_DATA_ACCESS_EXCEPTION 0x30 … … 57 58 extern void illegal_instruction(int n, istate_t *istate); 58 59 extern void privileged_opcode(int n, istate_t *istate); 60 extern void fp_disabled(int n, istate_t *istate); 59 61 extern void division_by_zero(int n, istate_t *istate); 60 62 extern void data_access_exception(int n, istate_t *istate); -
kernel/arch/sparc64/src/asm.S
r9a5b556 r6eabb6e6 228 228 229 229 .macro WRITE_ALTERNATE_REGISTER reg, bit 230 rdpr %pstate, %g1 ! save PSTATE.PEF 230 231 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate 231 232 mov %o0, \reg 233 wrpr %g0, PSTATE_PRIV_BIT, %pstate 232 234 retl 233 wrpr %g 0, PSTATE_PRIV_BIT, %pstate235 wrpr %g1, 0, %pstate ! restore PSTATE.PEF 234 236 .endm 235 237 236 238 .macro READ_ALTERNATE_REGISTER reg, bit 239 rdpr %pstate, %g1 ! save PSTATE.PEF 237 240 wrpr %g0, (\bit | PSTATE_PRIV_BIT), %pstate 238 241 mov \reg, %o0 242 wrpr %g0, PSTATE_PRIV_BIT, %pstate 239 243 retl 240 wrpr %g 0, PSTATE_PRIV_BIT, %pstate244 wrpr %g1, 0, %pstate ! restore PSTATE.PEF 241 245 .endm 242 246 -
kernel/arch/sparc64/src/dummy.s
r9a5b556 r6eabb6e6 30 30 31 31 .global cpu_sleep 32 .global fpu_context_restore33 .global fpu_context_save34 .global fpu_enable35 .global fpu_init36 32 .global sys_tls_set 37 33 … … 39 35 40 36 cpu_sleep: 41 fpu_context_restore:42 fpu_context_save:43 fpu_enable:44 fpu_init:45 37 sys_tls_set: 46 38 -
kernel/arch/sparc64/src/trap/exception.c
r9a5b556 r6eabb6e6 38 38 #include <interrupt.h> 39 39 #include <arch/asm.h> 40 #include <arch/register.h> 40 41 #include <debug.h> 41 42 #include <typedefs.h> … … 82 83 } 83 84 85 /** Handle fp_disabled. (0x20) */ 86 void fp_disabled(int n, istate_t *istate) 87 { 88 fprs_reg_t fprs; 89 90 fprs.value = fprs_read(); 91 if (!fprs.fef) { 92 fprs.fef = true; 93 fprs_write(fprs.value); 94 return; 95 } 96 97 #ifdef CONFIG_FPU_LAZY 98 scheduler_fpu_lazy_request(); 99 #else 100 fault_if_from_uspace(istate, "%s\n", __FUNCTION__); 101 dump_istate(istate); 102 panic("%s\n", __FUNCTION__); 103 #endif 104 } 105 84 106 /** Handle division_by_zero. (0x28) */ 85 107 void division_by_zero(int n, istate_t *istate) -
kernel/arch/sparc64/src/trap/trap_table.S
r9a5b556 r6eabb6e6 83 83 PREEMPTIBLE_HANDLER privileged_opcode 84 84 85 /* TT = 0x20, TL = 0, fb_disabled handler */ 86 .org trap_table + TT_FP_DISABLED*ENTRY_SIZE 87 .global fb_disabled_tl0 88 fp_disabled_tl0: 89 PREEMPTIBLE_HANDLER fp_disabled 90 85 91 /* TT = 0x24, TL = 0, clean_window handler */ 86 92 .org trap_table + TT_CLEAN_WINDOW*ENTRY_SIZE 87 .global clean_window_ handler_tl088 clean_window_ handler_tl0:93 .global clean_window_tl0 94 clean_window_tl0: 89 95 CLEAN_WINDOW_HANDLER 90 96 … … 490 496 /* TT = 0x24, TL > 0, clean_window handler */ 491 497 .org trap_table + (TT_CLEAN_WINDOW+512)*ENTRY_SIZE 492 .global clean_window_ handler_tl1493 clean_window_ handler_tl1:498 .global clean_window_tl1 499 clean_window_tl1: 494 500 CLEAN_WINDOW_HANDLER 495 501 … … 689 695 690 696 wrpr %g0, 0, %tl 691 wrpr %g0, PSTATE_PRIV_BIT , %pstate697 wrpr %g0, PSTATE_PRIV_BIT | PSTATE_PEF_BIT, %pstate 692 698 SAVE_GLOBALS 693 699 … … 706 712 707 713 RESTORE_GLOBALS 714 rdpr %pstate, %l1 ! we must preserve the PEF bit 708 715 wrpr %g0, PSTATE_AG_BIT | PSTATE_PRIV_BIT, %pstate 709 716 wrpr %g0, 1, %tl … … 717 724 718 725 /* 726 * Copy PSTATE.PEF to the in-register copy of TSTATE. 727 */ 728 and %l1, PSTATE_PEF_BIT, %l1 729 sllx %l1, TSTATE_PSTATE_SHIFT, %l1 730 sethi %hi(TSTATE_PEF_BIT), %g4 731 andn %g1, %g4, %g1 732 or %g1, %l1, %g1 733 734 /* 719 735 * Restore TSTATE, TPC and TNPC from saved copies. 720 736 */ … … 722 738 wrpr %g2, 0, %tpc 723 739 wrpr %g3, 0, %tnpc 740 724 741 725 742 /* -
kernel/generic/include/fpu_context.h
r9a5b556 r6eabb6e6 36 36 #define __FPU_CONTEXT_H__ 37 37 38 39 38 #include <arch/fpu_context.h> 40 39 #include <typedefs.h> -
kernel/generic/src/proc/scheduler.c
r9a5b556 r6eabb6e6 87 87 before_thread_runs_arch(); 88 88 #ifdef CONFIG_FPU_LAZY 89 if(THREAD ==CPU->fpu_owner)89 if(THREAD == CPU->fpu_owner) 90 90 fpu_enable(); 91 91 else … … 97 97 else { 98 98 fpu_init(); 99 THREAD->fpu_context_exists =1;99 THREAD->fpu_context_exists = 1; 100 100 } 101 101 #endif … … 128 128 fpu_context_save(CPU->fpu_owner->saved_fpu_context); 129 129 /* don't prevent migration */ 130 CPU->fpu_owner->fpu_context_engaged =0;130 CPU->fpu_owner->fpu_context_engaged = 0; 131 131 spinlock_unlock(&CPU->fpu_owner->lock); 132 132 CPU->fpu_owner = NULL; … … 147 147 } 148 148 fpu_init(); 149 THREAD->fpu_context_exists =1;150 } 151 CPU->fpu_owner =THREAD;149 THREAD->fpu_context_exists = 1; 150 } 151 CPU->fpu_owner = THREAD; 152 152 THREAD->fpu_context_engaged = 1; 153 153 spinlock_unlock(&THREAD->lock); -
kernel/kernel.config
r9a5b556 r6eabb6e6 86 86 87 87 # Lazy FPU context switching 88 ! [(ARCH=mips32&MACHINE!=msim&MACHINE!=simics)|ARCH=amd64|ARCH=ia32|ARCH=ia64|ARCH= xen32] CONFIG_FPU_LAZY (y/n)88 ! [(ARCH=mips32&MACHINE!=msim&MACHINE!=simics)|ARCH=amd64|ARCH=ia32|ARCH=ia64|ARCH=sparc64|ARCH=xen32] CONFIG_FPU_LAZY (y/n) 89 89 90 90 # Power off on halt -
kernel/test/fpu/fpu1/test.c
r9a5b556 r6eabb6e6 46 46 47 47 48 #ifdef __ia32_ARCH_H__48 #ifdef KERN_ia32_ARCH_H_ 49 49 static inline double sqrt(double x) { double v; __asm__ ("fsqrt\n" : "=t" (v) : "0" (x)); return v; } 50 50 #endif 51 51 52 #ifdef __amd64_ARCH_H__52 #ifdef KERN_amd64_ARCH_H_ 53 53 static inline double sqrt(double x) { double v; __asm__ ("fsqrt\n" : "=t" (v) : "0" (x)); return v; } 54 54 #endif 55 55 56 #ifdef __ia64_ARCH_H__56 #ifdef KERN_ia64_ARCH_H_ 57 57 static inline long double sqrt(long double a) 58 58 { … … 106 106 { 107 107 108 #ifdef __ia64_ARCH_H__108 #ifdef KERN_ia64_ARCH_H_ 109 109 #undef PI_10e8 110 110 #define PI_10e8 3141592 … … 135 135 } 136 136 137 #ifdef __ia64_ARCH_H__137 #ifdef KERN_ia64_ARCH_H_ 138 138 if((int)(1000000*pi)!=PI_10e8) 139 139 panic("tid%d: pi*10e8=%zd should be %zd\n", THREAD->tid, (unative_t) (1000000*pi),(unative_t) (PI_10e8/100));
Note:
See TracChangeset
for help on using the changeset viewer.