[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [patch] Thumb syscalls
From: |
Paul Brook |
Subject: |
[Qemu-devel] [patch] Thumb syscalls |
Date: |
Tue, 26 Apr 2005 23:49:36 +0100 |
User-agent: |
KMail/1.7.2 |
The attached patch implements syscalls when in thumb mode.
Paul
Index: linux-user/main.c
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/main.c,v
retrieving revision 1.65
diff -u -p -r1.65 main.c
--- linux-user/main.c 23 Apr 2005 18:25:40 -0000 1.65
+++ linux-user/main.c 26 Apr 2005 22:47:04 -0000
@@ -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],
Index: linux-user/arm/syscall.h
===================================================================
RCS file: /cvsroot/qemu/qemu/linux-user/arm/syscall.h,v
retrieving revision 1.5
diff -u -p -r1.5 syscall.h
--- linux-user/arm/syscall.h 23 Apr 2005 18:25:41 -0000 1.5
+++ linux-user/arm/syscall.h 26 Apr 2005 22:47:04 -0000
@@ -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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Qemu-devel] [patch] Thumb syscalls,
Paul Brook <=