0

I wish I could emulate an Athlon XP or Pentium IV processor on an third-gen Intel Core. Is there a way to run a virtual machine that specifically disable a) newer cpu features like sse2 sse3? and b) cpu cache?

I'm using Qemu/KVM. The way I launch it only hides CPU intructions to the guest OS, whose applications still have access to the host machine's newer ones:

host

$ qemu-system-i386 -cpu pentium3,enforce (...) -enable-kvm

guest

$ inxi -f
CPU:       Single core Pentium III (Katmai) (-UP-) cache: 16384 KB speed: 3292 MHz (max)                
CPU Flags: apic cmov cx8 de fpu fxsr hypervisor mca mce mmx msr mtrr pae pge pse
           pse36 sep sse tsc x2apic

$ firefox   # v.54 which requires sse2;

Runs just fine, as do Palemoon and mpv which won't run on a cpu lacking sse2 like the Athlon XP (producing an 'Illegal instruction'). Meaning sse2 is definitively available to the guest OS. Only applications that check the CPUID do fail, e.g.:

$ chromium-browser                                                                                                       
# (...)
# Fatal error in ../../v8/src/ia32/assembler-ia32.cc, line 109                                      
# Check failed: cpu.has_sse2().                                                                     
#
#0 0x0000b40b9f0a base::debug::StackTrace::StackTrace()

Same thing happens when I run the VM with -cpu athlon,sse2=off. So while we can take reasonnable care of e.g. the number of core, the processor speed (using cpulimit) or the I/O capabilities (with qemu's throttle parameter), we can't limit the cpu instructions set available to the guest, can we?

2
  • 1
    If a program uses those extensions that your hiding it means they are required to run those applications
    – Ramhound
    Jul 14, 2017 at 2:24
  • @Ramhound yeah that's the point. Disabling (unlike hiding) them in a vm would allow to detect any application requiring cpu features unsupported on the target cpus. And find alternatives (e.g. sse-only builds). As well as getting an idea of the applications behavior with a limited set of cpu instructions.
    – tuk0z
    Jul 14, 2017 at 12:11

1 Answer 1

0

You would have to skip usage of KVM and make QEMU emulate all instructions itself in order for the instructions to stop being available.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .