summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/m68k
diff options
context:
space:
mode:
authorDavid McCullough <davidm@snapgear.com>2001-01-29 15:03:09 +0000
committerDavid McCullough <davidm@snapgear.com>2001-01-29 15:03:09 +0000
commit84d08a9a0e501241f6a1fa8505a3a61a9c214001 (patch)
treeb93fd85d2a6324a75fc814017891a5328ba78758 /libc/sysdeps/linux/m68k
parente9e69bd628e4495c975bb82dc3aabc536ae97329 (diff)
ptrace for m68k debugging.
Diffstat (limited to 'libc/sysdeps/linux/m68k')
-rw-r--r--libc/sysdeps/linux/m68k/ptrace.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/libc/sysdeps/linux/m68k/ptrace.c b/libc/sysdeps/linux/m68k/ptrace.c
new file mode 100644
index 000000000..383f72615
--- /dev/null
+++ b/libc/sysdeps/linux/m68k/ptrace.c
@@ -0,0 +1,33 @@
+
+#include <errno.h>
+#include <asm/ptrace.h>
+#include <sys/syscall.h>
+
+int
+ptrace(int request, int pid, int addr, int data)
+{
+ long ret;
+ long res;
+ if (request > 0 && request < 4) (long *)data = &ret;
+
+ __asm__ volatile ("movel %1,%/d0\n\t"
+ "movel %2,%/d1\n\t"
+ "movel %3,%/d2\n\t"
+ "movel %4,%/d3\n\t"
+ "movel %5,%/d4\n\t"
+ "trap #0\n\t"
+ "movel %/d0,%0"
+ :"=g" (res)
+ :"i" (SYS_ptrace), "g" (request), "g" (pid),
+ "g" (addr), "g" (data) : "%d0", "%d1", "%d2", "%d3", "%d4");
+
+ if (res >= 0) {
+ if (request > 0 && request < 4) {
+ errno = 0;
+ return (ret);
+ }
+ return (int) res;
+ }
+ errno = -res;
+ return -1;
+}