OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uC-libc/] [sysdeps/] [m68k/] [ptrace.c] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
#include <errno.h>
2
#include <sys/ptrace.h>
3
#include <sys/syscall.h>
4
 
5
int
6
ptrace(int request, int pid, int addr, int data)
7
{
8
        long ret;
9
        long res;
10
        if (request > 0 && request < 4) (long *)data = &ret;
11
 
12
        __asm__ volatile ("movel %1,%/d0\n\t"
13
                          "movel %2,%/d1\n\t"
14
                          "movel %3,%/d2\n\t"
15
                          "movel %4,%/d3\n\t"
16
                          "movel %5,%/d4\n\t"
17
                          "trap  #0\n\t"
18
                          "movel %/d0,%0"
19
                :"=g" (res)
20
                :"i" (SYS_ptrace), "g" (request), "g" (pid),
21
                 "g" (addr), "g" (data) : "%d0", "%d1", "%d2", "%d3", "%d4");
22
 
23
        if (res >= 0) {
24
                if (request > 0 && request < 4) {
25
                        errno = 0;
26
                        return (ret);
27
                }
28
                return (int) res;
29
        }
30
        errno = -res;
31
        return -1;
32
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.