blob: b5f9c33e311e1b17bfdaf798365d299d0e9585a1 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * Copyright 2003 PathScale, Inc.
3 *
4 * Licensed under the GPL
5 */
6
7#include <stddef.h>
8#include <errno.h>
9#include "ptrace_user.h"
10#include "user.h"
11#include "kern_constants.h"
12
13int ptrace_getregs(long pid, unsigned long *regs_out)
14{
15 if(ptrace(PTRACE_GETREGS, pid, 0, regs_out) < 0)
16 return(-errno);
17 return(0);
18}
19
20int ptrace_setregs(long pid, unsigned long *regs)
21{
22 if(ptrace(PTRACE_SETREGS, pid, 0, regs) < 0)
23 return(-errno);
24 return(0);
25}
26
Jeff Dikee2216fe2006-02-07 12:58:43 -080027int ptrace_setfpregs(long pid, unsigned long *regs)
28{
29 if (ptrace(PTRACE_SETFPREGS, pid, 0, regs) < 0)
30 return -errno;
31 return 0;
32}
33
Linus Torvalds1da177e2005-04-16 15:20:36 -070034void ptrace_pokeuser(unsigned long addr, unsigned long data)
35{
36 panic("ptrace_pokeuser");
37}
38
39#define DS 184
40#define ES 192
41#define __USER_DS 0x2b
42
43void arch_enter_kernel(void *task, int pid)
44{
45}
46
47void arch_leave_kernel(void *task, int pid)
48{
49#ifdef UM_USER_CS
50 if(ptrace(PTRACE_POKEUSR, pid, CS, UM_USER_CS) < 0)
51 printk("POKEUSR CS failed");
52#endif
53
54 if(ptrace(PTRACE_POKEUSR, pid, DS, __USER_DS) < 0)
55 printk("POKEUSR DS failed");
56 if(ptrace(PTRACE_POKEUSR, pid, ES, __USER_DS) < 0)
57 printk("POKEUSR ES failed");
58}