Main Page | Directories | File List | Globals

cpuid.c

Go to the documentation of this file.
00001 /*
00002  * kernel_arch/i386/kernel/cpu/cpuid.c
00003  *
00004  * Copyright (c) 2003-2004 Lukasz Dembinski <dembol@nasa.com.pl>
00005  * All Rights Reserved
00006  * 
00007  * Date:        2004/01
00008  * Author:      Lukasz Dembinski
00009  * Info:        cpuid. core file
00010  * Contact:     mailto: <dembol@nasa.com.pl>
00011  *
00012  */
00013 
00014 #include <agnix/agnix.h>
00015 
00016 void cpuid(u32 level, u32 *eax, u32 *ebx, u32 *ecx, u32 *edx)
00017 {
00018     asm("cpuid"
00019         :"=a"(*eax), "=b"(*ebx), "=c"(*ecx), "=d"(*edx)
00020         :"0"(level));
00021 }
00022 
00023 u32 cpuid_reg(u32 level, int reg_nr)
00024 {
00025     u32 eax, ebx, ecx, edx;
00026 
00027     asm("cpuid"
00028         :"=a"(eax), "=b"(ebx), "=c"(ecx), "=d"(edx)
00029         :"0"(level));
00030     
00031     switch(reg_nr) {
00032         case 0: return eax;
00033         case 1: return ebx;
00034         case 2: return ecx;
00035         case 3: return edx;
00036     }
00037 
00038     return 0;
00039 }
00040 
Dokumentacje wygenerowano programem Doxygen 1.4.2 dla projektu Agnix