[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 21/21] linux-user: Handle compressed ISA encodings wh
From: |
riku . voipio |
Subject: |
[Qemu-devel] [PULL 21/21] linux-user: Handle compressed ISA encodings when processing MIPS exceptions |
Date: |
Tue, 23 Jul 2013 18:49:11 +0300 |
From: Kwok Cheung Yeung <address@hidden>
Decode trap instructions during the handling of an EXCP_BREAK or EXCP_TRAP
according to the current ISA mode.
Signed-off-by: Kwok Cheung Yeung <address@hidden>
Signed-off-by: Riku Voipio <address@hidden>
---
linux-user/main.c | 46 +++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 43 insertions(+), 3 deletions(-)
diff --git a/linux-user/main.c b/linux-user/main.c
index 547884c..441e31d 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -2310,7 +2310,31 @@ done_syscall:
abi_ulong trap_instr;
unsigned int code;
- ret = get_user_ual(trap_instr, env->active_tc.PC);
+ if (env->hflags & MIPS_HFLAG_M16) {
+ if (env->insn_flags & ASE_MICROMIPS) {
+ /* microMIPS mode */
+ abi_ulong instr[2];
+
+ ret = get_user_u16(instr[0], env->active_tc.PC) ||
+ get_user_u16(instr[1], env->active_tc.PC + 2);
+
+ trap_instr = (instr[0] << 16) | instr[1];
+ } else {
+ /* MIPS16e mode */
+ ret = get_user_u16(trap_instr, env->active_tc.PC);
+ if (ret != 0) {
+ goto error;
+ }
+ code = (trap_instr >> 6) & 0x3f;
+ if (do_break(env, &info, code) != 0) {
+ goto error;
+ }
+ break;
+ }
+ } else {
+ ret = get_user_ual(trap_instr, env->active_tc.PC);
+ }
+
if (ret != 0) {
goto error;
}
@@ -2334,14 +2358,30 @@ done_syscall:
abi_ulong trap_instr;
unsigned int code = 0;
- ret = get_user_ual(trap_instr, env->active_tc.PC);
+ if (env->hflags & MIPS_HFLAG_M16) {
+ /* microMIPS mode */
+ abi_ulong instr[2];
+
+ ret = get_user_u16(instr[0], env->active_tc.PC) ||
+ get_user_u16(instr[1], env->active_tc.PC + 2);
+
+ trap_instr = (instr[0] << 16) | instr[1];
+ } else {
+ ret = get_user_ual(trap_instr, env->active_tc.PC);
+ }
+
if (ret != 0) {
goto error;
}
/* 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.1.2
- [Qemu-devel] [PULL 08/21] linux-user: Enable NPTL for m68k, (continued)
- [Qemu-devel] [PULL 08/21] linux-user: Enable NPTL for m68k, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 09/21] linux-user: Add missing 'break' in i386 get_thread_area syscall, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 18/21] linux-user: Fix epoll on ARM hosts, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 07/21] linux-user: Enable NPTL for SPARC targets, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 10/21] linux-user: Clean up handling of clone() argument order, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 14/21] linux-user: Avoid conditional cpu_reset(), riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 16/21] linux-user: Fix pipe syscall return for SPARC, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 11/21] linux-user: Add i386 TLS setter, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 13/21] configure: Make NPTL non-optional, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 20/21] linux-user: Unlock mmap_lock when resuming guest from page_unprotect, riku . voipio, 2013/07/23
- [Qemu-devel] [PULL 21/21] linux-user: Handle compressed ISA encodings when processing MIPS exceptions,
riku . voipio <=
- [Qemu-devel] [PULL 19/21] linux-user: Reset copied CPUs in cpu_copy() always, riku . voipio, 2013/07/23