The use of regs->?s here is buggy in almost all cases. For HVM guests,
they're poison from hvm_sanitize_regs_fields(), and for PV guests the data
segment selectors are stale from the last context switch.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
CC: Jan Beulich <JBeulich@suse.com>
CC: Roger Pau Monné <roger.pau@citrix.com>
I'm honestly not sure what this path is doing here. The only user of FPU
emulation is HVM guests, which has working read_segment().
if ( ops->read_segment &&
ops->read_segment(state->ea.mem.seg, &sreg,
ctxt) == X86EMUL_OKAY )
+ {
aux.ds = sreg.sel;
- else
- switch ( state->ea.mem.seg )
- {
- case x86_seg_cs: aux.ds = ctxt->regs->cs; break;
- case x86_seg_ds: aux.ds = ctxt->regs->ds; break;
- case x86_seg_es: aux.ds = ctxt->regs->es; break;
- case x86_seg_fs: aux.ds = ctxt->regs->fs; break;
- case x86_seg_gs: aux.ds = ctxt->regs->gs; break;
- case x86_seg_ss: aux.ds = ctxt->regs->ss; break;
- default: ASSERT_UNREACHABLE(); break;
- }
- aux.dval = true;
+ aux.dval = true;
+ }
}
ops->put_fpu(ctxt, X86EMUL_FPU_none, &aux);
}