GDB (API)
|
00001 /* C API for x86 cpuid insn. 00002 Copyright (C) 2007-2013 Free Software Foundation, Inc. 00003 00004 This file is part of GDB. 00005 00006 This file is free software; you can redistribute it and/or modify it 00007 under the terms of the GNU General Public License as published by the 00008 Free Software Foundation; either version 3, or (at your option) any 00009 later version. 00010 00011 This program is distributed in the hope that it will be useful, 00012 but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 GNU General Public License for more details. 00015 00016 You should have received a copy of the GNU General Public License 00017 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00018 00019 #ifndef I386_CPUID_COMMON_H 00020 #define I386_CPUID_COMMON_H 00021 00022 /* Always include the header for the cpu bit defines. */ 00023 #include "i386-gcc-cpuid.h" 00024 00025 #if defined(__i386__) || defined(__x86_64__) 00026 00027 /* Return cpuid data for requested cpuid level, as found in returned 00028 eax, ebx, ecx and edx registers. The function checks if cpuid is 00029 supported and returns 1 for valid cpuid information or 0 for 00030 unsupported cpuid level. Pointers may be non-null. */ 00031 00032 static __inline int 00033 i386_cpuid (unsigned int __level, 00034 unsigned int *__eax, unsigned int *__ebx, 00035 unsigned int *__ecx, unsigned int *__edx) 00036 { 00037 unsigned int __scratch; 00038 00039 if (!__eax) 00040 __eax = &__scratch; 00041 if (!__ebx) 00042 __ebx = &__scratch; 00043 if (!__ecx) 00044 __ecx = &__scratch; 00045 if (!__edx) 00046 __edx = &__scratch; 00047 00048 return __get_cpuid (__level, __eax, __ebx, __ecx, __edx); 00049 } 00050 00051 #else 00052 00053 static __inline int 00054 i386_cpuid (unsigned int __level, 00055 unsigned int *__eax, unsigned int *__ebx, 00056 unsigned int *__ecx, unsigned int *__edx) 00057 { 00058 return 0; 00059 } 00060 00061 #endif /* i386 && x86_64 */ 00062 00063 #endif /* I386_CPUID_COMMON_H */