github.com/goccy/go-jit@v0.0.0-20200514131505-ff78d45cf6af/internal/ccall/jit-cpuid-x86.h (about)

     1  /*
     2   * jit-cpuid-x86.h - Wrapper for the CPUID instruction.
     3   *
     4   * Copyright (C) 2004  Southern Storm Software, Pty Ltd.
     5   *
     6   * This file is part of the libjit library.
     7   *
     8   * The libjit library is free software: you can redistribute it and/or
     9   * modify it under the terms of the GNU Lesser General Public License
    10   * as published by the Free Software Foundation, either version 2.1 of
    11   * the License, or (at your option) any later version.
    12   *
    13   * The libjit library is distributed in the hope that it will be useful,
    14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
    15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    16   * Lesser General Public License for more details.
    17   *
    18   * You should have received a copy of the GNU Lesser General Public
    19   * License along with the libjit library.  If not, see
    20   * <http://www.gnu.org/licenses/>.
    21   */
    22  
    23  #ifndef	_JIT_CPUID_X86_H
    24  #define	_JIT_CPUID_X86_H
    25  
    26  #ifdef	__cplusplus
    27  extern	"C" {
    28  #endif
    29  
    30  /*
    31   * Structure that is used to return CPU identification information.
    32   */
    33  typedef struct
    34  {
    35  	unsigned int eax;
    36  	unsigned int ebx;
    37  	unsigned int ecx;
    38  	unsigned int edx;
    39  
    40  } jit_cpuid_x86_t;
    41  
    42  /*
    43   * Indexes for querying cpuid information.
    44   */
    45  #define	JIT_X86CPUID_FEATURES			1
    46  #define	JIT_X86CPUID_CACHE_TLB			2
    47  #define	JIT_X86CPUID_SERIAL_NUMBER		3
    48  
    49  /*
    50   * Feature information.
    51   */
    52  #define	JIT_X86FEATURE_FPU				0x00000001
    53  #define	JIT_X86FEATURE_VME				0x00000002
    54  #define	JIT_X86FEATURE_DE				0x00000004
    55  #define	JIT_X86FEATURE_PSE				0x00000008
    56  #define	JIT_X86FEATURE_TSC				0x00000010
    57  #define	JIT_X86FEATURE_MSR				0x00000020
    58  #define	JIT_X86FEATURE_PAE				0x00000040
    59  #define	JIT_X86FEATURE_MCE				0x00000080
    60  #define	JIT_X86FEATURE_CX8				0x00000100
    61  #define	JIT_X86FEATURE_APIC				0x00000200
    62  #define	JIT_X86FEATURE_RESERVED_1		0x00000400
    63  #define	JIT_X86FEATURE_SEP				0x00000800
    64  #define	JIT_X86FEATURE_MTRR				0x00001000
    65  #define	JIT_X86FEATURE_PGE				0x00002000
    66  #define	JIT_X86FEATURE_MCA				0x00004000
    67  #define	JIT_X86FEATURE_CMOV				0x00008000
    68  #define	JIT_X86FEATURE_PAT				0x00010000
    69  #define	JIT_X86FEATURE_PSE36			0x00020000
    70  #define	JIT_X86FEATURE_PSN				0x00040000
    71  #define	JIT_X86FEATURE_CLFSH			0x00080000
    72  #define	JIT_X86FEATURE_RESERVED_2		0x00100000
    73  #define	JIT_X86FEATURE_DS				0x00200000
    74  #define	JIT_X86FEATURE_ACPI				0x00400000
    75  #define	JIT_X86FEATURE_MMX				0x00800000
    76  #define	JIT_X86FEATURE_FXSR				0x01000000
    77  #define	JIT_X86FEATURE_SSE				0x02000000
    78  #define	JIT_X86FEATURE_SSE2				0x04000000
    79  #define	JIT_X86FEATURE_SS				0x08000000
    80  #define	JIT_X86FEATURE_RESERVED_3		0x10000000
    81  #define	JIT_X86FEATURE_TM				0x20000000
    82  #define	JIT_X86FEATURE_RESERVED_4		0x40000000
    83  #define	JIT_X86FEATURE_RESERVED_5		0x80000000
    84  
    85  /*
    86   * Get CPU identification information.  Returns zero if the requested
    87   * information is not available.
    88   */
    89  int _jit_cpuid_x86_get(unsigned int index, jit_cpuid_x86_t *info);
    90  
    91  /*
    92   * Determine if the CPU has a particular feature.
    93   */
    94  int _jit_cpuid_x86_has_feature(unsigned int feature);
    95  
    96  /*
    97   * Get the size of the CPU cache line, or zero if flushing is not required.
    98   */
    99  unsigned int _jit_cpuid_x86_line_size(void);
   100  
   101  #ifdef	__cplusplus
   102  };
   103  #endif
   104  
   105  #endif /* _JIT_CPUID_X86_H */