@@ -1993,19 +1993,19 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
do_cp14_32(regs, hsr);
break;
case HSR_EC_CP14_DBG:
- if ( !is_32bit_domain(current->domain) )
- goto bad_trap;
+ BUG_ON(!psr_mode_is_32bit(regs->cpsr));
do_cp14_dbg(regs, hsr);
break;
case HSR_EC_CP:
- if ( !is_32bit_domain(current->domain) )
- goto bad_trap;
+ BUG_ON(!psr_mode_is_32bit(regs->cpsr));
do_cp(regs, hsr);
break;
case HSR_EC_SMC32:
- inject_undef32_exception(regs);
+ BUG_ON(!psr_mode_is_32bit(regs->cpsr));
+ inject_undef_exception(regs, hsr.len);
break;
case HSR_EC_HVC32:
+ BUG_ON(!psr_mode_is_32bit(regs->cpsr));
#ifndef NDEBUG
if ( (hsr.iss & 0xff00) == 0xff00 )
return do_debug_trap(regs, hsr.iss & 0x00ff);
@@ -2016,6 +2016,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
break;
#ifdef CONFIG_ARM_64
case HSR_EC_HVC64:
+ BUG_ON(psr_mode_is_32bit(regs->cpsr));
#ifndef NDEBUG
if ( (hsr.iss & 0xff00) == 0xff00 )
return do_debug_trap(regs, hsr.iss & 0x00ff);
@@ -2025,7 +2026,7 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
do_trap_hypercall(regs, ®s->x16, hsr.iss);
break;
case HSR_EC_SMC64:
- inject_undef64_exception(regs, hsr.len);
+ BUG_ON(psr_mode_is_32bit(regs->cpsr));
break;
case HSR_EC_SYSREG:
BUG_ON(psr_mode_is_32bit(regs->cpsr));
@@ -2040,7 +2041,6 @@ asmlinkage void do_trap_hypervisor(struct cpu_user_regs *regs)
do_trap_data_abort_guest(regs, hsr);
break;
default:
- bad_trap:
printk("Hypervisor Trap. HSR=0x%x EC=0x%x IL=%x Syndrome=0x%"PRIx32"\n",
hsr.bits, hsr.ec, hsr.len, hsr.iss);
do_unexpected_trap("Hypervisor", regs);
CP14 dbg and general CP register access are both handled with unconditional injection of #undef from their respective handlers, so allow these even from 32-bit userspace on a 64-bit kernel. SMC32 and HVC32 should only come from a guest in AArch32 mode and SMC64 and HVC64 should only come from a guest in AArch64 mode. Add appropriate BUG_ONs to all cases. After this bad_trap is no longer used. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> --- xen/arch/arm/traps.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)