diff options
author | Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> | 2006-03-31 05:30:22 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-03-31 15:18:52 -0500 |
commit | aa6758d4867cd07bd76105ade6177fe6148e559a (patch) | |
tree | 0053f855c885a6dc322337468a2c45b6b2f8ddd0 /include/asm-um/ptrace-i386.h | |
parent | 972410b0232e97609fcefc8e408fe3037fcd607b (diff) |
[PATCH] uml: implement {get,set}_thread_area for i386
Implement sys_[gs]et_thread_area and the corresponding ptrace operations for
UML. This is the main chunk, additional parts follow. This implementation is
now well tested and has run reliably for some time, and we've understood all
the previously existing problems.
Their implementation saves the new GDT content and then forwards the call to
the host when appropriate, i.e. immediately when the target process is
running or on context switch otherwise (i.e. on fork and on ptrace() calls).
In SKAS mode, we must switch registers on each context switch (because SKAS
does not switches tls_array together with current->mm).
Also, added get_cpu() locking; this has been done for SKAS mode, since TT does
not need it (it does not use smp_processor_id()).
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 'include/asm-um/ptrace-i386.h')
-rw-r--r-- | include/asm-um/ptrace-i386.h | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/include/asm-um/ptrace-i386.h b/include/asm-um/ptrace-i386.h index fe882b9d917e..30656c962d74 100644 --- a/include/asm-um/ptrace-i386.h +++ b/include/asm-um/ptrace-i386.h | |||
@@ -8,8 +8,11 @@ | |||
8 | 8 | ||
9 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 | 9 | #define HOST_AUDIT_ARCH AUDIT_ARCH_I386 |
10 | 10 | ||
11 | #include "linux/compiler.h" | ||
11 | #include "sysdep/ptrace.h" | 12 | #include "sysdep/ptrace.h" |
12 | #include "asm/ptrace-generic.h" | 13 | #include "asm/ptrace-generic.h" |
14 | #include "asm/host_ldt.h" | ||
15 | #include "choose-mode.h" | ||
13 | 16 | ||
14 | #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) | 17 | #define PT_REGS_EAX(r) UPT_EAX(&(r)->regs) |
15 | #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) | 18 | #define PT_REGS_EBX(r) UPT_EBX(&(r)->regs) |
@@ -38,15 +41,31 @@ | |||
38 | 41 | ||
39 | #define user_mode(r) UPT_IS_USER(&(r)->regs) | 42 | #define user_mode(r) UPT_IS_USER(&(r)->regs) |
40 | 43 | ||
41 | #endif | 44 | extern int ptrace_get_thread_area(struct task_struct *child, int idx, |
45 | struct user_desc __user *user_desc); | ||
42 | 46 | ||
43 | /* | 47 | extern int ptrace_set_thread_area(struct task_struct *child, int idx, |
44 | * Overrides for Emacs so that we follow Linus's tabbing style. | 48 | struct user_desc __user *user_desc); |
45 | * Emacs will notice this stuff at the end of the file and automatically | 49 | |
46 | * adjust the settings for this buffer only. This must remain at the end | 50 | extern int do_set_thread_area_skas(struct user_desc *info); |
47 | * of the file. | 51 | extern int do_get_thread_area_skas(struct user_desc *info); |
48 | * --------------------------------------------------------------------------- | 52 | |
49 | * Local variables: | 53 | extern int do_set_thread_area_tt(struct user_desc *info); |
50 | * c-file-style: "linux" | 54 | extern int do_get_thread_area_tt(struct user_desc *info); |
51 | * End: | 55 | |
52 | */ | 56 | extern int arch_switch_tls_skas(struct task_struct *from, struct task_struct *to); |
57 | extern int arch_switch_tls_tt(struct task_struct *from, struct task_struct *to); | ||
58 | |||
59 | static inline int do_get_thread_area(struct user_desc *info) | ||
60 | { | ||
61 | return CHOOSE_MODE_PROC(do_get_thread_area_tt, do_get_thread_area_skas, info); | ||
62 | } | ||
63 | |||
64 | static inline int do_set_thread_area(struct user_desc *info) | ||
65 | { | ||
66 | return CHOOSE_MODE_PROC(do_set_thread_area_tt, do_set_thread_area_skas, info); | ||
67 | } | ||
68 | |||
69 | struct task_struct; | ||
70 | |||
71 | #endif | ||