From f1117fcf87966dfb5b1d9faf78496ba779975032 Mon Sep 17 00:00:00 2001 From: Michael Gernoth Date: Mon, 7 Dec 2015 02:06:07 +0100 Subject: arm/traps: get full DIV instruction in thumb mode Change-Id: Ie60d2124d7835e85f03008d3dfe259b70490b4f2 --- arch/arm/kernel/traps.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c index 56b2715..599ea93 100644 --- a/arch/arm/kernel/traps.c +++ b/arch/arm/kernel/traps.c @@ -365,6 +365,19 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs) if (call_undef_hook(regs, instr) == 0) return; + /* STARGO: hack for DIV emulation */ + if ((processor_mode(regs) != SVC_MODE) && thumb_mode(regs)) { + if ((instr & 0x0310) == 0x0310) { /* Retry for division */ + unsigned int instr2; + get_user(instr2, (u16 __user *)pc + 1); + instr <<= 16; + instr |= instr2; + if (call_undef_hook(regs, instr) == 0) + return; + } + } + /* END: STARGO: hack for DIV emulation */ + #ifdef CONFIG_DEBUG_USER if (user_debug & UDBG_UNDEFINED) { printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n", -- cgit v1.1