Changes in kernel/arch/ia32/src/cpu/cpu.c [dc0b964:add04f7] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/arch/ia32/src/cpu/cpu.c
rdc0b964 radd04f7 38 38 39 39 #include <arch.h> 40 #include < typedefs.h>40 #include <arch/types.h> 41 41 #include <print.h> 42 42 #include <fpu_context.h> … … 49 49 * Contains only non-MP-Specification specific SMP code. 50 50 */ 51 #define AMD_CPUID_EBX UINT32_C(0x68747541)52 #define AMD_CPUID_ECX UINT32_C(0x444d4163)53 #define AMD_CPUID_EDX UINT32_C(0x69746e65)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 UINT32_C(0x756e6547)56 #define INTEL_CPUID_ECX UINT32_C(0x6c65746e)57 #define INTEL_CPUID_EDX UINT32_C(0x49656e69)55 #define INTEL_CPUID_EBX 0x756e6547 56 #define INTEL_CPUID_ECX 0x6c65746e 57 #define INTEL_CPUID_EDX 0x49656e69 58 58 59 59 … … 64 64 }; 65 65 66 static c onst char *vendor_str[] = {66 static char *vendor_str[] = { 67 67 "Unknown Vendor", 68 68 "AMD", … … 92 92 void cpu_arch_init(void) 93 93 { 94 cpuid_feature_info fi; 94 95 cpuid_extended_feature_info efi; 95 96 cpu_info_t info; … … 101 102 CPU->fpu_owner = NULL; 102 103 103 cpuid( INTEL_CPUID_STANDARD, &info);104 cpuid(1, &info); 104 105 105 CPU->arch.fi.word = info.cpuid_edx;106 fi.word = info.cpuid_edx; 106 107 efi.word = info.cpuid_ecx; 107 108 108 if ( CPU->arch.fi.bits.fxsr)109 if (fi.bits.fxsr) 109 110 fpu_fxsr(); 110 111 else 111 112 fpu_fsr(); 112 113 113 if ( CPU->arch.fi.bits.sse) {114 if (fi.bits.sse) { 114 115 asm volatile ( 115 116 "mov %%cr4, %[help]\n" … … 121 122 } 122 123 123 if (CPU->arch.fi.bits.sep) { 124 /* Setup fast SYSENTER/SYSEXIT syscalls */ 125 syscall_setup_cpu(); 126 } 124 /* Setup fast SYSENTER/SYSEXIT syscalls */ 125 syscall_setup_cpu(); 127 126 } 128 127 … … 133 132 CPU->arch.vendor = VendorUnknown; 134 133 if (has_cpuid()) { 135 cpuid( INTEL_CPUID_LEVEL, &info);134 cpuid(0, &info); 136 135 137 136 /* … … 140 139 if ((info.cpuid_ebx == AMD_CPUID_EBX) 141 140 && (info.cpuid_ecx == AMD_CPUID_ECX) 142 141 && (info.cpuid_edx == AMD_CPUID_EDX)) 143 142 CPU->arch.vendor = VendorAMD; 144 143 145 144 /* 146 145 * Check for Intel processor. 147 */ 146 */ 148 147 if ((info.cpuid_ebx == INTEL_CPUID_EBX) 149 148 && (info.cpuid_ecx == INTEL_CPUID_ECX) 150 149 && (info.cpuid_edx == INTEL_CPUID_EDX)) 151 150 CPU->arch.vendor = VendorIntel; 152 151 153 cpuid( INTEL_CPUID_STANDARD, &info);154 CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f U;155 CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f U;156 CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0f U;152 cpuid(1, &info); 153 CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f; 154 CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f; 155 CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0f; 157 156 } 158 157 }
Note:
See TracChangeset
for help on using the changeset viewer.