From: Peter Dinda Date: Tue, 26 Nov 2013 01:35:07 +0000 (-0600) Subject: Allow strict MSR semantics X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=99578627551cadf5f5c5b60b9700c4a1272d38f6 Allow strict MSR semantics When enabled, reads/writes to MSRs we do not handle cause GPF to be injected. This is the architecturally specified reaction. When disabled, our more lenient behavior is used (read=0, write=ignored) --- diff --git a/palacios/src/palacios/vmm_msr.c b/palacios/src/palacios/vmm_msr.c index 0ed99ed..7331a59 100644 --- a/palacios/src/palacios/vmm_msr.c +++ b/palacios/src/palacios/vmm_msr.c @@ -110,15 +110,24 @@ int v3_handle_msr_read(struct guest_info * info) { int v3_msr_unhandled_read(struct guest_info * core, uint32_t msr, struct v3_msr * dst, void * priv_data) { V3_Print(core->vm_info, core, "Palacios: Unhandled MSR Read (MSR=0x%x) - returning zero\n", msr); +#ifdef V3_CONFIG_STRICT_MSR_SEMANTICS + v3_raise_exception(core,GPF_EXCEPTION); +#else dst->value = 0; - - // should produce GPF for unsupported msr +#endif + return 0; } int v3_msr_unhandled_write(struct guest_info * core, uint32_t msr, struct v3_msr src, void * priv_data) { V3_Print(core->vm_info, core, "Palacios: Unhandled MSR Write (MSR=0x%x) - ignored\n", msr); - // should produce GPF for unsupported msr + +#ifdef V3_CONFIG_STRICT_MSR_SEMANTICS + v3_raise_exception(core,GPF_EXCEPTION); +#else + // write ignored +#endif + return 0; }