mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86: move toggle_guest_mode to pv/domain.c
Signed-off-by: Wei Liu <wei.liu2@citrix.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
0142064421
commit
ffd13cd2b6
2 files changed
+31
-30
No files matched your search
@@ -213,6 +213,37 @@ int pv_domain_initialise(struct domain *d, unsigned int domcr_flags,
|
||||
return rc;
|
||||
}
|
||||
|
||||
void toggle_guest_mode(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();
|
||||
}
|
||||
v->arch.flags ^= TF_kernel_mode;
|
||||
asm volatile ( "swapgs" );
|
||||
update_cr3(v);
|
||||
/* Don't flush user global mappings from the TLB. Don't tick TLB clock. */
|
||||
asm volatile ( "mov %0, %%cr3" : : "r" (v->arch.cr3) : "memory" );
|
||||
|
||||
if ( !(v->arch.flags & TF_kernel_mode) )
|
||||
return;
|
||||
|
||||
if ( v->arch.pv_vcpu.need_update_runstate_area &&
|
||||
update_runstate_area(v) )
|
||||
v->arch.pv_vcpu.need_update_runstate_area = 0;
|
||||
|
||||
if ( v->arch.pv_vcpu.pending_system_time.version &&
|
||||
update_secondary_system_time(v,
|
||||
&v->arch.pv_vcpu.pending_system_time) )
|
||||
v->arch.pv_vcpu.pending_system_time.version = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Local variables:
|
||||
* mode: C
|
||||
|
||||
@@ -254,36 +254,6 @@ void do_double_fault(struct cpu_user_regs *regs)
|
||||
panic("DOUBLE FAULT -- system shutdown");
|
||||
}
|
||||
|
||||
void toggle_guest_mode(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();
|
||||
}
|
||||
v->arch.flags ^= TF_kernel_mode;
|
||||
asm volatile ( "swapgs" );
|
||||
update_cr3(v);
|
||||
/* Don't flush user global mappings from the TLB. Don't tick TLB clock. */
|
||||
asm volatile ( "mov %0, %%cr3" : : "r" (v->arch.cr3) : "memory" );
|
||||
|
||||
if ( !(v->arch.flags & TF_kernel_mode) )
|
||||
return;
|
||||
|
||||
if ( v->arch.pv_vcpu.need_update_runstate_area &&
|
||||
update_runstate_area(v) )
|
||||
v->arch.pv_vcpu.need_update_runstate_area = 0;
|
||||
|
||||
if ( v->arch.pv_vcpu.pending_system_time.version &&
|
||||
update_secondary_system_time(v,
|
||||
&v->arch.pv_vcpu.pending_system_time) )
|
||||
v->arch.pv_vcpu.pending_system_time.version = 0;
|
||||
}
|
||||
|
||||
unsigned long do_iret(void)
|
||||
{
|
||||
struct cpu_user_regs *regs = guest_cpu_user_regs();
|
||||
|
||||