diff options
Diffstat (limited to 'arch/um/sys-i386/ptrace_user.c')
-rw-r--r-- | arch/um/sys-i386/ptrace_user.c | 86 |
1 files changed, 0 insertions, 86 deletions
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c index 40ff0c831bd0..b68dd230e646 100644 --- a/arch/um/sys-i386/ptrace_user.c +++ b/arch/um/sys-i386/ptrace_user.c | |||
@@ -43,89 +43,3 @@ int ptrace_setfpregs(long pid, unsigned long *regs) | |||
43 | return -errno; | 43 | return -errno; |
44 | return 0; | 44 | return 0; |
45 | } | 45 | } |
46 | |||
47 | #ifdef UML_CONFIG_MODE_TT | ||
48 | |||
49 | static void write_debugregs(int pid, unsigned long *regs) | ||
50 | { | ||
51 | struct user *dummy; | ||
52 | int nregs, i; | ||
53 | |||
54 | dummy = NULL; | ||
55 | nregs = ARRAY_SIZE(dummy->u_debugreg); | ||
56 | for(i = 0; i < nregs; i++){ | ||
57 | if((i == 4) || (i == 5)) continue; | ||
58 | if(ptrace(PTRACE_POKEUSR, pid, &dummy->u_debugreg[i], | ||
59 | regs[i]) < 0) | ||
60 | printk("write_debugregs - ptrace failed on " | ||
61 | "register %d, value = 0x%lx, errno = %d\n", i, | ||
62 | regs[i], errno); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | static void read_debugregs(int pid, unsigned long *regs) | ||
67 | { | ||
68 | struct user *dummy; | ||
69 | int nregs, i; | ||
70 | |||
71 | dummy = NULL; | ||
72 | nregs = ARRAY_SIZE(dummy->u_debugreg); | ||
73 | for(i = 0; i < nregs; i++){ | ||
74 | regs[i] = ptrace(PTRACE_PEEKUSR, pid, | ||
75 | &dummy->u_debugreg[i], 0); | ||
76 | } | ||
77 | } | ||
78 | |||
79 | /* Accessed only by the tracing thread */ | ||
80 | static unsigned long kernel_debugregs[8] = { [ 0 ... 7 ] = 0 }; | ||
81 | |||
82 | void arch_enter_kernel(void *task, int pid) | ||
83 | { | ||
84 | read_debugregs(pid, TASK_DEBUGREGS(task)); | ||
85 | write_debugregs(pid, kernel_debugregs); | ||
86 | } | ||
87 | |||
88 | void arch_leave_kernel(void *task, int pid) | ||
89 | { | ||
90 | read_debugregs(pid, kernel_debugregs); | ||
91 | write_debugregs(pid, TASK_DEBUGREGS(task)); | ||
92 | } | ||
93 | |||
94 | #ifdef UML_CONFIG_PT_PROXY | ||
95 | /* Accessed only by the tracing thread */ | ||
96 | static int debugregs_seq; | ||
97 | |||
98 | /* Only called by the ptrace proxy */ | ||
99 | void ptrace_pokeuser(unsigned long addr, unsigned long data) | ||
100 | { | ||
101 | if((addr < offsetof(struct user, u_debugreg[0])) || | ||
102 | (addr > offsetof(struct user, u_debugreg[7]))) | ||
103 | return; | ||
104 | addr -= offsetof(struct user, u_debugreg[0]); | ||
105 | addr = addr >> 2; | ||
106 | if(kernel_debugregs[addr] == data) return; | ||
107 | |||
108 | kernel_debugregs[addr] = data; | ||
109 | debugregs_seq++; | ||
110 | } | ||
111 | |||
112 | static void update_debugregs_cb(void *arg) | ||
113 | { | ||
114 | int pid = *((int *) arg); | ||
115 | |||
116 | write_debugregs(pid, kernel_debugregs); | ||
117 | } | ||
118 | |||
119 | /* Optimized out in its header when not defined */ | ||
120 | void update_debugregs(int seq) | ||
121 | { | ||
122 | int me; | ||
123 | |||
124 | if(seq == debugregs_seq) return; | ||
125 | |||
126 | me = os_getpid(); | ||
127 | initial_thread_cb(update_debugregs_cb, &me); | ||
128 | } | ||
129 | #endif | ||
130 | |||
131 | #endif | ||