|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v5 6/5] x86/hvm: Add a non-FEP path to the #UD handler
While the #UD handler is dead code when CONFIG_HVM_FEP is disabled it's
helpful to keep the function around. Reinject #UD in the non-FEP case so
DCE can remove the rest.
Signed-off-by: Alejandro Vallejo <alejandro.garciavallejo@xxxxxxx>
---
xen/arch/x86/hvm/hvm.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c
index 4c00cf4c4fe..0eaeb728382 100644
--- a/xen/arch/x86/hvm/hvm.c
+++ b/xen/arch/x86/hvm/hvm.c
@@ -3835,13 +3835,18 @@ int hvm_descriptor_access_intercept(uint64_t exit_info,
void hvm_ud_intercept(struct cpu_user_regs *regs)
{
struct vcpu *cur = current;
- bool should_emulate = false;
struct hvm_emulate_ctxt ctxt;
const struct segment_register *cs;
uint32_t walk;
unsigned long addr;
char sig[5]; /* ud2; .ascii "xen" */
+ if ( !opt_hvm_fep )
+ {
+ ASSERT_UNREACHABLE();
+ goto reinject;
+ }
+
hvm_emulate_init_once(&ctxt, NULL, regs);
cs = &ctxt.seg_reg[x86_seg_cs];
@@ -3863,20 +3868,15 @@ void hvm_ud_intercept(struct cpu_user_regs *regs)
regs->rip = (uint32_t)regs->rip;
add_taint(TAINT_HVM_FEP);
-
- should_emulate = true;
- }
-
- if ( !should_emulate )
- {
- hvm_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
- return;
}
+ else
+ goto reinject;
switch ( hvm_emulate_one(&ctxt, VIO_no_completion) )
{
case X86EMUL_UNHANDLEABLE:
case X86EMUL_UNIMPLEMENTED:
+ reinject:
hvm_inject_hw_exception(X86_EXC_UD, X86_EVENT_NO_EC);
break;
case X86EMUL_EXCEPTION:
--
2.43.0
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |