Skip to content

Commit

Permalink
ARM support fix attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
kernelwernel committed Mar 24, 2024
1 parent 23142af commit 2a0f54a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ The library is:
- Very easy to use, with only 5 functions in its public interface
- Very flexible, with total fine-grained control over which techniques get executed
- Cross-platform (Windows + MacOS + Linux)
- Compatible with ARM architecture
- Header-only
- Available with C++11 and above
- Features up to 70+ unique techniques
Expand Down
10 changes: 9 additions & 1 deletion src/vmaware.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,10 @@
#endif

#elif (LINUX)
#if (x86)
#include <cpuid.h>
#include <x86intrin.h>
#endif
#include <sys/stat.h>
#include <sys/statvfs.h>
#include <sys/ioctl.h>
Expand Down Expand Up @@ -411,6 +413,9 @@ struct VM {
const u32 a_leaf,
const u32 c_leaf = 0xFF // dummy value if not set manually
) {
#if (!x86)
return;
#endif
// may be unmodified for older 32-bit processors, clearing just in case
b = 0;
c = 0;
Expand All @@ -433,6 +438,9 @@ struct VM {
const u32 a_leaf,
const u32 c_leaf = 0xFF
) {
#if (!x86)
return;
#endif
// may be unmodified for older 32-bit processors, clearing just in case
x[1] = 0;
x[2] = 0;
Expand Down Expand Up @@ -1515,7 +1523,7 @@ struct VM {
}
}

for (u8 i = 0; i <= 0xFF; i++) {
for (u8 i = 0; i < 0xFF; ++i) {
cpu::cpuid(a, b, c, d, (cpu::leaf::hypervisor + i));
if ((a + b + c + d) != 0) {
return true;
Expand Down

0 comments on commit 2a0f54a

Please sign in to comment.