diff options
author | Bodo Stroesser <bstroesser@fujitsu-siemens.com> | 2005-11-07 03:58:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-07 10:53:31 -0500 |
commit | 858259cf7d1c443c836a2022b78cb281f0a9b95e (patch) | |
tree | 7d306450dd0dfa907bbee1d95f96191c67f74232 /include | |
parent | e763b793f7e5c09a859fc420eb0de385d80cf636 (diff) |
[PATCH] uml: maintain own LDT entries
Patch imlements full LDT handling in SKAS:
* UML holds it's own LDT table, used to deliver data on
modify_ldt(READ)
* UML disables the default_ldt, inherited from the host (SKAS3)
or resets LDT entries, set by host's clib and inherited in
SKAS0
* A new global variable skas_needs_stub is inserted, that
can be used to decide, whether stub-pages must be supported
or not.
* Uses the syscall-stub to replace missing PTRACE_LDT (therefore,
write_ldt_entry needs to be modified)
Signed-off-by: Bodo Stroesser <bstroesser@fujitsu-siemens.com>
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Cc: Paolo Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-um/ldt-i386.h | 69 | ||||
-rw-r--r-- | include/asm-um/ldt.h | 69 |
2 files changed, 138 insertions, 0 deletions
diff --git a/include/asm-um/ldt-i386.h b/include/asm-um/ldt-i386.h new file mode 100644 index 000000000000..b42662929b6c --- /dev/null +++ b/include/asm-um/ldt-i386.h | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
3 | * Licensed under the GPL | ||
4 | * | ||
5 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
6 | */ | ||
7 | |||
8 | #ifndef __ASM_LDT_I386_H | ||
9 | #define __ASM_LDT_I386_H | ||
10 | |||
11 | #include "asm/semaphore.h" | ||
12 | #include "asm/arch/ldt.h" | ||
13 | |||
14 | struct mmu_context_skas; | ||
15 | extern void ldt_host_info(void); | ||
16 | extern long init_new_ldt(struct mmu_context_skas * to_mm, | ||
17 | struct mmu_context_skas * from_mm); | ||
18 | extern void free_ldt(struct mmu_context_skas * mm); | ||
19 | |||
20 | #define LDT_PAGES_MAX \ | ||
21 | ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) | ||
22 | #define LDT_ENTRIES_PER_PAGE \ | ||
23 | (PAGE_SIZE/LDT_ENTRY_SIZE) | ||
24 | #define LDT_DIRECT_ENTRIES \ | ||
25 | ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE) | ||
26 | |||
27 | struct ldt_entry { | ||
28 | __u32 a; | ||
29 | __u32 b; | ||
30 | }; | ||
31 | |||
32 | typedef struct uml_ldt { | ||
33 | int entry_count; | ||
34 | struct semaphore semaphore; | ||
35 | union { | ||
36 | struct ldt_entry * pages[LDT_PAGES_MAX]; | ||
37 | struct ldt_entry entries[LDT_DIRECT_ENTRIES]; | ||
38 | }; | ||
39 | } uml_ldt_t; | ||
40 | |||
41 | /* | ||
42 | * macros stolen from include/asm-i386/desc.h | ||
43 | */ | ||
44 | #define LDT_entry_a(info) \ | ||
45 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
46 | |||
47 | #define LDT_entry_b(info) \ | ||
48 | (((info)->base_addr & 0xff000000) | \ | ||
49 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
50 | ((info)->limit & 0xf0000) | \ | ||
51 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
52 | ((info)->contents << 10) | \ | ||
53 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
54 | ((info)->seg_32bit << 22) | \ | ||
55 | ((info)->limit_in_pages << 23) | \ | ||
56 | ((info)->useable << 20) | \ | ||
57 | 0x7000) | ||
58 | |||
59 | #define LDT_empty(info) (\ | ||
60 | (info)->base_addr == 0 && \ | ||
61 | (info)->limit == 0 && \ | ||
62 | (info)->contents == 0 && \ | ||
63 | (info)->read_exec_only == 1 && \ | ||
64 | (info)->seg_32bit == 0 && \ | ||
65 | (info)->limit_in_pages == 0 && \ | ||
66 | (info)->seg_not_present == 1 && \ | ||
67 | (info)->useable == 0 ) | ||
68 | |||
69 | #endif | ||
diff --git a/include/asm-um/ldt.h b/include/asm-um/ldt.h index e908439d338a..4466ff6de0fd 100644 --- a/include/asm-um/ldt.h +++ b/include/asm-um/ldt.h | |||
@@ -1,3 +1,72 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2004 Fujitsu Siemens Computers GmbH | ||
3 | * Licensed under the GPL | ||
4 | * | ||
5 | * Author: Bodo Stroesser <bstroesser@fujitsu-siemens.com> | ||
6 | */ | ||
7 | |||
8 | #ifndef __ASM_LDT_I386_H | ||
9 | #define __ASM_LDT_I386_H | ||
10 | |||
11 | #include "asm/semaphore.h" | ||
12 | #include "asm/arch/ldt.h" | ||
13 | |||
14 | struct mmu_context_skas; | ||
15 | extern void ldt_host_info(void); | ||
16 | extern long init_new_ldt(struct mmu_context_skas * to_mm, | ||
17 | struct mmu_context_skas * from_mm); | ||
18 | extern void free_ldt(struct mmu_context_skas * mm); | ||
19 | |||
20 | #define LDT_PAGES_MAX \ | ||
21 | ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) | ||
22 | #define LDT_ENTRIES_PER_PAGE \ | ||
23 | (PAGE_SIZE/LDT_ENTRY_SIZE) | ||
24 | #define LDT_DIRECT_ENTRIES \ | ||
25 | ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE) | ||
26 | |||
27 | struct ldt_entry { | ||
28 | __u32 a; | ||
29 | __u32 b; | ||
30 | }; | ||
31 | |||
32 | typedef struct uml_ldt { | ||
33 | int entry_count; | ||
34 | struct semaphore semaphore; | ||
35 | union { | ||
36 | struct ldt_entry * pages[LDT_PAGES_MAX]; | ||
37 | struct ldt_entry entries[LDT_DIRECT_ENTRIES]; | ||
38 | }; | ||
39 | } uml_ldt_t; | ||
40 | |||
41 | /* | ||
42 | * macros stolen from include/asm-i386/desc.h | ||
43 | */ | ||
44 | #define LDT_entry_a(info) \ | ||
45 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
46 | |||
47 | #define LDT_entry_b(info) \ | ||
48 | (((info)->base_addr & 0xff000000) | \ | ||
49 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
50 | ((info)->limit & 0xf0000) | \ | ||
51 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
52 | ((info)->contents << 10) | \ | ||
53 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
54 | ((info)->seg_32bit << 22) | \ | ||
55 | ((info)->limit_in_pages << 23) | \ | ||
56 | ((info)->useable << 20) | \ | ||
57 | 0x7000) | ||
58 | |||
59 | #define LDT_empty(info) (\ | ||
60 | (info)->base_addr == 0 && \ | ||
61 | (info)->limit == 0 && \ | ||
62 | (info)->contents == 0 && \ | ||
63 | (info)->read_exec_only == 1 && \ | ||
64 | (info)->seg_32bit == 0 && \ | ||
65 | (info)->limit_in_pages == 0 && \ | ||
66 | (info)->seg_not_present == 1 && \ | ||
67 | (info)->useable == 0 ) | ||
68 | |||
69 | #endif | ||
1 | #ifndef __UM_LDT_H | 70 | #ifndef __UM_LDT_H |
2 | #define __UM_LDT_H | 71 | #define __UM_LDT_H |
3 | 72 | ||