Skip to content

Commit

Permalink
fix(core): swap ecx/edx registers when parsing CPUID (yvt#1052)
Browse files Browse the repository at this point in the history
Fixes corrupted output when reading a CPU vendor name.
  • Loading branch information
devnexen authored May 4, 2023
1 parent 3444084 commit f6f5108
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Sources/Core/CpuID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@ namespace spades {
{
auto ar = cpuid(0);
char buf[13];
buf[12] = 0;
maxStdLevel = ar[0];
memcpy(buf, ar.data() + 1, 12);
memcpy(&buf[0], &ar[1], 4);
memcpy(&buf[4], &ar[3], 4);
memcpy(&buf[8], &ar[2], 4);
buf[12] = 0;
vendor = buf;
}
{
Expand Down

0 comments on commit f6f5108

Please sign in to comment.