From: Jan Beulich Date: Wed, 14 Dec 2016 08:54:35 +0000 (+0100) Subject: x86/PV: prefer pv_inject_hw_exception() X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~3153 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=6cf995f1f59240532e27cb788a390185f4276d6f;p=xen.git x86/PV: prefer pv_inject_hw_exception() ... over editing the error code and calling do_guest_trap(). Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper --- diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c index 0ee9886172..2d79ee08bd 100644 --- a/xen/arch/x86/traps.c +++ b/xen/arch/x86/traps.c @@ -3629,20 +3629,17 @@ static void emulate_gate_op(struct cpu_user_regs *regs) ((ar >> 13) & 3) > (regs->cs & 3) : ((ar >> 13) & 3) != (regs->cs & 3)) ) { - regs->error_code = sel; - do_guest_trap(TRAP_gp_fault, regs); + pv_inject_hw_exception(TRAP_gp_fault, sel); return; } if ( !(ar & _SEGMENT_P) ) { - regs->error_code = sel; - do_guest_trap(TRAP_no_segment, regs); + pv_inject_hw_exception(TRAP_no_segment, sel); return; } if ( off > limit ) { - regs->error_code = 0; - do_guest_trap(TRAP_gp_fault, regs); + pv_inject_hw_exception(TRAP_gp_fault, 0); return; } @@ -3681,15 +3678,13 @@ static void emulate_gate_op(struct cpu_user_regs *regs) (ar & _SEGMENT_CODE) || !(ar & _SEGMENT_WR) ) { - regs->error_code = ss & ~3; - do_guest_trap(TRAP_invalid_tss, regs); + pv_inject_hw_exception(TRAP_invalid_tss, ss & ~3); return; } if ( !(ar & _SEGMENT_P) || !check_stack_limit(ar, limit, esp, (4 + nparm) * 4) ) { - regs->error_code = ss & ~3; - do_guest_trap(TRAP_stack_error, regs); + pv_inject_hw_exception(TRAP_stack_error, ss & ~3); return; } stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp); @@ -3745,8 +3740,7 @@ static void emulate_gate_op(struct cpu_user_regs *regs) } if ( !check_stack_limit(ar, limit, esp, 2 * 4) ) { - regs->error_code = 0; - do_guest_trap(TRAP_stack_error, regs); + pv_inject_hw_exception(TRAP_stack_error, 0); return; } stkp = (unsigned int *)(unsigned long)((unsigned int)base + esp);