diff options
Diffstat (limited to 'include/asm-um')
-rw-r--r-- | include/asm-um/desc.h | 12 | ||||
-rw-r--r-- | include/asm-um/processor-i386.h | 35 | ||||
-rw-r--r-- | include/asm-um/processor-x86_64.h | 9 | ||||
-rw-r--r-- | include/asm-um/ptrace-generic.h | 14 | ||||
-rw-r--r-- | include/asm-um/ptrace-i386.h | 41 | ||||
-rw-r--r-- | include/asm-um/ptrace-x86_64.h | 35 | ||||
-rw-r--r-- | include/asm-um/segment.h | 2 |
7 files changed, 110 insertions, 38 deletions
diff --git a/include/asm-um/desc.h b/include/asm-um/desc.h index ac1d2a20d178..4ec34a51b62c 100644 --- a/include/asm-um/desc.h +++ b/include/asm-um/desc.h | |||
@@ -1,6 +1,16 @@ | |||
1 | #ifndef __UM_DESC_H | 1 | #ifndef __UM_DESC_H |
2 | #define __UM_DESC_H | 2 | #define __UM_DESC_H |
3 | 3 | ||
4 | #include "asm/arch/desc.h" | 4 | /* Taken from asm-i386/desc.h, it's the only thing we need. The rest wouldn't |
5 | * compile, and has never been used. */ | ||
6 | #define LDT_empty(info) (\ | ||
7 | (info)->base_addr == 0 && \ | ||
8 | (info)->limit == 0 && \ | ||
9 | (info)->contents == 0 && \ | ||
10 | (info)->read_exec_only == 1 && \ | ||
11 | (info)->seg_32bit == 0 && \ | ||
12 | (info)->limit_in_pages == 0 && \ | ||
13 | (info)->seg_not_present == 1 && \ | ||
14 | (info)->useable == 0 ) | ||
5 | 15 | ||
6 | #endif | 16 | #endif |
diff --git a/include/asm-um/processor-i386.h b/include/asm-um/processor-i386.h index 4108a579eb92..595f1c3e1e40 100644 --- a/include/asm-um/processor-i386.h +++ b/include/asm-um/processor-i386.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) | 2 | * Copyright (C) 2002 Jeff Dike (jdike@karaya.com) |
3 | * Licensed under the GPL | 3 | * Licensed under the GPL |
4 | */ | 4 | */ |
@@ -6,21 +6,48 @@ | |||
6 | #ifndef __UM_PROCESSOR_I386_H | 6 | #ifndef __UM_PROCESSOR_I386_H |
7 | #define __UM_PROCESSOR_I386_H | 7 | #define __UM_PROCESSOR_I386_H |
8 | 8 | ||
9 | #include "linux/string.h" | ||
10 | #include "asm/host_ldt.h" | ||
11 | #include "asm/segment.h" | ||
12 | |||
9 | extern int host_has_xmm; | 13 | extern int host_has_xmm; |
10 | extern int host_has_cmov; | 14 | extern int host_has_cmov; |
11 | 15 | ||
12 | /* include faultinfo structure */ | 16 | /* include faultinfo structure */ |
13 | #include "sysdep/faultinfo.h" | 17 | #include "sysdep/faultinfo.h" |
14 | 18 | ||
19 | struct uml_tls_struct { | ||
20 | struct user_desc tls; | ||
21 | unsigned flushed:1; | ||
22 | unsigned present:1; | ||
23 | }; | ||
24 | |||
15 | struct arch_thread { | 25 | struct arch_thread { |
26 | struct uml_tls_struct tls_array[GDT_ENTRY_TLS_ENTRIES]; | ||
16 | unsigned long debugregs[8]; | 27 | unsigned long debugregs[8]; |
17 | int debugregs_seq; | 28 | int debugregs_seq; |
18 | struct faultinfo faultinfo; | 29 | struct faultinfo faultinfo; |
19 | }; | 30 | }; |
20 | 31 | ||
21 | #define INIT_ARCH_THREAD { .debugregs = { [ 0 ... 7 ] = 0 }, \ | 32 | #define INIT_ARCH_THREAD { \ |
22 | .debugregs_seq = 0, \ | 33 | .tls_array = { [ 0 ... GDT_ENTRY_TLS_ENTRIES - 1 ] = \ |
23 | .faultinfo = { 0, 0, 0 } } | 34 | { .present = 0, .flushed = 0 } }, \ |
35 | .debugregs = { [ 0 ... 7 ] = 0 }, \ | ||
36 | .debugregs_seq = 0, \ | ||
37 | .faultinfo = { 0, 0, 0 } \ | ||
38 | } | ||
39 | |||
40 | static inline void arch_flush_thread(struct arch_thread *thread) | ||
41 | { | ||
42 | /* Clear any TLS still hanging */ | ||
43 | memset(&thread->tls_array, 0, sizeof(thread->tls_array)); | ||
44 | } | ||
45 | |||
46 | static inline void arch_copy_thread(struct arch_thread *from, | ||
47 | struct arch_thread *to) | ||
48 | { | ||
49 | memcpy(&to->tls_array, &from->tls_array, sizeof(from->tls_array)); | ||
50 | } | ||
24 | 51 | ||
25 | #include "asm/arch/user.h" | 52 | #include "asm/arch/user.h" |
26 | 53 | ||
diff --git a/include/asm-um/processor-x86_64.h b/include/asm-um/processor-x86_64.h index e1e1255a1d36..10609af376c0 100644 --- a/include/asm-um/processor-x86_64.h +++ b/include/asm-um/processor-x86_64.h | |||
@@ -28,6 +28,15 @@ extern inline void rep_nop(void) | |||
28 | .debugregs_seq = 0, \ | 28 | .debugregs_seq = 0, \ |
29 | .faultinfo = { 0, 0, 0 } } | 29 | .faultinfo = { 0, 0, 0 } } |
30 | 30 | ||
31 | static inline void arch_flush_thread(struct arch_thread *thread) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | static inline void arch_copy_thread(struct arch_thread *from, | ||
36 | struct arch_thread *to) | ||
37 | { | ||
38 | } | ||
39 | |||
31 | #include "asm/arch/user.h" | 40 | #include "asm/arch/user.h" |
32 | 41 | ||
33 | #define current_text_addr() \ | 42 | #define current_text_addr() \ |
diff --git a/include/asm-um/ptrace-generic.h b/include/asm-um/ptrace-generic.h index 8c57e384cb8a..503484305e67 100644 --- a/include/asm-um/ptrace-generic.h +++ b/include/asm-um/ptrace-generic.h | |||
@@ -60,17 +60,9 @@ extern void show_regs(struct pt_regs *regs); | |||
60 | extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, | 60 | extern void send_sigtrap(struct task_struct *tsk, union uml_pt_regs *regs, |
61 | int error_code); | 61 | int error_code); |
62 | 62 | ||
63 | #endif | 63 | extern int arch_copy_tls(struct task_struct *new); |
64 | extern void clear_flushed_tls(struct task_struct *task); | ||
64 | 65 | ||
65 | #endif | 66 | #endif |
66 | 67 | ||
67 | /* | 68 | #endif |
68 | * Overrides for Emacs so that we follow Linus's tabbing style. | ||
69 | * Emacs will notice this stuff at the end of the file and automatically | ||
70 | * adjust the settings for this buffer only. This must remain at the end | ||
71 | * of the file. | ||
72 | * --------------------------------------------------------------------------- | ||
73 | * Local variables: | ||
74 | * c-file-style: "linux" | ||
75 | * End: | ||
76 | */ | ||
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 | ||
diff --git a/include/asm-um/ptrace-x86_64.h b/include/asm-um/ptrace-x86_64.h index be51219a8ffe..c894e68b1f96 100644 --- a/include/asm-um/ptrace-x86_64.h +++ b/include/asm-um/ptrace-x86_64.h | |||
@@ -8,6 +8,8 @@ | |||
8 | #define __UM_PTRACE_X86_64_H | 8 | #define __UM_PTRACE_X86_64_H |
9 | 9 | ||
10 | #include "linux/compiler.h" | 10 | #include "linux/compiler.h" |
11 | #include "asm/errno.h" | ||
12 | #include "asm/host_ldt.h" | ||
11 | 13 | ||
12 | #define signal_fault signal_fault_x86_64 | 14 | #define signal_fault signal_fault_x86_64 |
13 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ | 15 | #define __FRAME_OFFSETS /* Needed to get the R* macros */ |
@@ -63,15 +65,26 @@ void signal_fault(struct pt_regs_subarch *regs, void *frame, char *where); | |||
63 | 65 | ||
64 | #define profile_pc(regs) PT_REGS_IP(regs) | 66 | #define profile_pc(regs) PT_REGS_IP(regs) |
65 | 67 | ||
66 | #endif | 68 | static inline int ptrace_get_thread_area(struct task_struct *child, int idx, |
69 | struct user_desc __user *user_desc) | ||
70 | { | ||
71 | return -ENOSYS; | ||
72 | } | ||
67 | 73 | ||
68 | /* | 74 | static inline int ptrace_set_thread_area(struct task_struct *child, int idx, |
69 | * Overrides for Emacs so that we follow Linus's tabbing style. | 75 | struct user_desc __user *user_desc) |
70 | * Emacs will notice this stuff at the end of the file and automatically | 76 | { |
71 | * adjust the settings for this buffer only. This must remain at the end | 77 | return -ENOSYS; |
72 | * of the file. | 78 | } |
73 | * --------------------------------------------------------------------------- | 79 | |
74 | * Local variables: | 80 | static inline void arch_switch_to_tt(struct task_struct *from, |
75 | * c-file-style: "linux" | 81 | struct task_struct *to) |
76 | * End: | 82 | { |
77 | */ | 83 | } |
84 | |||
85 | static inline void arch_switch_to_skas(struct task_struct *from, | ||
86 | struct task_struct *to) | ||
87 | { | ||
88 | } | ||
89 | |||
90 | #endif | ||
diff --git a/include/asm-um/segment.h b/include/asm-um/segment.h index 55e40301f625..48775452e2cc 100644 --- a/include/asm-um/segment.h +++ b/include/asm-um/segment.h | |||
@@ -1,4 +1,6 @@ | |||
1 | #ifndef __UM_SEGMENT_H | 1 | #ifndef __UM_SEGMENT_H |
2 | #define __UM_SEGMENT_H | 2 | #define __UM_SEGMENT_H |
3 | 3 | ||
4 | #include "asm/arch/segment.h" | ||
5 | |||
4 | #endif | 6 | #endif |