diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-04-27 20:11:21 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-04-27 20:11:21 +0000 |
commit | 192c7bd92722d0d4a55cc9ed59b642e0aaf0d5c8 (patch) | |
tree | 1f03d9b11b1cd7db8fe28ede0ba572259800b90b | |
parent | b48a8bb6b17e7e53527b8acfefdc034ec09717fe (diff) |
ARM Thumb syscalls (Paul Brook)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1415 c046a42c-6fe2-441c-8c8c-71466251a162
-rw-r--r-- | linux-user/arm/syscall.h | 1 | ||||
-rw-r--r-- | linux-user/main.c | 19 |
2 files changed, 16 insertions, 4 deletions
diff --git a/linux-user/arm/syscall.h b/linux-user/arm/syscall.h index daf4b34af8..1d508f0a3f 100644 --- a/linux-user/arm/syscall.h +++ b/linux-user/arm/syscall.h @@ -26,6 +26,7 @@ struct target_pt_regs { #define ARM_ORIG_r0 uregs[17] #define ARM_SYSCALL_BASE 0x900000 +#define ARM_THUMB_SYSCALL 0 #define ARM_NR_cacheflush (ARM_SYSCALL_BASE + 0xf0000 + 2) diff --git a/linux-user/main.c b/linux-user/main.c index bcdf8441b8..d0f662c07d 100644 --- a/linux-user/main.c +++ b/linux-user/main.c @@ -359,16 +359,27 @@ void cpu_loop(CPUARMState *env) case EXCP_SWI: { /* system call */ - insn = ldl((void *)(env->regs[15] - 4)); - n = insn & 0xffffff; + if (env->thumb) { + insn = lduw((void *)(env->regs[15] - 2)); + n = insn & 0xff; + } else { + insn = ldl((void *)(env->regs[15] - 4)); + n = insn & 0xffffff; + } + if (n == ARM_NR_cacheflush) { arm_cache_flush(env->regs[0], env->regs[1]); } else if (n == ARM_NR_semihosting || n == ARM_NR_thumb_semihosting) { env->regs[0] = do_arm_semihosting (env); - } else if (n >= ARM_SYSCALL_BASE) { + } else if (n >= ARM_SYSCALL_BASE + || (env->thumb && n == ARM_THUMB_SYSCALL)) { /* linux syscall */ - n -= ARM_SYSCALL_BASE; + if (env->thumb) { + n = env->regs[7]; + } else { + n -= ARM_SYSCALL_BASE; + } env->regs[0] = do_syscall(env, n, env->regs[0], |