mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86: make PV hypercall entry points work with !CONFIG_PV
We want Xen to crash if we hit these paths when PV is disabled.
For syscall, we provide stubs for {l,c}star_enter which end up calling
panic. For sysenter, we initialise CS to 0 so that #GP can be raised.
Signed-off-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
20c076d13b
commit
02cd416985
2 files changed
+20
-4
No files matched your search
@@ -1160,8 +1160,9 @@ static int construct_vmcs(struct vcpu *v)
|
||||
__vmwrite(HOST_RIP, (unsigned long)vmx_asm_vmexit_handler);
|
||||
|
||||
/* Host SYSENTER CS:RIP. */
|
||||
__vmwrite(HOST_SYSENTER_CS, __HYPERVISOR_CS);
|
||||
__vmwrite(HOST_SYSENTER_EIP, (unsigned long)sysenter_entry);
|
||||
__vmwrite(HOST_SYSENTER_CS, IS_ENABLED(CONFIG_PV) ? __HYPERVISOR_CS : 0);
|
||||
__vmwrite(HOST_SYSENTER_EIP,
|
||||
IS_ENABLED(CONFIG_PV) ? (unsigned long)sysenter_entry : 0);
|
||||
|
||||
/* MSR intercepts. */
|
||||
__vmwrite(VM_EXIT_MSR_LOAD_COUNT, 0);
|
||||
|
||||
@@ -298,8 +298,21 @@ static unsigned int write_stub_trampoline(
|
||||
}
|
||||
|
||||
DEFINE_PER_CPU(struct stubs, stubs);
|
||||
|
||||
#ifdef CONFIG_PV
|
||||
void lstar_enter(void);
|
||||
void cstar_enter(void);
|
||||
#else
|
||||
static inline void lstar_enter(void)
|
||||
{
|
||||
panic("%s called\n", __func__);
|
||||
}
|
||||
|
||||
static inline void cstar_enter(void)
|
||||
{
|
||||
panic("%s called\n", __func__);
|
||||
}
|
||||
#endif /* CONFIG_PV */
|
||||
|
||||
void subarch_percpu_traps_init(void)
|
||||
{
|
||||
@@ -329,8 +342,10 @@ void subarch_percpu_traps_init(void)
|
||||
{
|
||||
/* SYSENTER entry. */
|
||||
wrmsrl(MSR_IA32_SYSENTER_ESP, stack_bottom);
|
||||
wrmsrl(MSR_IA32_SYSENTER_EIP, (unsigned long)sysenter_entry);
|
||||
wrmsr(MSR_IA32_SYSENTER_CS, __HYPERVISOR_CS, 0);
|
||||
wrmsrl(MSR_IA32_SYSENTER_EIP,
|
||||
IS_ENABLED(CONFIG_PV) ? (unsigned long)sysenter_entry : 0);
|
||||
wrmsr(MSR_IA32_SYSENTER_CS,
|
||||
IS_ENABLED(CONFIG_PV) ? __HYPERVISOR_CS : 0, 0);
|
||||
}
|
||||
|
||||
/* Trampoline for SYSCALL entry from compatibility mode. */
|
||||
|
||||