Changeset add04f7 in mainline for kernel/arch/ia32/src
- Timestamp:
- 2009-03-03T15:20:49Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f24d300
- Parents:
- deca67b
- Location:
- kernel/arch/ia32/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/cpu/cpu.c
rdeca67b radd04f7 49 49 * Contains only non-MP-Specification specific SMP code. 50 50 */ 51 #define AMD_CPUID_EBX 52 #define AMD_CPUID_ECX 53 #define AMD_CPUID_EDX 51 #define AMD_CPUID_EBX 0x68747541 52 #define AMD_CPUID_ECX 0x444d4163 53 #define AMD_CPUID_EDX 0x69746e65 54 54 55 #define INTEL_CPUID_EBX 56 #define INTEL_CPUID_ECX 0x6c65746e57 #define INTEL_CPUID_EDX 0x49656e6955 #define INTEL_CPUID_EBX 0x756e6547 56 #define INTEL_CPUID_ECX 0x6c65746e 57 #define INTEL_CPUID_EDX 0x49656e69 58 58 59 59 60 60 enum vendor { 61 VendorUnknown =0,61 VendorUnknown = 0, 62 62 VendorAMD, 63 63 VendorIntel … … 73 73 { 74 74 asm volatile ( 75 "mov %%cr0,%%eax;" 76 "or $8,%%eax;" 77 "mov %%eax,%%cr0;" 78 : 79 : 80 : "%eax" 75 "mov %%cr0, %%eax\n" 76 "or $8, %%eax\n" 77 "mov %%eax, %%cr0\n" 78 ::: "%eax" 81 79 ); 82 80 } … … 85 83 { 86 84 asm volatile ( 87 "mov %%cr0,%%eax;" 88 "and $0xffFFffF7,%%eax;" 89 "mov %%eax,%%cr0;" 90 : 91 : 92 : "%eax" 93 ); 85 "mov %%cr0, %%eax\n" 86 "and $0xffFFffF7, %%eax\n" 87 "mov %%eax,%%cr0\n" 88 ::: "%eax" 89 ); 94 90 } 95 91 … … 103 99 CPU->arch.tss = tss_p; 104 100 CPU->arch.tss->iomap_base = &CPU->arch.tss->iomap[0] - ((uint8_t *) CPU->arch.tss); 105 101 106 102 CPU->fpu_owner = NULL; 107 103 108 104 cpuid(1, &info); 109 105 110 106 fi.word = info.cpuid_edx; 111 107 efi.word = info.cpuid_ecx; … … 114 110 fpu_fxsr(); 115 111 else 116 fpu_fsr(); 112 fpu_fsr(); 117 113 118 114 if (fi.bits.sse) { 119 115 asm volatile ( 120 "mov %%cr4, %0\n"121 "or % 1,%0\n"122 "mov % 0,%%cr4\n"123 : "+r" (help)124 : "i" (CR4_OSFXSR_MASK|(1<<10))116 "mov %%cr4, %[help]\n" 117 "or %[mask], %[help]\n" 118 "mov %[help], %%cr4\n" 119 : [help] "+r" (help) 120 : [mask] "i" (CR4_OSFXSR_MASK | (1 << 10)) 125 121 ); 126 122 } -
kernel/arch/ia32/src/fpu_context.c
rdeca67b radd04f7 45 45 { 46 46 asm volatile ( 47 "fnsave % 0"48 : "=m"(*fctx)49 47 "fnsave %[fctx]" 48 : [fctx] "=m" (*fctx) 49 ); 50 50 } 51 51 … … 53 53 { 54 54 asm volatile ( 55 "frstor % 0"56 : "=m"(*fctx)57 55 "frstor %[fctx]" 56 : [fctx] "=m" (*fctx) 57 ); 58 58 } 59 59 … … 61 61 { 62 62 asm volatile ( 63 "fxsave % 0"64 : "=m"(*fctx)65 63 "fxsave %[fctx]" 64 : [fctx] "=m" (*fctx) 65 ); 66 66 } 67 67 … … 69 69 { 70 70 asm volatile ( 71 "fxrstor % 0"72 : "=m"(*fctx)73 71 "fxrstor %[fctx]" 72 : [fctx] "=m" (*fctx) 73 ); 74 74 } 75 75 76 /* 77 Setup using fxsr instruction 78 */ 76 /* Setup using fxsr instruction */ 79 77 void fpu_fxsr(void) 80 78 { … … 82 80 fpu_restore=fpu_context_fx_restore; 83 81 } 84 /* 85 Setup using not fxsr instruction 86 */ 82 83 /* Setup using not fxsr instruction */ 87 84 void fpu_fsr(void) 88 85 { … … 103 100 void fpu_init() 104 101 { 105 uint32_t help0 = 0, help1 = 0; 102 uint32_t help0 = 0; 103 uint32_t help1 = 0; 104 106 105 asm volatile ( 107 "fninit ;\n"108 "stmxcsr % 0\n"109 "mov % 0,%1;\n"110 "or % 2,%1;\n"111 "mov % 1,%0;\n"112 "ldmxcsr % 0;\n"113 : "+m" (help0),"+r" (help1)114 : "i" (0x1f80)106 "fninit\n" 107 "stmxcsr %[help0]\n" 108 "mov %[help0], %[help1]\n" 109 "or %[magic], %[help1]\n" 110 "mov %[help1], %[help0]\n" 111 "ldmxcsr %[help0]\n" 112 : [help0] "+m" (help0), [help1] "+r" (help1) 113 : [magic] "i" (0x1f80) 115 114 ); 116 115 } -
kernel/arch/ia32/src/interrupt.c
rdeca67b radd04f7 139 139 uint32_t mxcsr; 140 140 asm ( 141 "stmxcsr % 0;\n"142 : "=m" (mxcsr)141 "stmxcsr %[mxcsr]\n" 142 : [mxcsr] "=m" (mxcsr) 143 143 ); 144 144 fault_if_from_uspace(istate, "SIMD FP exception(19), MXCSR: %#zx.", 145 145 (unative_t) mxcsr); 146 146 147 147 decode_istate(istate); 148 148 printf("MXCSR: %#lx\n", mxcsr); -
kernel/arch/ia32/src/pm.c
rdeca67b radd04f7 27 27 */ 28 28 29 /** @addtogroup ia32 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 155 155 "push %%eax\n" 156 156 "popfl\n" 157 : :: "eax"157 ::: "eax" 158 158 ); 159 159 } … … 166 166 "and $0xfffbffff, %%eax\n" 167 167 "mov %%eax, %%cr0\n" 168 : :: "eax"168 ::: "eax" 169 169 ); 170 170 } -
kernel/arch/ia32/src/userspace.c
rdeca67b radd04f7 27 27 */ 28 28 29 /** @addtogroup ia32 29 /** @addtogroup ia32 30 30 * @{ 31 31 */ … … 48 48 void userspace(uspace_arg_t *kernel_uarg) 49 49 { 50 ipl_t ipl; 51 52 ipl = interrupts_disable(); 53 50 ipl_t ipl = interrupts_disable(); 51 54 52 asm volatile ( 55 53 /* … … 61 59 "push %%eax\n" 62 60 "popfl\n" 63 61 64 62 /* Set up GS register (TLS) */ 65 "movl % 6, %%gs\n"66 67 "pushl % 0\n"68 "pushl % 1\n"69 "pushl % 2\n"70 "pushl % 3\n"71 "pushl % 4\n"72 "movl % 5, %%eax\n"73 63 "movl %[tls_des], %%gs\n" 64 65 "pushl %[udata_des]\n" 66 "pushl %[stack_size]\n" 67 "pushl %[ipl]\n" 68 "pushl %[utext_des]\n" 69 "pushl %[entry]\n" 70 "movl %[uarg], %%eax\n" 71 74 72 /* %ebx is defined to hold pcb_ptr - set it to 0 */ 75 "xorl %%ebx, %%ebx\n" 76 73 "xorl %%ebx, %%ebx\n" 74 77 75 "iret\n" 78 : 79 : "i" (selector(UDATA_DES) | PL_USER), 80 "r" ((uint8_t *) kernel_uarg->uspace_stack + 81 THREAD_STACK_SIZE), 82 "r" (ipl), 83 "i" (selector(UTEXT_DES) | PL_USER), 84 "r" (kernel_uarg->uspace_entry), 85 "r" (kernel_uarg->uspace_uarg), 86 "r" (selector(TLS_DES)) 76 : 77 : [udata_des] "i" (selector(UDATA_DES) | PL_USER), 78 [stack_size] "r" ((uint8_t *) kernel_uarg->uspace_stack + THREAD_STACK_SIZE), 79 [ipl] "r" (ipl), 80 [utext_des] "i" (selector(UTEXT_DES) | PL_USER), 81 [entry] "r" (kernel_uarg->uspace_entry), 82 [uarg] "r" (kernel_uarg->uspace_uarg), 83 [tls_des] "r" (selector(TLS_DES)) 87 84 : "eax"); 88 85 89 86 /* Unreachable */ 90 for(;;) 91 ; 87 while (1); 92 88 } 93 89
Note:
See TracChangeset
for help on using the changeset viewer.