Changeset 852

Show
Ignore:
Timestamp:
08/21/08 21:45:43 (3 years ago)
Author:
mwhitworth
Message:

Add some CPUID functions for infofs.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Whitix/trunk/arch/i386/kernel/cpuid.c

    r587 r852  
    1919#include <i386/cpuid.h> 
    2020#include <print.h> 
     21#include <module.h> 
    2122 
    2223/* Saves the edx value of CPUID level 1. Used to check for RDTSC, SYSENTER and other instructions.  
    2324 * Needs to be adjusted for multicore systems. */ 
    2425DWORD features=0; 
     26DWORD maxLevel=0; 
    2527 
    2628DWORD CpuIdSupports(DWORD mask) 
     
    5153} 
    5254 
     55void CpuIdVendorId(char* str) 
     56{ 
     57        DWORD eax; 
     58         
     59        CpuId(0, &eax, (DWORD*)&str[0], (DWORD*)&str[8], (DWORD*)&str[4]);       
     60} 
     61 
     62SYMBOL_EXPORT(CpuIdVendorId); 
     63 
     64void CpuIdName(char* str) 
     65{ 
     66        ZeroMemory(str, 48); 
     67         
     68        if (maxLevel > 0x80000004) 
     69        { 
     70                CpuId(0x80000002, (DWORD*)&str[0], (DWORD*)&str[4], (DWORD*)&str[8], (DWORD*)&str[12]); 
     71                CpuId(0x80000003, (DWORD*)&str[16], (DWORD*)&str[20], (DWORD*)&str[24], (DWORD*)&str[28]); 
     72                CpuId(0x80000004, (DWORD*)&str[32], (DWORD*)&str[36], (DWORD*)&str[40], (DWORD*)&str[44]); 
     73        } 
     74} 
     75 
     76SYMBOL_EXPORT(CpuIdName); 
     77 
     78DWORD* CpuIdFeatures() 
     79{ 
     80        return &features; 
     81} 
     82 
     83SYMBOL_EXPORT(CpuIdFeatures); 
     84 
    5385/*********************************************************************** 
    5486 * 
     
    6597{ 
    6698        char str[12]; 
    67         DWORD maxLevel; 
    6899        DWORD eax,ebx,ecx; /* Used to ignore values. */ 
    69100