mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86emul: support SWAPGS
Signed-off-by: Jan Beulich <jbeulich@suse.com> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
58be9af4f1
commit
6eb43fcf8a
1 file changed
+22
@@ -5019,6 +5019,28 @@ x86_emulate(
|
||||
goto done;
|
||||
break;
|
||||
|
||||
case 0xf8: /* swapgs */
|
||||
generate_exception_if(!mode_64bit(), EXC_UD);
|
||||
generate_exception_if(!mode_ring0(), EXC_GP, 0);
|
||||
fail_if(!ops->read_segment || !ops->read_msr ||
|
||||
!ops->write_segment || !ops->write_msr);
|
||||
if ( (rc = ops->read_segment(x86_seg_gs, &sreg,
|
||||
ctxt)) != X86EMUL_OKAY ||
|
||||
(rc = ops->read_msr(MSR_SHADOW_GS_BASE, &msr_val,
|
||||
ctxt)) != X86EMUL_OKAY ||
|
||||
(rc = ops->write_msr(MSR_SHADOW_GS_BASE, sreg.base,
|
||||
ctxt)) != X86EMUL_OKAY )
|
||||
goto done;
|
||||
sreg.base = msr_val;
|
||||
if ( (rc = ops->write_segment(x86_seg_gs, &sreg,
|
||||
ctxt)) != X86EMUL_OKAY )
|
||||
{
|
||||
/* Best effort unwind (i.e. no error checking). */
|
||||
ops->write_msr(MSR_SHADOW_GS_BASE, msr_val, ctxt);
|
||||
goto done;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0xf9: /* rdtscp */
|
||||
fail_if(ops->read_msr == NULL);
|
||||
if ( (rc = ops->read_msr(MSR_TSC_AUX,
|
||||
|
||||