mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/emul: Switch x86_emulate_ctxt to cpu_policy
As with struct domain, retain cpuid as a valid alias for local code clarity. Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
8eb56eb959
commit
441b1b2a50
9 files changed
+15
-12
No files matched your search
@@ -893,7 +893,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data_p, size_t size)
|
||||
struct x86_emulate_ctxt ctxt = {
|
||||
.data = &state,
|
||||
.regs = &input.regs,
|
||||
.cpuid = &cp,
|
||||
.cpu_policy = &cp,
|
||||
.addr_size = 8 * sizeof(void *),
|
||||
.sp_size = 8 * sizeof(void *),
|
||||
};
|
||||
|
||||
@@ -909,7 +909,7 @@ int main(int argc, char **argv)
|
||||
|
||||
ctxt.regs = ®s;
|
||||
ctxt.force_writeback = 0;
|
||||
ctxt.cpuid = &cp;
|
||||
ctxt.cpu_policy = &cp;
|
||||
ctxt.lma = sizeof(void *) == 8;
|
||||
ctxt.addr_size = 8 * sizeof(void *);
|
||||
ctxt.sp_size = 8 * sizeof(void *);
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
#endif
|
||||
|
||||
uint32_t mxcsr_mask = 0x0000ffbf;
|
||||
struct cpuid_policy cp;
|
||||
struct cpu_policy cp;
|
||||
|
||||
static char fpu_save_area[0x4000] __attribute__((__aligned__((64))));
|
||||
static bool use_xsave;
|
||||
|
||||
@@ -2771,7 +2771,7 @@ int hvm_emulate_one_mmio(unsigned long mfn, unsigned long gla)
|
||||
void hvm_emulate_one_vm_event(enum emul_kind kind, unsigned int trapnr,
|
||||
unsigned int errcode)
|
||||
{
|
||||
struct hvm_emulate_ctxt ctx = {{ 0 }};
|
||||
struct hvm_emulate_ctxt ctx = {};
|
||||
int rc;
|
||||
|
||||
hvm_emulate_init_once(&ctx, NULL, guest_cpu_user_regs());
|
||||
@@ -2846,7 +2846,7 @@ void hvm_emulate_init_once(
|
||||
|
||||
hvmemul_ctxt->validate = validate;
|
||||
hvmemul_ctxt->ctxt.regs = regs;
|
||||
hvmemul_ctxt->ctxt.cpuid = curr->domain->arch.cpuid;
|
||||
hvmemul_ctxt->ctxt.cpu_policy = curr->domain->arch.cpu_policy;
|
||||
hvmemul_ctxt->ctxt.force_writeback = true;
|
||||
}
|
||||
|
||||
|
||||
@@ -319,7 +319,7 @@ const struct x86_emulate_ops *shadow_init_emulation(
|
||||
memset(sh_ctxt, 0, sizeof(*sh_ctxt));
|
||||
|
||||
sh_ctxt->ctxt.regs = regs;
|
||||
sh_ctxt->ctxt.cpuid = curr->domain->arch.cpuid;
|
||||
sh_ctxt->ctxt.cpu_policy = curr->domain->arch.cpu_policy;
|
||||
sh_ctxt->ctxt.lma = hvm_long_mode_active(curr);
|
||||
|
||||
/* Segment cache initialisation. Primed with CS. */
|
||||
|
||||
@@ -1327,7 +1327,7 @@ int pv_emulate_privileged_op(struct cpu_user_regs *regs)
|
||||
struct domain *currd = curr->domain;
|
||||
struct priv_op_ctxt ctxt = {
|
||||
.ctxt.regs = regs,
|
||||
.ctxt.cpuid = currd->arch.cpuid,
|
||||
.ctxt.cpu_policy = currd->arch.cpu_policy,
|
||||
.ctxt.lma = !is_pv_32bit_domain(currd),
|
||||
};
|
||||
int rc;
|
||||
|
||||
@@ -356,7 +356,7 @@ int pv_ro_page_fault(unsigned long addr, struct cpu_user_regs *regs)
|
||||
unsigned int addr_size = is_pv_32bit_domain(currd) ? 32 : BITS_PER_LONG;
|
||||
struct x86_emulate_ctxt ctxt = {
|
||||
.regs = regs,
|
||||
.cpuid = currd->arch.cpuid,
|
||||
.cpu_policy = currd->arch.cpu_policy,
|
||||
.addr_size = addr_size,
|
||||
.sp_size = addr_size,
|
||||
.lma = addr_size > 32,
|
||||
|
||||
@@ -505,7 +505,7 @@ in_protmode(
|
||||
})
|
||||
|
||||
static inline bool
|
||||
_amd_like(const struct cpuid_policy *cp)
|
||||
_amd_like(const struct cpu_policy *cp)
|
||||
{
|
||||
return cp->x86_vendor & (X86_VENDOR_AMD | X86_VENDOR_HYGON);
|
||||
}
|
||||
@@ -513,7 +513,7 @@ _amd_like(const struct cpuid_policy *cp)
|
||||
static inline bool
|
||||
amd_like(const struct x86_emulate_ctxt *ctxt)
|
||||
{
|
||||
return _amd_like(ctxt->cpuid);
|
||||
return _amd_like(ctxt->cpu_policy);
|
||||
}
|
||||
|
||||
#define vcpu_has_fpu() (ctxt->cpuid->basic.fpu)
|
||||
|
||||
@@ -565,8 +565,11 @@ struct x86_emulate_ctxt
|
||||
* Input-only state:
|
||||
*/
|
||||
|
||||
/* CPUID Policy for the domain. */
|
||||
const struct cpuid_policy *cpuid;
|
||||
/* CPU policy for the domain. Allow aliases for local code clarity. */
|
||||
union {
|
||||
struct cpu_policy *cpu_policy;
|
||||
struct cpu_policy *cpuid;
|
||||
};
|
||||
|
||||
/* Set this if writes may have side effects. */
|
||||
bool force_writeback;
|
||||
|
||||