Permalink
Browse files

Initial ARM support.

Thanks to Josh Dick for providing access to an ARM test and dev machine.
  • Loading branch information...
1 parent 1dfdfbc commit 6e4d75a10adad095d8471b321e13cd0ba2ec0e5e @nelhage committed Jan 27, 2011
Showing with 37 additions and 0 deletions.
  1. +34 −0 arch/arm.h
  2. +3 −0 ptrace.c
View
@@ -0,0 +1,34 @@
+#define reg_ip ARM_pc
+
+#define syscall_rv uregs[0]
+#define syscall_arg0 uregs[0]
+#define syscall_arg1 uregs[1]
+#define syscall_arg2 uregs[2]
+#define syscall_arg3 uregs[3]
+#define syscall_arg4 uregs[4]
+#define syscall_arg5 uregs[5]
+
+static inline void arch_fixup_regs(struct user *user) {
+ user->regs.reg_ip -= 4;
+}
+
+static inline int arch_set_syscall(struct ptrace_child *child,
+ unsigned long sysno) {
+ return ptrace_command(child, PTRACE_SET_SYSCALL, 0, sysno);
+}
+
+static inline int arch_save_syscall(struct ptrace_child *child) {
+ unsigned long swi;
+ swi = ptrace_command(child, PTRACE_PEEKTEXT, child->user.regs.reg_ip);
+ if (child->error)
+ return -1;
+ if (swi == 0xef000000)
+ child->saved_syscall = child->user.regs.uregs[7];
+ else
+ child->saved_syscall = (swi & 0x000fffff);
+ return 0;
+}
+
+static inline int arch_restore_syscall(struct ptrace_child *child) {
+ return arch_set_syscall(child, child->saved_syscall);
+}
View
@@ -1,4 +1,5 @@
#include <sys/ptrace.h>
+#include <asm/ptrace.h>
#include <sys/types.h>
#include <sys/user.h>
#include <sys/wait.h>
@@ -46,6 +47,8 @@ static long __ptrace_command(struct ptrace_child *child, enum __ptrace_request r
#include "arch/amd64.h"
#elif defined(__i386__)
#include "arch/i386.h"
+#elif defined(__arm__)
+#include "arch/arm.h"
#else
#error Unsupported architecture.
#endif

0 comments on commit 6e4d75a

Please sign in to comment.