mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 10:40:03 +01:00
bitkeeper revision 1.1736 (42ba85d8Vh1WXA4F1eQpFRpsTyq1xg)
[PATCH] sysenter-msr.patch Handle MSR reads/writes to sysenter related MSRs. Signed-off-by: Xiaofeng Ling <xiaofeng.ling@intel.com> Signed-off-by: Chengyuan Li <chengyuan.li@intel.com> Signed-off-by: Arun Sharma <arun.sharma@intel.com>
This commit is contained in:
1 parent
18dc46379c
commit
d79fbdeea9
1 file changed
+43
-5
+43
-5
@@ -1009,8 +1009,23 @@ static inline void vmx_do_msr_read(struct cpu_user_regs *regs)
|
||||
VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_read: ecx=%lx, eax=%lx, edx=%lx",
|
||||
(unsigned long)regs->ecx, (unsigned long)regs->eax,
|
||||
(unsigned long)regs->edx);
|
||||
|
||||
rdmsr(regs->ecx, regs->eax, regs->edx);
|
||||
switch (regs->ecx) {
|
||||
case MSR_IA32_SYSENTER_CS:
|
||||
__vmread(GUEST_SYSENTER_CS, ®s->eax);
|
||||
regs->edx = 0;
|
||||
break;
|
||||
case MSR_IA32_SYSENTER_ESP:
|
||||
__vmread(GUEST_SYSENTER_ESP, ®s->eax);
|
||||
regs->edx = 0;
|
||||
break;
|
||||
case MSR_IA32_SYSENTER_EIP:
|
||||
__vmread(GUEST_SYSENTER_EIP, ®s->eax);
|
||||
regs->edx = 0;
|
||||
break;
|
||||
default:
|
||||
rdmsr(regs->ecx, regs->eax, regs->edx);
|
||||
break;
|
||||
}
|
||||
|
||||
VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_read returns: "
|
||||
"ecx=%lx, eax=%lx, edx=%lx",
|
||||
@@ -1018,6 +1033,31 @@ static inline void vmx_do_msr_read(struct cpu_user_regs *regs)
|
||||
(unsigned long)regs->edx);
|
||||
}
|
||||
|
||||
static inline void vmx_do_msr_write(struct cpu_user_regs *regs)
|
||||
{
|
||||
VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_write: ecx=%lx, eax=%lx, edx=%lx",
|
||||
(unsigned long)regs->ecx, (unsigned long)regs->eax,
|
||||
(unsigned long)regs->edx);
|
||||
switch (regs->ecx) {
|
||||
case MSR_IA32_SYSENTER_CS:
|
||||
__vmwrite(GUEST_SYSENTER_CS, regs->eax);
|
||||
break;
|
||||
case MSR_IA32_SYSENTER_ESP:
|
||||
__vmwrite(GUEST_SYSENTER_ESP, regs->eax);
|
||||
break;
|
||||
case MSR_IA32_SYSENTER_EIP:
|
||||
__vmwrite(GUEST_SYSENTER_EIP, regs->eax);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
VMX_DBG_LOG(DBG_LEVEL_1, "vmx_do_msr_write returns: "
|
||||
"ecx=%lx, eax=%lx, edx=%lx",
|
||||
(unsigned long)regs->ecx, (unsigned long)regs->eax,
|
||||
(unsigned long)regs->edx);
|
||||
}
|
||||
|
||||
/*
|
||||
* Need to use this exit to reschedule
|
||||
*/
|
||||
@@ -1332,9 +1372,7 @@ asmlinkage void vmx_vmexit_handler(struct cpu_user_regs regs)
|
||||
break;
|
||||
case EXIT_REASON_MSR_WRITE:
|
||||
__vmread(GUEST_RIP, &eip);
|
||||
VMX_DBG_LOG(DBG_LEVEL_1, "MSR_WRITE: eip=%lx, eax=%lx, edx=%lx",
|
||||
eip, (unsigned long)regs.eax, (unsigned long)regs.edx);
|
||||
/* just ignore this point */
|
||||
vmx_do_msr_write(®s);
|
||||
__get_instruction_length(inst_len);
|
||||
__update_guest_eip(inst_len);
|
||||
break;
|
||||
|
||||