[PATCH] kstrdup: convert a few existing implementations
[linux-2.6] / arch / um / sys-x86_64 / ptrace_user.c
1 /*
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
13 int 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
20 int 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
27 void ptrace_pokeuser(unsigned long addr, unsigned long data)
28 {
29         panic("ptrace_pokeuser");
30 }
31
32 #define DS 184
33 #define ES 192
34 #define __USER_DS     0x2b
35
36 void arch_enter_kernel(void *task, int pid)
37 {
38 }
39
40 void arch_leave_kernel(void *task, int pid)
41 {
42 #ifdef UM_USER_CS
43         if(ptrace(PTRACE_POKEUSR, pid, CS, UM_USER_CS) < 0)
44                 printk("POKEUSR CS failed");
45 #endif
46
47         if(ptrace(PTRACE_POKEUSR, pid, DS, __USER_DS) < 0)
48                 printk("POKEUSR DS failed");
49         if(ptrace(PTRACE_POKEUSR, pid, ES, __USER_DS) < 0)
50                 printk("POKEUSR ES failed");
51 }