|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [RFC v1 1/7] x86/hvm: Move description into hvm_emulate_ctxt
This will be needed to split up hvm_emulate_one_insn().
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
---
xen/arch/x86/hvm/emulate.c | 4 +++-
xen/arch/x86/hvm/hvm.c | 2 +-
xen/arch/x86/hvm/io.c | 6 +++---
xen/arch/x86/hvm/ioreq.c | 2 +-
xen/arch/x86/hvm/svm/emulate.c | 4 ++--
xen/arch/x86/hvm/vmx/realmode.c | 2 +-
xen/arch/x86/include/asm/hvm/emulate.h | 2 ++
7 files changed, 13 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/hvm/emulate.c b/xen/arch/x86/hvm/emulate.c
index bb1bb03ac4e9..a96d7814f91c 100644
--- a/xen/arch/x86/hvm/emulate.c
+++ b/xen/arch/x86/hvm/emulate.c
@@ -2868,7 +2868,7 @@ void hvm_emulate_one_vm_event(enum emul_kind kind,
unsigned int trapnr,
struct hvm_emulate_ctxt ctx = {};
int rc;
- hvm_emulate_init_once(&ctx, NULL, guest_cpu_user_regs());
+ hvm_emulate_init_once(&ctx, NULL, NULL, guest_cpu_user_regs());
switch ( kind )
{
@@ -2929,6 +2929,7 @@ void hvm_emulate_one_vm_event(enum emul_kind kind,
unsigned int trapnr,
void hvm_emulate_init_once(
struct hvm_emulate_ctxt *hvmemul_ctxt,
hvm_emulate_validate_t *validate,
+ const char *descr,
struct cpu_user_regs *regs)
{
struct vcpu *curr = current;
@@ -2941,6 +2942,7 @@ void hvm_emulate_init_once(
hvmemul_get_seg_reg(x86_seg_ss, hvmemul_ctxt);
hvmemul_ctxt->validate = validate;
+ hvmemul_ctxt->descr = descr;
hvmemul_ctxt->ctxt.regs = regs;
hvmemul_ctxt->ctxt.cpu_policy = curr->domain->arch.cpu_policy;
hvmemul_ctxt->ctxt.force_writeback = true;
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index f759a397c557..de399bd9024a 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3835,7 +3835,7 @@ void hvm_ud_intercept(struct cpu_user_regs *regs)
bool should_emulate = false;
struct hvm_emulate_ctxt ctxt;
- hvm_emulate_init_once(&ctxt, NULL, regs);
+ hvm_emulate_init_once(&ctxt, NULL, NULL, regs);
if ( opt_hvm_fep )
{
diff --git a/xen/arch/x86/hvm/io.c b/xen/arch/x86/hvm/io.c
index 23a5ea0e6197..d9838c36d330 100644
--- a/xen/arch/x86/hvm/io.c
+++ b/xen/arch/x86/hvm/io.c
@@ -55,16 +55,16 @@ bool hvm_emulate_one_insn(hvm_emulate_validate_t *validate,
const char *descr)
struct hvm_emulate_ctxt ctxt;
int rc;
- hvm_emulate_init_once(&ctxt, validate, guest_cpu_user_regs());
+ hvm_emulate_init_once(&ctxt, validate, descr, guest_cpu_user_regs());
switch ( rc = hvm_emulate_one(&ctxt, VIO_no_completion) )
{
case X86EMUL_UNHANDLEABLE:
- hvm_dump_emulation_state(XENLOG_G_WARNING, descr, &ctxt, rc);
+ hvm_dump_emulation_state(XENLOG_G_WARNING, ctxt.descr, &ctxt, rc);
return false;
case X86EMUL_UNRECOGNIZED:
- hvm_dump_emulation_state(XENLOG_G_WARNING, descr, &ctxt, rc);
+ hvm_dump_emulation_state(XENLOG_G_WARNING, ctxt.descr, &ctxt, rc);
hvm_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
break;
diff --git a/xen/arch/x86/hvm/ioreq.c b/xen/arch/x86/hvm/ioreq.c
index a5fa97e149ba..42ff796c6cb9 100644
--- a/xen/arch/x86/hvm/ioreq.c
+++ b/xen/arch/x86/hvm/ioreq.c
@@ -39,7 +39,7 @@ bool arch_vcpu_ioreq_completion(enum vio_completion
completion)
{
struct hvm_emulate_ctxt ctxt;
- hvm_emulate_init_once(&ctxt, NULL, guest_cpu_user_regs());
+ hvm_emulate_init_once(&ctxt, NULL, NULL, guest_cpu_user_regs());
vmx_realmode_emulate_one(&ctxt);
hvm_emulate_writeback(&ctxt);
diff --git a/xen/arch/x86/hvm/svm/emulate.c b/xen/arch/x86/hvm/svm/emulate.c
index 1f5436c8ea5d..1dd830a31bd7 100644
--- a/xen/arch/x86/hvm/svm/emulate.c
+++ b/xen/arch/x86/hvm/svm/emulate.c
@@ -71,7 +71,7 @@ unsigned int svm_get_insn_len(struct vcpu *v, unsigned int
instr_enc)
#endif
ASSERT(v == current);
- hvm_emulate_init_once(&ctxt, NULL, guest_cpu_user_regs());
+ hvm_emulate_init_once(&ctxt, NULL, NULL, guest_cpu_user_regs());
hvm_emulate_init_per_insn(&ctxt, NULL, 0);
state = x86_decode_insn(&ctxt.ctxt, hvmemul_insn_fetch);
if ( IS_ERR_OR_NULL(state) )
@@ -116,7 +116,7 @@ unsigned int svm_get_task_switch_insn_len(void)
struct x86_emulate_state *state;
unsigned int emul_len, modrm_reg;
- hvm_emulate_init_once(&ctxt, NULL, guest_cpu_user_regs());
+ hvm_emulate_init_once(&ctxt, NULL, NULL, guest_cpu_user_regs());
hvm_emulate_init_per_insn(&ctxt, NULL, 0);
state = x86_decode_insn(&ctxt.ctxt, hvmemul_insn_fetch);
if ( IS_ERR_OR_NULL(state) )
diff --git a/xen/arch/x86/hvm/vmx/realmode.c b/xen/arch/x86/hvm/vmx/realmode.c
index ff44ddcfa627..9879533280d0 100644
--- a/xen/arch/x86/hvm/vmx/realmode.c
+++ b/xen/arch/x86/hvm/vmx/realmode.c
@@ -163,7 +163,7 @@ void vmx_realmode(struct cpu_user_regs *regs)
if ( intr_info & INTR_INFO_VALID_MASK )
__vmwrite(VM_ENTRY_INTR_INFO, 0);
- hvm_emulate_init_once(&hvmemul_ctxt, NULL, regs);
+ hvm_emulate_init_once(&hvmemul_ctxt, NULL, NULL, regs);
/* Only deliver interrupts into emulated real mode. */
if ( !(curr->arch.hvm.guest_cr[0] & X86_CR0_PE) &&
diff --git a/xen/arch/x86/include/asm/hvm/emulate.h
b/xen/arch/x86/include/asm/hvm/emulate.h
index 178ac32e151f..2801d14d5455 100644
--- a/xen/arch/x86/include/asm/hvm/emulate.h
+++ b/xen/arch/x86/include/asm/hvm/emulate.h
@@ -30,6 +30,7 @@ struct hvm_emulate_ctxt {
* filtering.
*/
hvm_emulate_validate_t *validate;
+ const char *descr;
/* Cache of 16 bytes of instruction. */
uint8_t insn_buf[16];
@@ -74,6 +75,7 @@ void hvm_emulate_one_vm_event(enum emul_kind kind,
void hvm_emulate_init_once(
struct hvm_emulate_ctxt *hvmemul_ctxt,
hvm_emulate_validate_t *validate,
+ const char *descr,
struct cpu_user_regs *regs);
/* Must be called once before each instruction emulated. */
void hvm_emulate_init_per_insn(
--
2.53.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |