Decode trap instructions during the handling of a EXCP_TRAP according to
the current ISA mode.

Signed-off-by: Kwok Cheung Yeung <k...@codesourcery.com>
---
 linux-user/main.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/linux-user/main.c b/linux-user/main.c
index 7f15d3d..c417e26 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2379,7 +2379,10 @@ done_syscall:
 
                 /* The immediate versions don't provide a code.  */
                 if (!(trap_instr & 0xFC000000)) {
-                    code = ((trap_instr >> 6) & ((1 << 10) - 1));
+                    if (env->hflags & MIPS_HFLAG_M16)   /* microMIPS mode */
+                        code = ((trap_instr >> 12) & ((1 << 4) - 1));
+                    else
+                        code = ((trap_instr >> 6) & ((1 << 10) - 1));
                 }
 
                 if (do_break(env, &info, code) != 0) {
-- 
1.8.3.3


Reply via email to