This will be used to simplify feature checking.
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
struct x86_emulate_ctxt ctxt = {
.data = &state,
.regs = &input.regs,
+ .cpuid = &cp,
.addr_size = 8 * sizeof(void *),
.sp_size = 8 * sizeof(void *),
};
ctxt.regs = ®s;
ctxt.force_writeback = 0;
- ctxt.vendor = X86_VENDOR_UNKNOWN;
+ ctxt.cpuid = &cp;
ctxt.lma = sizeof(void *) == 8;
ctxt.addr_size = 8 * sizeof(void *);
ctxt.sp_size = 8 * sizeof(void *);
hvmemul_ctxt->validate = validate;
hvmemul_ctxt->ctxt.regs = regs;
- hvmemul_ctxt->ctxt.vendor = curr->domain->arch.cpuid->x86_vendor;
+ hvmemul_ctxt->ctxt.cpuid = curr->domain->arch.cpuid;
hvmemul_ctxt->ctxt.force_writeback = true;
}
memset(sh_ctxt, 0, sizeof(*sh_ctxt));
sh_ctxt->ctxt.regs = regs;
- sh_ctxt->ctxt.vendor = v->domain->arch.cpuid->x86_vendor;
+ sh_ctxt->ctxt.cpuid = v->domain->arch.cpuid;
sh_ctxt->ctxt.lma = hvm_long_mode_active(v);
/* Segment cache initialisation. Primed with CS. */
struct domain *currd = curr->domain;
struct priv_op_ctxt ctxt = {
.ctxt.regs = regs,
- .ctxt.vendor = currd->arch.cpuid->x86_vendor,
+ .ctxt.cpuid = currd->arch.cpuid,
.ctxt.lma = !is_pv_32bit_domain(currd),
};
int rc;
unsigned int addr_size = is_pv_32bit_domain(currd) ? 32 : BITS_PER_LONG;
struct x86_emulate_ctxt ctxt = {
.regs = regs,
- .vendor = currd->arch.cpuid->x86_vendor,
+ .cpuid = currd->arch.cpuid,
.addr_size = addr_size,
.sp_size = addr_size,
.lma = addr_size > 32,
struct x86_emulate_ctxt *ctxt,
const struct x86_emulate_ops *ops)
{
+ const struct cpuid_policy *cp = ctxt->cpuid;
enum x86_segment sel_seg = (sel & 4) ? x86_seg_ldtr : x86_seg_gdtr;
struct { uint32_t a, b; } desc, desc_hi = {};
uint8_t dpl, rpl;
case x86_seg_tr:
goto raise_exn;
}
- if ( ctxt->vendor != X86_VENDOR_AMD || !ops->read_segment ||
+ if ( cp->x86_vendor != X86_VENDOR_AMD || !ops->read_segment ||
ops->read_segment(seg, sreg, ctxt) != X86EMUL_OKAY )
memset(sreg, 0, sizeof(*sreg));
else
*/
bool wide = desc.b & 0x1000
? false : (desc.b & 0xf00) != 0xc00 &&
- ctxt->vendor != X86_VENDOR_AMD
+ cp->x86_vendor != X86_VENDOR_AMD
? mode_64bit() : ctxt->lma;
if ( wide )
default:
return rc;
}
- if ( !mode_64bit() && ctxt->vendor == X86_VENDOR_AMD &&
+ if ( !mode_64bit() && cp->x86_vendor == X86_VENDOR_AMD &&
(desc.b & 0xf00) != 0xc00 )
desc_hi.b = desc_hi.a = 0;
if ( (desc_hi.b & 0x00001f00) ||
* Input-only state:
*/
- /* CPU vendor (X86_VENDOR_UNKNOWN for "don't care") */
- unsigned char vendor;
+ /* CPUID Policy for the domain. */
+ const struct cpuid_policy *cpuid;
/* Set this if writes may have side effects. */
bool force_writeback;