1 /* C API for x86 cpuid insn.
2 Copyright (C) 2007-2023 Free Software Foundation, Inc.
4 This file is part of GDB.
6 This file is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 #ifndef NAT_X86_CPUID_H
20 #define NAT_X86_CPUID_H
22 /* Always include the header for the cpu bit defines. */
23 #include "x86-gcc-cpuid.h"
26 /* This header file is also used in C code for some test-cases, so define
27 nullptr in C terms to avoid a compilation error. */
28 #define nullptr ((void *) 0)
31 /* Return cpuid data for requested cpuid level, as found in returned
32 eax, ebx, ecx and edx registers. The function checks if cpuid is
33 supported and returns 1 for valid cpuid information or 0 for
34 unsupported cpuid level. Pointers may be non-null. */
37 x86_cpuid (unsigned int __level
,
38 unsigned int *__eax
, unsigned int *__ebx
,
39 unsigned int *__ecx
, unsigned int *__edx
)
41 unsigned int __scratch
;
52 return __get_cpuid (__level
, __eax
, __ebx
, __ecx
, __edx
);
55 /* Return cpuid data for requested cpuid level and sub-level, as found
56 in returned eax, ebx, ecx and edx registers. The function checks
57 if cpuid is supported and returns 1 for valid cpuid information or
58 0 for unsupported cpuid level. Pointers may be non-null. */
61 x86_cpuid_count (unsigned int __level
, unsigned int __sublevel
,
62 unsigned int *__eax
, unsigned int *__ebx
,
63 unsigned int *__ecx
, unsigned int *__edx
)
65 unsigned int __scratch
;
76 return __get_cpuid_count (__level
, __sublevel
, __eax
, __ebx
, __ecx
, __edx
);
80 /* Avoid leaking this local definition beyond the scope of this header
85 #endif /* NAT_X86_CPUID_H */