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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Andrew Cooper committed 2017-02-21 11:06:39 +00:00
1 parent 2f1add6e1c
commit 36b35babdf
3 files changed
+7 -4

No files matched your search

+2 -2
View File
@@ -53,8 +53,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);
+2 -2
View File
@@ -414,8 +414,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)
+3
View File
@@ -86,6 +86,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)
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.