Skip to content

Commit d2d6216

Browse files
committed
fixed bochs technique
1 parent d25aca4 commit d2d6216

1 file changed

Lines changed: 20 additions & 4 deletions

File tree

src/vmaware.hpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,6 @@
4949
* }
5050
*/
5151

52-
#define __VMAWARE_DEBUG__ 1
53-
5452
#if (defined(_MSC_VER) || defined(_WIN32) || defined(_WIN64) || defined(__MINGW32__))
5553
#define MSVC 1
5654
#define LINUX 0
@@ -4430,14 +4428,31 @@ struct VM {
44304428
}
44314429

44324430
// technique 3: Check for absence of AMD easter egg for K7 and K8 CPUs
4433-
// note: QEMU may also have this but i'm not sure
4431+
/*
44344432
u32 unused, eax = 0;
44354433
cpu::cpuid(eax, unused, unused, unused, 1);
44364434
44374435
constexpr u8 AMD_K7 = 6;
44384436
constexpr u8 AMD_K8 = 15;
44394437
4440-
const u32 family = ((eax >> 8) & 0xF);
4438+
auto is_k7 = [](const u32 eax) -> bool {
4439+
const u32 family = (eax >> 8) & 0xF;
4440+
const u32 model = (eax >> 4) & 0xF;
4441+
const u32 extended_family = (eax >> 20) & 0xFF;
4442+
const u32 extended_model = (eax >> 16) & 0xF;
4443+
4444+
if (family == 6 && extended_family == 0) {
4445+
if (model == 1 || model == 2 || model == 3 || model == 4) {
4446+
return true;
4447+
}
4448+
}
4449+
4450+
return false;
4451+
};
4452+
4453+
auto is_k8 = [](const u32 eax) -> bool {
4454+
// TODO
4455+
};
44414456
44424457
if (family != AMD_K7 && family != AMD_K8) {
44434458
return false;
@@ -4450,6 +4465,7 @@ struct VM {
44504465
debug("BOCHS_CPU: technique 3 found");
44514466
return core::add(BOCHS);
44524467
}
4468+
*/
44534469
}
44544470

44554471
return false;

0 commit comments

Comments
 (0)