[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] x86: re-organize toggle_guest_*()
commit a890ea3be71eb6f52588217bd50685072ef818a8 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Jan 31 12:35:52 2018 +0100 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Jan 31 12:35:52 2018 +0100 x86: re-organize toggle_guest_*() toggle_guest_mode() is only ever being called for 64-bit PV vCPU-s - replace the 32-bit PV conditional by an ASSERT(). Introduce a local helper without 32-bit PV conditional, to be used by both pre-existing functions. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/arch/x86/pv/domain.c | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/xen/arch/x86/pv/domain.c b/xen/arch/x86/pv/domain.c index 74e9e66..2c784fb 100644 --- a/xen/arch/x86/pv/domain.c +++ b/xen/arch/x86/pv/domain.c @@ -220,28 +220,8 @@ int pv_domain_initialise(struct domain *d, unsigned int domcr_flags, return rc; } -void toggle_guest_mode(struct vcpu *v) +static void _toggle_guest_pt(struct vcpu *v) { - if ( is_pv_32bit_vcpu(v) ) - return; - - if ( cpu_has_fsgsbase ) - { - if ( v->arch.flags & TF_kernel_mode ) - v->arch.pv_vcpu.gs_base_kernel = __rdgsbase(); - else - v->arch.pv_vcpu.gs_base_user = __rdgsbase(); - } - asm volatile ( "swapgs" ); - - toggle_guest_pt(v); -} - -void toggle_guest_pt(struct vcpu *v) -{ - if ( is_pv_32bit_vcpu(v) ) - return; - v->arch.flags ^= TF_kernel_mode; update_cr3(v); /* Don't flush user global mappings from the TLB. Don't tick TLB clock. */ @@ -260,6 +240,28 @@ void toggle_guest_pt(struct vcpu *v) v->arch.pv_vcpu.pending_system_time.version = 0; } +void toggle_guest_mode(struct vcpu *v) +{ + ASSERT(!is_pv_32bit_vcpu(v)); + + if ( cpu_has_fsgsbase ) + { + if ( v->arch.flags & TF_kernel_mode ) + v->arch.pv_vcpu.gs_base_kernel = __rdgsbase(); + else + v->arch.pv_vcpu.gs_base_user = __rdgsbase(); + } + asm volatile ( "swapgs" ); + + _toggle_guest_pt(v); +} + +void toggle_guest_pt(struct vcpu *v) +{ + if ( !is_pv_32bit_vcpu(v) ) + _toggle_guest_pt(v); +} + /* * Local variables: * mode: C -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |