diff mbox

linux-user: ARM: Ignore immediate value for svc in thumb mode

Message ID 1338305426-19653-1-git-send-email-agraf@suse.de
State New
Headers show

Commit Message

Alexander Graf May 29, 2012, 3:30 p.m. UTC
When running in thumb mode, Linux doesn't evaluate the immediate value
of the svc instruction, but instead just always assumes the syscall number
to be in r7.

This fixes executing go_bootstrap while building go for me.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 linux-user/main.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

Comments

Peter Maydell June 22, 2012, 9:39 a.m. UTC | #1
On 29 May 2012 16:30, Alexander Graf <agraf@suse.de> wrote:
> When running in thumb mode, Linux doesn't evaluate the immediate value
> of the svc instruction, but instead just always assumes the syscall number
> to be in r7.
>
> This fixes executing go_bootstrap while building go for me.
>
> Signed-off-by: Alexander Graf <agraf@suse.de>

Yep, there's no OABI back-compat for thumb so it is always EABI.
(I think the code emitting Thumb SVCs with non-zero immediate
values is probably broken though.)

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

-- PMM
diff mbox

Patch

diff --git a/linux-user/main.c b/linux-user/main.c
index 191b750..a7fefe7 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -822,8 +822,7 @@  void cpu_loop(CPUARMState *env)
                 } else if (n == ARM_NR_semihosting
                            || n == ARM_NR_thumb_semihosting) {
                     env->regs[0] = do_arm_semihosting (env);
-                } else if (n == 0 || n >= ARM_SYSCALL_BASE
-                           || (env->thumb && n == ARM_THUMB_SYSCALL)) {
+                } else if (n == 0 || n >= ARM_SYSCALL_BASE || env->thumb) {
                     /* linux syscall */
                     if (env->thumb || n == 0) {
                         n = env->regs[7];