Skip to content

Commit

Permalink
Refactor CPUID code
Browse files Browse the repository at this point in the history
  • Loading branch information
kimwalisch committed Jun 19, 2024
1 parent 27c6398 commit 588b68f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions include/cpuid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ inline void run_cpuid(int* eax, int* ebx, int* ecx, int* edx)
defined(__PIC__)

// in case of PIC under 32-bit EBX cannot be clobbered
__asm__ __volatile__ (
__asm__ (
"movl %%ebx, %%edi;"
"cpuid;"
"xchgl %%ebx, %%edi;"
Expand All @@ -45,12 +45,13 @@ inline void run_cpuid(int* eax, int* ebx, int* ecx, int* edx)

#else

__asm__ __volatile__ (
__asm__ (
"cpuid"
: "+a" (*eax),
"+b" (*ebx),
"+c" (*ecx),
: "=a" (*eax),
"=b" (*ebx),
"=c" (*ecx),
"=d" (*edx)
: "a" (*eax), "c" (*ecx)
);

#endif
Expand Down

0 comments on commit 588b68f

Please sign in to comment.