Skip to contentSkip to conversation

Add support for the arm breakpoint syscall

PATCH Applied Hunter Laux 4 participants 5 messages Jun 20, 2014 – Jun 25, 2014

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Add support for the arm breakpoint syscall

OABI arm used a software interrupt(0xef9f0001) for breakpoints. Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI. Apparently Steel Bank Common Lisp still uses the swi instruction.

This is the kernel implementation:
http://lxr.free-electrons.com/source/arch/arm/kernel/traps.c#L598

---
 linux-user/arm/syscall.h | 1 +
 linux-user/main.c        | 4 ++++
 2 files changed, 5 insertions(+)
linux-user/arm/syscall.h +1 -0
index ce2c2a8..e0d2cc3 100644
@@ -29,6 +29,7 @@ struct target_pt_regs {
 #define ARM_THUMB_SYSCALL	0
 
 #define ARM_NR_BASE	  0xf0000
+#define ARM_NR_breakpoint (ARM_NR_BASE + 1)
 #define ARM_NR_cacheflush (ARM_NR_BASE + 2)
 #define ARM_NR_set_tls	  (ARM_NR_BASE + 5)
 
linux-user/main.c +4 -0
index a87c6f7..9c3eddc 100644
@@ -807,6 +807,9 @@ void cpu_loop(CPUARMState *env)
                             cpu_set_tls(env, env->regs[0]);
                             env->regs[0] = 0;
                             break;
+                        case ARM_NR_breakpoint:
+                            env->regs[15] -= env->thumb ? 2 : 4;
+                            goto excp_debug;
                         default:
                             gemu_log("qemu: Unsupported ARM syscall: 0x%x\n",
                                      n);
@@ -850,6 +853,7 @@ void cpu_loop(CPUARMState *env)
             }
             break;
         case EXCP_DEBUG:
+        excp_debug:
             {
                 int sig;
 
Signature · 1 line
1.9.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 8 lines · Hunter Laux

OABI arm used a software interrupt(0xef9f0001) for breakpoints. Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI. Apparently Steel Bank Common Lisp still uses the swi instruction.

This is the kernel implementation:
http://lxr.free-electrons.com/source/arch/arm/kernel/traps.c#L598

thanks
-- PMM

#2 lore raw
In reply to Hunter Laux
Quoted 3 lines · Hunter Laux

OABI arm used a software interrupt(0xef9f0001) for breakpoints. Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI. Apparently Steel Bank Common Lisp still uses the swi instruction.

Applied to -trivial, despite the ugliness with the goto. Oh well.

Thank you!

/mjt

#3 lore raw
Quoted 6 lines · Michael Tokarev
Quoted 3 lines · Hunter Laux

OABI arm used a software interrupt(0xef9f0001) for breakpoints. Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI. Apparently Steel Bank Common Lisp still uses the swi instruction.

Applied to -trivial, despite the ugliness with the goto. Oh well.

It was already in my yesterdays linux-user pull req ( which I need to resend with the name_to_handle_at/open_by_handle_at syscalls fixed ).

Riku

#4 lore raw
Quoted 10 lines · Riku Voipio
Quoted 6 lines · Michael Tokarev
Quoted 3 lines · Hunter Laux

OABI arm used a software interrupt(0xef9f0001) for breakpoints. Since 2005 gdb has used the break instruction(0xe7f001f0) for EABI. Apparently Steel Bank Common Lisp still uses the swi instruction.

Applied to -trivial, despite the ugliness with the goto. Oh well.

It was already in my yesterdays linux-user pull req ( which I need to resend with the name_to_handle_at/open_by_handle_at syscalls fixed ).

If it is the same patch, git should do the Right Thing when pulling your branch, without causing conflicts.

You could notify me about you applying this patch to -linux-user branch. I haven't noticed this patch in your pull req, -- I don't always watch all pull requests.

Thanks,

/mjt