x86 MTRR access dumping
PATCH 1/1 x86 MTRR access dumping
Some x86 BIOS and lots of x86 operating systems use MSRs not currently implemented in Qemu. The most notable unimplemented MSRs are the MTRRs (Memory Type Range Registers). This patch against latest svn dumps any accesses to unhandled MSRs and decodes the MTRR accesses.
I used this code to check MTRR accesses of coreboot (a replacement firmware for x86 BIOS) inside qemu and the patch works fine.
Of course, writing these MTRRs should be persistent, so their state needs to be saved somehow.
I thought I'd post my current code and ask for comments before I continue. Any comments on coding style, technical restrictions and other stuff are appreciated.
Regards,
Carl-Daniel
target-i386/cpu.h +17 -0
@@ -261,8 +261,25 @@#define MSR_IA32_PERF_STATUS 0x198 +#define MSR_MTRRphysBase (reg) (0x200 + 2 * (reg)) +#define MSR_MTRRphysMask (reg) (0x200 + 2 * (reg) + 1) + +#define MSR_MTRRfix64K_00000 0x250 +#define MSR_MTRRfix16K_80000 0x258 +#define MSR_MTRRfix16K_A0000 0x259 +#define MSR_MTRRfix4K_C0000 0x268 +#define MSR_MTRRfix4K_C8000 0x269 +#define MSR_MTRRfix4K_D0000 0x26a +#define MSR_MTRRfix4K_D8000 0x26b +#define MSR_MTRRfix4K_E0000 0x26c +#define MSR_MTRRfix4K_E8000 0x26d +#define MSR_MTRRfix4K_F0000 0x26e +#define MSR_MTRRfix4K_F8000 0x26f +#define MSR_PAT 0x277 +#define MSR_MTRRdefType 0x2ff +#define MSR_EFER 0xc0000080#define MSR_EFER_SCE (1 << 0)
target-i386/op_helper.c +130 -0
152 lines not on this page · raw message
Signature · 1 line
http://www.hailfinger.org/
Quoted 8 lines · Carl-Daniel Hailfinger
Some x86 BIOS and lots of x86 operating systems use MSRs not currently implemented in Qemu. The most notable unimplemented MSRs are the MTRRs (Memory Type Range Registers). This patch against latest svn dumps any accesses to unhandled MSRs and decodes the MTRR accesses.
I used this code to check MTRR accesses of coreboot (a replacement firmware for x86 BIOS) inside qemu and the patch works fine.
Quoted 7 lines
Of course, writing these MTRRs should be persistent, so their state needs to be saved somehow.
I thought I'd post my current code and ask for comments before I continue. Any comments on coding style, technical restrictions and other stuff are appreciated.
Sample output from a recent ReactOS boot:
Unhandled MSR 0x0000008b was written: 0x0000000000000000 Unhandled MSR 0x0000008b was read
Regards,
Carl-Daniel
Signature · 1 line
http://www.hailfinger.org/