Rev 3485 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3485 | Rev 3707 | ||
---|---|---|---|
Line 63... | Line 63... | ||
63 | VendorIntel |
63 | VendorIntel |
64 | }; |
64 | }; |
65 | 65 | ||
66 | static char *vendor_str[] = { |
66 | static char *vendor_str[] = { |
67 | "Unknown Vendor", |
67 | "Unknown Vendor", |
68 | "AuthenticAMD", |
68 | "AMD", |
69 | "GenuineIntel" |
69 | "Intel" |
70 | }; |
70 | }; |
71 | 71 | ||
72 | void fpu_disable(void) |
72 | void fpu_disable(void) |
73 | { |
73 | { |
74 | asm volatile ( |
74 | asm volatile ( |
75 | "mov %%cr0,%%eax;" |
75 | "mov %%cr0,%%eax;" |
76 | "or $8,%%eax;" |
76 | "or $8,%%eax;" |
77 | "mov %%eax,%%cr0;" |
77 | "mov %%eax,%%cr0;" |
78 | : |
78 | : |
79 | : |
79 | : |
80 | :"%eax" |
80 | : "%eax" |
81 | ); |
81 | ); |
82 | } |
82 | } |
83 | 83 | ||
84 | void fpu_enable(void) |
84 | void fpu_enable(void) |
85 | { |
85 | { |
Line 87... | Line 87... | ||
87 | "mov %%cr0,%%eax;" |
87 | "mov %%cr0,%%eax;" |
88 | "and $0xffFFffF7,%%eax;" |
88 | "and $0xffFFffF7,%%eax;" |
89 | "mov %%eax,%%cr0;" |
89 | "mov %%eax,%%cr0;" |
90 | : |
90 | : |
91 | : |
91 | : |
92 | :"%eax" |
92 | : "%eax" |
93 | ); |
93 | ); |
94 | } |
94 | } |
95 | 95 | ||
96 | void cpu_arch_init(void) |
96 | void cpu_arch_init(void) |
97 | { |
97 | { |
Line 138... | Line 138... | ||
138 | cpuid(0, &info); |
138 | cpuid(0, &info); |
139 | 139 | ||
140 | /* |
140 | /* |
141 | * Check for AMD processor. |
141 | * Check for AMD processor. |
142 | */ |
142 | */ |
- | 143 | if ((info.cpuid_ebx == AMD_CPUID_EBX) |
|
143 | if (info.cpuid_ebx==AMD_CPUID_EBX && info.cpuid_ecx==AMD_CPUID_ECX && info.cpuid_edx==AMD_CPUID_EDX) { |
144 | && (info.cpuid_ecx == AMD_CPUID_ECX) |
- | 145 | && (info.cpuid_edx == AMD_CPUID_EDX)) |
|
144 | CPU->arch.vendor = VendorAMD; |
146 | CPU->arch.vendor = VendorAMD; |
145 | } |
147 | |
146 | - | ||
147 | /* |
148 | /* |
148 | * Check for Intel processor. |
149 | * Check for Intel processor. |
149 | */ |
150 | */ |
- | 151 | if ((info.cpuid_ebx == INTEL_CPUID_EBX) |
|
150 | if (info.cpuid_ebx==INTEL_CPUID_EBX && info.cpuid_ecx==INTEL_CPUID_ECX && info.cpuid_edx==INTEL_CPUID_EDX) { |
152 | && (info.cpuid_ecx == INTEL_CPUID_ECX) |
- | 153 | && (info.cpuid_edx == INTEL_CPUID_EDX)) |
|
151 | CPU->arch.vendor = VendorIntel; |
154 | CPU->arch.vendor = VendorIntel; |
152 | } |
155 | |
153 | - | ||
154 | cpuid(1, &info); |
156 | cpuid(1, &info); |
155 | CPU->arch.family = (info.cpuid_eax>>8)&0xf; |
157 | CPU->arch.family = (info.cpuid_eax >> 8) & 0x0f; |
156 | CPU->arch.model = (info.cpuid_eax>>4)&0xf; |
158 | CPU->arch.model = (info.cpuid_eax >> 4) & 0x0f; |
157 | CPU->arch.stepping = (info.cpuid_eax>>0)&0xf; |
159 | CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0f; |
158 | } |
160 | } |
159 | } |
161 | } |
160 | 162 | ||
161 | void cpu_print_report(cpu_t* m) |
163 | void cpu_print_report(cpu_t* cpu) |
162 | { |
164 | { |
163 | printf("cpu%d: (%s family=%d model=%d stepping=%d) %dMHz\n", |
165 | printf("cpu%u: (%s family=%u model=%u stepping=%u) %" PRIu16 " MHz\n", |
164 | m->id, vendor_str[m->arch.vendor], m->arch.family, m->arch.model, m->arch.stepping, |
166 | cpu->id, vendor_str[cpu->arch.vendor], cpu->arch.family, |
165 | m->frequency_mhz); |
167 | cpu->arch.model, cpu->arch.stepping, cpu->frequency_mhz); |
166 | } |
168 | } |
167 | 169 | ||
168 | /** @} |
170 | /** @} |
169 | */ |
171 | */ |