mirror of
https://github.com/anrieff/libcpuid
synced 2025-07-02 14:04:15 +00:00
Fix some line endings (make them consistent on each mixed-EOL file).
Sadly, there's no consistency for the whole project, but I don't want to mess with it now.
This commit is contained in:
parent
f7e6c6b274
commit
dcbee3517f
6 changed files with 32 additions and 32 deletions
|
@ -29,10 +29,10 @@
|
||||||
|
|
||||||
int cpuid_exists_by_eflags(void)
|
int cpuid_exists_by_eflags(void)
|
||||||
{
|
{
|
||||||
#if defined(PLATFORM_X64)
|
#if defined(PLATFORM_X64)
|
||||||
return 1; /* CPUID is always present on the x86_64 */
|
return 1; /* CPUID is always present on the x86_64 */
|
||||||
#elif defined(PLATFORM_X86)
|
#elif defined(PLATFORM_X86)
|
||||||
# if defined(COMPILER_GCC)
|
# if defined(COMPILER_GCC)
|
||||||
int result;
|
int result;
|
||||||
__asm __volatile(
|
__asm __volatile(
|
||||||
" pushfl\n"
|
" pushfl\n"
|
||||||
|
@ -50,7 +50,7 @@ int cpuid_exists_by_eflags(void)
|
||||||
: "=m"(result)
|
: "=m"(result)
|
||||||
: :"eax", "ecx", "memory");
|
: :"eax", "ecx", "memory");
|
||||||
return (result != 0);
|
return (result != 0);
|
||||||
# elif defined(COMPILER_MICROSOFT)
|
# elif defined(COMPILER_MICROSOFT)
|
||||||
int result;
|
int result;
|
||||||
__asm {
|
__asm {
|
||||||
pushfd
|
pushfd
|
||||||
|
@ -67,12 +67,12 @@ int cpuid_exists_by_eflags(void)
|
||||||
popfd
|
popfd
|
||||||
};
|
};
|
||||||
return (result != 0);
|
return (result != 0);
|
||||||
# else
|
# else
|
||||||
return 0;
|
return 0;
|
||||||
# endif /* COMPILER_MICROSOFT */
|
# endif /* COMPILER_MICROSOFT */
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif /* PLATFORM_X86 */
|
#endif /* PLATFORM_X86 */
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -81,12 +81,12 @@ int cpuid_exists_by_eflags(void)
|
||||||
*/
|
*/
|
||||||
void exec_cpuid(uint32_t *regs)
|
void exec_cpuid(uint32_t *regs)
|
||||||
{
|
{
|
||||||
#ifdef INLINE_ASM_SUPPORTED
|
#ifdef INLINE_ASM_SUPPORTED
|
||||||
#ifdef COMPILER_GCC
|
#ifdef COMPILER_GCC
|
||||||
# ifdef PLATFORM_X64
|
# ifdef PLATFORM_X64
|
||||||
__asm __volatile(
|
__asm __volatile(
|
||||||
" mov %0, %%rdi\n"
|
" mov %0, %%rdi\n"
|
||||||
|
|
||||||
" push %%rbx\n"
|
" push %%rbx\n"
|
||||||
" push %%rcx\n"
|
" push %%rcx\n"
|
||||||
" push %%rdx\n"
|
" push %%rdx\n"
|
||||||
|
@ -112,7 +112,7 @@ void exec_cpuid(uint32_t *regs)
|
||||||
# else
|
# else
|
||||||
__asm __volatile(
|
__asm __volatile(
|
||||||
" mov %0, %%edi\n"
|
" mov %0, %%edi\n"
|
||||||
|
|
||||||
" push %%ebx\n"
|
" push %%ebx\n"
|
||||||
" push %%ecx\n"
|
" push %%ecx\n"
|
||||||
" push %%edx\n"
|
" push %%edx\n"
|
||||||
|
@ -167,7 +167,7 @@ void exec_cpuid(uint32_t *regs)
|
||||||
# endif /* COMPILER_MICROSOFT */
|
# endif /* COMPILER_MICROSOFT */
|
||||||
#endif
|
#endif
|
||||||
#endif /* INLINE_ASSEMBLY_SUPPORTED */
|
#endif /* INLINE_ASSEMBLY_SUPPORTED */
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef INLINE_ASM_SUPPORTED
|
#ifdef INLINE_ASM_SUPPORTED
|
||||||
void cpu_rdtsc(uint64_t* result)
|
void cpu_rdtsc(uint64_t* result)
|
||||||
|
|
|
@ -28,21 +28,21 @@
|
||||||
#include "libcpuid.h"
|
#include "libcpuid.h"
|
||||||
|
|
||||||
/* Determine Compiler: */
|
/* Determine Compiler: */
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
# define COMPILER_MICROSOFT
|
# define COMPILER_MICROSOFT
|
||||||
#elif defined(__GNUC__)
|
#elif defined(__GNUC__)
|
||||||
# define COMPILER_GCC
|
# define COMPILER_GCC
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Determine Platform */
|
/* Determine Platform */
|
||||||
#if defined(__x86_64__) || defined(_M_AMD64)
|
#if defined(__x86_64__) || defined(_M_AMD64)
|
||||||
# define PLATFORM_X64
|
# define PLATFORM_X64
|
||||||
#elif defined(__i386__) || defined(_M_IX86)
|
#elif defined(__i386__) || defined(_M_IX86)
|
||||||
# define PLATFORM_X86
|
# define PLATFORM_X86
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Under Windows/AMD64 with MSVC, inline assembly isn't supported */
|
/* Under Windows/AMD64 with MSVC, inline assembly isn't supported */
|
||||||
#if (defined(COMPILER_GCC) && defined(PLATFORM_X64)) || defined(PLATFORM_X86)
|
#if (defined(COMPILER_GCC) && defined(PLATFORM_X64)) || defined(PLATFORM_X86)
|
||||||
# define INLINE_ASM_SUPPORTED
|
# define INLINE_ASM_SUPPORTED
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ RSC=rc.exe
|
||||||
# PROP Intermediate_Dir "Release"
|
# PROP Intermediate_Dir "Release"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c
|
||||||
# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D VERSION=\"0.2.1\" /YX /FD /c
|
# ADD CPP /nologo /MD /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D VERSION=\"0.2.1\" /YX /FD /c
|
||||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
@ -64,7 +64,7 @@ LIB32=link.exe -lib
|
||||||
# PROP Intermediate_Dir "Debug"
|
# PROP Intermediate_Dir "Debug"
|
||||||
# PROP Target_Dir ""
|
# PROP Target_Dir ""
|
||||||
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c
|
||||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D VERSION=\"0.2.1\" /YX /FD /GZ /c
|
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "_DEBUG" /D "WIN32" /D "_MBCS" /D "_LIB" /D VERSION=\"0.2.1\" /YX /FD /GZ /c
|
||||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||||
BSC32=bscmake.exe
|
BSC32=bscmake.exe
|
||||||
|
|
|
@ -51,15 +51,15 @@ typedef unsigned uint32_t;
|
||||||
typedef signed char int8_t;
|
typedef signed char int8_t;
|
||||||
typedef unsigned char uint8_t;
|
typedef unsigned char uint8_t;
|
||||||
typedef signed short int16_t;
|
typedef signed short int16_t;
|
||||||
typedef unsigned short uint16_t;
|
typedef unsigned short uint16_t;
|
||||||
#if (defined _MSC_VER) && (_MSC_VER <= 1300)
|
#if (defined _MSC_VER) && (_MSC_VER <= 1300)
|
||||||
/* MSVC 6.0: no long longs ... */
|
/* MSVC 6.0: no long longs ... */
|
||||||
typedef signed __int64 int64_t;
|
typedef signed __int64 int64_t;
|
||||||
typedef unsigned __int64 uint64_t;
|
typedef unsigned __int64 uint64_t;
|
||||||
#else
|
#else
|
||||||
/* all other sane compilers: */
|
/* all other sane compilers: */
|
||||||
typedef signed long long int64_t;
|
typedef signed long long int64_t;
|
||||||
typedef unsigned long long uint64_t;
|
typedef unsigned long long uint64_t;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
Optimization="0"
|
Optimization="0"
|
||||||
PreprocessorDefinitions="VERSION=\"0.2.1\""
|
PreprocessorDefinitions="VERSION=\"0.2.1\""
|
||||||
MinimalRebuild="TRUE"
|
MinimalRebuild="TRUE"
|
||||||
BasicRuntimeChecks="3"
|
BasicRuntimeChecks="3"
|
||||||
RuntimeLibrary="3"
|
RuntimeLibrary="3"
|
||||||
|
@ -60,7 +60,7 @@
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions="VERSION=\"0.2.1\""
|
PreprocessorDefinitions="VERSION=\"0.2.1\""
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
|
@ -99,7 +99,7 @@
|
||||||
CharacterSet="2">
|
CharacterSet="2">
|
||||||
<Tool
|
<Tool
|
||||||
Name="VCCLCompilerTool"
|
Name="VCCLCompilerTool"
|
||||||
PreprocessorDefinitions="VERSION=\"0.2.1\""
|
PreprocessorDefinitions="VERSION=\"0.2.1\""
|
||||||
RuntimeLibrary="2"
|
RuntimeLibrary="2"
|
||||||
UsePrecompiledHeader="0"
|
UsePrecompiledHeader="0"
|
||||||
WarningLevel="3"
|
WarningLevel="3"
|
||||||
|
|
|
@ -109,8 +109,8 @@ int cpu_msr_driver_close(struct msr_driver_t* drv)
|
||||||
}
|
}
|
||||||
# endif /* __APPLE__ */
|
# endif /* __APPLE__ */
|
||||||
#else /* _WIN32 */
|
#else /* _WIN32 */
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <winioctl.h>
|
#include <winioctl.h>
|
||||||
#include <winerror.h>
|
#include <winerror.h>
|
||||||
|
|
||||||
extern uint8_t cc_x86driver_code[];
|
extern uint8_t cc_x86driver_code[];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue