From: Paul Brook <paul@codesourcery.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [patch] Thumb syscalls
Date: Tue, 26 Apr 2005 23:49:36 +0100 [thread overview]
Message-ID: <200504262349.36940.paul@codesourcery.com> (raw)
[-- 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)
reply other threads:[~2005-04-26 22:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200504262349.36940.paul@codesourcery.com \
--to=paul@codesourcery.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.