diff options
Diffstat (limited to 'arch/um/sys-i386')
-rw-r--r-- | arch/um/sys-i386/ptrace.c | 8 | ||||
-rw-r--r-- | arch/um/sys-i386/ptrace_user.c | 10 |
2 files changed, 15 insertions, 3 deletions
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c index ff94eded93eb..927fcd955651 100644 --- a/arch/um/sys-i386/ptrace.c +++ b/arch/um/sys-i386/ptrace.c | |||
@@ -15,9 +15,13 @@ | |||
15 | #include "sysdep/sigcontext.h" | 15 | #include "sysdep/sigcontext.h" |
16 | #include "sysdep/sc.h" | 16 | #include "sysdep/sc.h" |
17 | 17 | ||
18 | void arch_switch(void) | 18 | void arch_switch_to_tt(struct task_struct *from, struct task_struct *to) |
19 | { | ||
20 | update_debugregs(to->thread.arch.debugregs_seq); | ||
21 | } | ||
22 | |||
23 | void arch_switch_to_skas(struct task_struct *from, struct task_struct *to) | ||
19 | { | 24 | { |
20 | update_debugregs(current->thread.arch.debugregs_seq); | ||
21 | } | 25 | } |
22 | 26 | ||
23 | int is_syscall(unsigned long addr) | 27 | int is_syscall(unsigned long addr) |
diff --git a/arch/um/sys-i386/ptrace_user.c b/arch/um/sys-i386/ptrace_user.c index 7c376c95de50..9f3bd8ed78f5 100644 --- a/arch/um/sys-i386/ptrace_user.c +++ b/arch/um/sys-i386/ptrace_user.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "sysdep/thread.h" | 14 | #include "sysdep/thread.h" |
15 | #include "user.h" | 15 | #include "user.h" |
16 | #include "os.h" | 16 | #include "os.h" |
17 | #include "uml-config.h" | ||
17 | 18 | ||
18 | int ptrace_getregs(long pid, unsigned long *regs_out) | 19 | int ptrace_getregs(long pid, unsigned long *regs_out) |
19 | { | 20 | { |
@@ -43,6 +44,7 @@ int ptrace_setfpregs(long pid, unsigned long *regs) | |||
43 | return 0; | 44 | return 0; |
44 | } | 45 | } |
45 | 46 | ||
47 | /* All the below stuff is of interest for TT mode only */ | ||
46 | static void write_debugregs(int pid, unsigned long *regs) | 48 | static void write_debugregs(int pid, unsigned long *regs) |
47 | { | 49 | { |
48 | struct user *dummy; | 50 | struct user *dummy; |
@@ -75,7 +77,6 @@ static void read_debugregs(int pid, unsigned long *regs) | |||
75 | 77 | ||
76 | /* Accessed only by the tracing thread */ | 78 | /* Accessed only by the tracing thread */ |
77 | static unsigned long kernel_debugregs[8] = { [ 0 ... 7 ] = 0 }; | 79 | static unsigned long kernel_debugregs[8] = { [ 0 ... 7 ] = 0 }; |
78 | static int debugregs_seq = 0; | ||
79 | 80 | ||
80 | void arch_enter_kernel(void *task, int pid) | 81 | void arch_enter_kernel(void *task, int pid) |
81 | { | 82 | { |
@@ -89,6 +90,11 @@ void arch_leave_kernel(void *task, int pid) | |||
89 | write_debugregs(pid, TASK_DEBUGREGS(task)); | 90 | write_debugregs(pid, TASK_DEBUGREGS(task)); |
90 | } | 91 | } |
91 | 92 | ||
93 | #ifdef UML_CONFIG_PT_PROXY | ||
94 | /* Accessed only by the tracing thread */ | ||
95 | static int debugregs_seq; | ||
96 | |||
97 | /* Only called by the ptrace proxy */ | ||
92 | void ptrace_pokeuser(unsigned long addr, unsigned long data) | 98 | void ptrace_pokeuser(unsigned long addr, unsigned long data) |
93 | { | 99 | { |
94 | if((addr < offsetof(struct user, u_debugreg[0])) || | 100 | if((addr < offsetof(struct user, u_debugreg[0])) || |
@@ -109,6 +115,7 @@ static void update_debugregs_cb(void *arg) | |||
109 | write_debugregs(pid, kernel_debugregs); | 115 | write_debugregs(pid, kernel_debugregs); |
110 | } | 116 | } |
111 | 117 | ||
118 | /* Optimized out in its header when not defined */ | ||
112 | void update_debugregs(int seq) | 119 | void update_debugregs(int seq) |
113 | { | 120 | { |
114 | int me; | 121 | int me; |
@@ -118,6 +125,7 @@ void update_debugregs(int seq) | |||
118 | me = os_getpid(); | 125 | me = os_getpid(); |
119 | initial_thread_cb(update_debugregs_cb, &me); | 126 | initial_thread_cb(update_debugregs_cb, &me); |
120 | } | 127 | } |
128 | #endif | ||
121 | 129 | ||
122 | /* | 130 | /* |
123 | * Overrides for Emacs so that we follow Linus's tabbing style. | 131 | * Overrides for Emacs so that we follow Linus's tabbing style. |