aboutsummaryrefslogtreecommitdiffstats
path: root/arch/um/sys-i386
diff options
context:
space:
mode:
authorPaolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>2006-03-31 05:30:21 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-31 15:18:52 -0500
commit972410b0232e97609fcefc8e408fe3037fcd607b (patch)
tree2de18ed5d823dc7e24c0171f720f6354a9cd57e4 /arch/um/sys-i386
parentfbdf2161552a2065047e5df2dbf9ebf69d66a0e9 (diff)
[PATCH] uml: clean arch_switch usage
Call arch_switch also in switch_to_skas, even if it's, for now, a no-op for that case (and mark this in the comment); this will change soon. Also, arch_switch for TT mode is actually useless when the PT proxy (a complicate debugging instrumentation for TT mode) is not enabled. In fact, it only calls update_debugregs, which checks debugregs_seq against seq (to check if the registers are up-to-date - seq here means a "version number" of the registers). If the ptrace proxy is not enabled, debugregs_seq always stays 0 and update_debugregs will be a no-op. So, optimize this out (the compiler can't do it). Also, I've been disappointed by the fact that it would make a lot of sense if, after calling a successful update_debugregs(current->thread.arch.debugregs_seq), current->thread.arch.debugregs_seq were updated with the new debugregs_seq. But this is not done. Is this a bug or a feature? For all purposes, it seems a bug (otherwise the whole mechanism does not make sense, which is also a possibility to check), which causes some performance only problems (not correctness), since we write_debugregs when not needed. Also, as suggested by Jeff, remove a redundant enabling of SIGVTALRM, comprised in the subsequent local_irq_enable(). I'm just a bit dubious if ordering matters there... Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Acked-by: Jeff Dike <jdike@addtoit.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/um/sys-i386')
-rw-r--r--arch/um/sys-i386/ptrace.c8
-rw-r--r--arch/um/sys-i386/ptrace_user.c10
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
18void arch_switch(void) 18void arch_switch_to_tt(struct task_struct *from, struct task_struct *to)
19{
20 update_debugregs(to->thread.arch.debugregs_seq);
21}
22
23void 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
23int is_syscall(unsigned long addr) 27int 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
18int ptrace_getregs(long pid, unsigned long *regs_out) 19int 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 */
46static void write_debugregs(int pid, unsigned long *regs) 48static 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 */
77static unsigned long kernel_debugregs[8] = { [ 0 ... 7 ] = 0 }; 79static unsigned long kernel_debugregs[8] = { [ 0 ... 7 ] = 0 };
78static int debugregs_seq = 0;
79 80
80void arch_enter_kernel(void *task, int pid) 81void 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 */
95static int debugregs_seq;
96
97/* Only called by the ptrace proxy */
92void ptrace_pokeuser(unsigned long addr, unsigned long data) 98void 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 */
112void update_debugregs(int seq) 119void 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.