Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/ia32/src/cpu/cpu.c

    radd04f7 rdc0b964  
    3838
    3939#include <arch.h>
    40 #include <arch/types.h>
     40#include <typedefs.h>
    4141#include <print.h>
    4242#include <fpu_context.h>
     
    4949 * Contains only non-MP-Specification specific SMP code.
    5050 */
    51 #define AMD_CPUID_EBX  0x68747541
    52 #define AMD_CPUID_ECX  0x444d4163
    53 #define AMD_CPUID_EDX  0x69746e65
     51#define AMD_CPUID_EBX  UINT32_C(0x68747541)
     52#define AMD_CPUID_ECX  UINT32_C(0x444d4163)
     53#define AMD_CPUID_EDX  UINT32_C(0x69746e65)
    5454
    55 #define INTEL_CPUID_EBX  0x756e6547
    56 #define INTEL_CPUID_ECX  0x6c65746e
    57 #define INTEL_CPUID_EDX  0x49656e69
     55#define INTEL_CPUID_EBX  UINT32_C(0x756e6547)
     56#define INTEL_CPUID_ECX  UINT32_C(0x6c65746e)
     57#define INTEL_CPUID_EDX  UINT32_C(0x49656e69)
    5858
    5959
     
    6464};
    6565
    66 static char *vendor_str[] = {
     66static const char *vendor_str[] = {
    6767        "Unknown Vendor",
    6868        "AMD",
     
    9292void cpu_arch_init(void)
    9393{
    94         cpuid_feature_info fi;
    9594        cpuid_extended_feature_info efi;
    9695        cpu_info_t info;
     
    102101        CPU->fpu_owner = NULL;
    103102       
    104         cpuid(1, &info);
     103        cpuid(INTEL_CPUID_STANDARD, &info);
    105104       
    106         fi.word = info.cpuid_edx;
     105        CPU->arch.fi.word = info.cpuid_edx;
    107106        efi.word = info.cpuid_ecx;
    108107       
    109         if (fi.bits.fxsr)
     108        if (CPU->arch.fi.bits.fxsr)
    110109                fpu_fxsr();
    111110        else
    112111                fpu_fsr();
    113112       
    114         if (fi.bits.sse) {
     113        if (CPU->arch.fi.bits.sse) {
    115114                asm volatile (
    116115                        "mov %%cr4, %[help]\n"
     
    122121        }
    123122       
    124         /* Setup fast SYSENTER/SYSEXIT syscalls */
    125         syscall_setup_cpu();
     123        if (CPU->arch.fi.bits.sep) {
     124                /* Setup fast SYSENTER/SYSEXIT syscalls */
     125                syscall_setup_cpu();
     126        }
    126127}
    127128
     
    132133        CPU->arch.vendor = VendorUnknown;
    133134        if (has_cpuid()) {
    134                 cpuid(0, &info);
     135                cpuid(INTEL_CPUID_LEVEL, &info);
    135136
    136137                /*
     
    139140                if ((info.cpuid_ebx == AMD_CPUID_EBX)
    140141                    && (info.cpuid_ecx == AMD_CPUID_ECX)
    141                         && (info.cpuid_edx == AMD_CPUID_EDX))
     142                    && (info.cpuid_edx == AMD_CPUID_EDX))
    142143                        CPU->arch.vendor = VendorAMD;
    143144               
    144145                /*
    145146                 * Check for Intel processor.
    146                  */             
     147                 */
    147148                if ((info.cpuid_ebx == INTEL_CPUID_EBX)
    148149                    && (info.cpuid_ecx == INTEL_CPUID_ECX)
    149                         && (info.cpuid_edx == INTEL_CPUID_EDX))
     150                    && (info.cpuid_edx == INTEL_CPUID_EDX))
    150151                        CPU->arch.vendor = VendorIntel;
    151152               
    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;                                             
     153                cpuid(INTEL_CPUID_STANDARD, &info);
     154                CPU->arch.family = (info.cpuid_eax >> 8) & 0x0fU;
     155                CPU->arch.model = (info.cpuid_eax >> 4) & 0x0fU;
     156                CPU->arch.stepping = (info.cpuid_eax >> 0) & 0x0fU;
    156157        }
    157158}
Note: See TracChangeset for help on using the changeset viewer.