qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [patch] Thumb syscalls
@ 2005-04-26 22:49 Paul Brook
  0 siblings, 0 replies; only message in thread
From: Paul Brook @ 2005-04-26 22:49 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 65 bytes --]

The attached patch implements syscalls when in thumb mode.

Paul

[-- Attachment #2: patch.qemu_thumb_syscall --]
[-- Type: text/x-diff, Size: 2232 bytes --]

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)
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-04-26 22:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-04-26 22:49 [Qemu-devel] [patch] Thumb syscalls Paul Brook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).