This patch series adds configuration options allowing CPU definitions to support rdmsr on arbitrary MSRs with corresponding values, and to GPF on unknown MSRs. This allows better emulation of CPU-specific behavior. I plan to use this to allow testing many of the CPU-specific tests in BITS (http://biosbits.org/) via qemu/kvm rather than always via real systems with the CPUs in question.
I've attached a sample configuration file for these new options, created by copying the "Nehalem" CPU definition from the standard configuration file and adding "NehalemGPF" and "NehalemMSR" definitions which take advantage of the first and the first two patches, respectively. This sample configuration makes it easy to validate the behavior added by the first two patches. I used a QDict to store the map from MSR numbers to values. Unfortunately, QDict only supports strings as keys, so I had to format the MSR as a hex string before looking it up. The third patch in the series provides a bugfix for CPU definition parsing, which will otherwise add a partial CPU definition (up to the parse failure) to the list of CPU definitions. Written on the plane to linux.conf.au. Josh Triplett (3): Add cpudef option to GPF on unknown MSRs Support arbitrary additional MSRs in cpu definitions Handle parse failures in CPU definitions, and avoid adding a partial cpudef qemu-config.c | 6 ++++ target-i386/cpu.h | 6 ++++ target-i386/cpuid.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++- target-i386/op_helper.c | 36 +++++++++++++++++++++++++--- 4 files changed, 102 insertions(+), 5 deletions(-) -- 1.7.8.3