[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v2 2/4] x86/setup: Intoduce XEN_MSR_STAR
Xen's choice of the MSR_STAR value is constant across all pcpus. Introduce a new define and use it to avoid the opencoding in subarch_percpu_traps_init() and restore_rest_processor_state(). Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- CC: Jan Beulich <JBeulich@xxxxxxxx> v2: * Drop all the adjustments to MSR_CSTAR --- xen/arch/x86/acpi/suspend.c | 4 ++-- xen/arch/x86/x86_64/traps.c | 4 ++-- xen/include/asm-x86/processor.h | 3 +++ 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/acpi/suspend.c b/xen/arch/x86/acpi/suspend.c index d5c67ee..0dba3e5 100644 --- a/xen/arch/x86/acpi/suspend.c +++ b/xen/arch/x86/acpi/suspend.c @@ -54,8 +54,8 @@ void restore_rest_processor_state(void) /* Recover syscall MSRs */ wrmsrl(MSR_LSTAR, saved_lstar); wrmsrl(MSR_CSTAR, saved_cstar); - wrmsr(MSR_STAR, 0, (FLAT_RING3_CS32<<16) | __HYPERVISOR_CS); - wrmsr(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK, 0U); + wrmsrl(MSR_STAR, XEN_MSR_STAR); + wrmsrl(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK); wrfsbase(saved_fs_base); wrgsbase(saved_gs_base); diff --git a/xen/arch/x86/x86_64/traps.c b/xen/arch/x86/x86_64/traps.c index fc8cde6..252d2d0 100644 --- a/xen/arch/x86/x86_64/traps.c +++ b/xen/arch/x86/x86_64/traps.c @@ -415,8 +415,8 @@ void subarch_percpu_traps_init(void) unmap_domain_page(stub_page); /* Common SYSCALL parameters. */ - wrmsr(MSR_STAR, 0, ((unsigned int)FLAT_RING3_CS32 << 16) | __HYPERVISOR_CS); - wrmsr(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK, 0U); + wrmsrl(MSR_STAR, XEN_MSR_STAR); + wrmsrl(MSR_SYSCALL_MASK, XEN_SYSCALL_MASK); } void init_int80_direct_trap(struct vcpu *v) diff --git a/xen/include/asm-x86/processor.h b/xen/include/asm-x86/processor.h index 7735bc2..843f072 100644 --- a/xen/include/asm-x86/processor.h +++ b/xen/include/asm-x86/processor.h @@ -87,6 +87,9 @@ #define XEN_CR4_PV32_BITS (X86_CR4_SMEP|X86_CR4_SMAP) +/* Common SYSCALL parameters. */ +#define XEN_MSR_STAR (((uint64_t)FLAT_RING3_CS32 << 48) | \ + ((uint64_t)__HYPERVISOR_CS << 32)) #define XEN_SYSCALL_MASK (X86_EFLAGS_AC|X86_EFLAGS_VM|X86_EFLAGS_RF| \ X86_EFLAGS_NT|X86_EFLAGS_DF|X86_EFLAGS_IF| \ X86_EFLAGS_TF) -- 2.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |