diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-08-18 01:26:38 -0400 |
---|---|---|
committer | H. Peter Anvin <hpa@zytor.com> | 2008-10-23 01:55:21 -0400 |
commit | efb21cc2384e385c4873ac6e7b23f16659469ea9 (patch) | |
tree | e7da1bf7e0d02327a974ec5724e9209eeb9ec7ef /arch/um/include/shared | |
parent | 5077c2a9cd43e8db71f8257e745e1d27e7b79d3f (diff) |
x86, um: untangle uml ldt.h
* turn asm/ldt.h into ldt.h; update the (very few) users
* take host_ldt.h into sysdep, kill symlink mess
* includes of asm/arch/ldt.h turn into asm/ldt.h now
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'arch/um/include/shared')
-rw-r--r-- | arch/um/include/shared/ldt.h | 37 | ||||
-rw-r--r-- | arch/um/include/shared/sysdep-i386/host_ldt.h | 34 | ||||
-rw-r--r-- | arch/um/include/shared/sysdep-i386/tls.h | 2 | ||||
-rw-r--r-- | arch/um/include/shared/sysdep-x86_64/host_ldt.h | 38 | ||||
-rw-r--r-- | arch/um/include/shared/sysdep-x86_64/tls.h | 2 | ||||
-rw-r--r-- | arch/um/include/shared/um_mmu.h | 2 |
6 files changed, 112 insertions, 3 deletions
diff --git a/arch/um/include/shared/ldt.h b/arch/um/include/shared/ldt.h new file mode 100644 index 000000000000..a7f999a58774 --- /dev/null +++ b/arch/um/include/shared/ldt.h | |||
@@ -0,0 +1,37 @@ | |||
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_H | ||
9 | #define __ASM_LDT_H | ||
10 | |||
11 | #include <linux/mutex.h> | ||
12 | #include <sysdep/host_ldt.h> | ||
13 | |||
14 | extern void ldt_host_info(void); | ||
15 | |||
16 | #define LDT_PAGES_MAX \ | ||
17 | ((LDT_ENTRIES * LDT_ENTRY_SIZE)/PAGE_SIZE) | ||
18 | #define LDT_ENTRIES_PER_PAGE \ | ||
19 | (PAGE_SIZE/LDT_ENTRY_SIZE) | ||
20 | #define LDT_DIRECT_ENTRIES \ | ||
21 | ((LDT_PAGES_MAX*sizeof(void *))/LDT_ENTRY_SIZE) | ||
22 | |||
23 | struct ldt_entry { | ||
24 | __u32 a; | ||
25 | __u32 b; | ||
26 | }; | ||
27 | |||
28 | typedef struct uml_ldt { | ||
29 | int entry_count; | ||
30 | struct mutex lock; | ||
31 | union { | ||
32 | struct ldt_entry * pages[LDT_PAGES_MAX]; | ||
33 | struct ldt_entry entries[LDT_DIRECT_ENTRIES]; | ||
34 | } u; | ||
35 | } uml_ldt_t; | ||
36 | |||
37 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/host_ldt.h b/arch/um/include/shared/sysdep-i386/host_ldt.h new file mode 100644 index 000000000000..0953cc4df652 --- /dev/null +++ b/arch/um/include/shared/sysdep-i386/host_ldt.h | |||
@@ -0,0 +1,34 @@ | |||
1 | #ifndef __ASM_HOST_LDT_I386_H | ||
2 | #define __ASM_HOST_LDT_I386_H | ||
3 | |||
4 | #include <asm/ldt.h> | ||
5 | |||
6 | /* | ||
7 | * macros stolen from include/asm-i386/desc.h | ||
8 | */ | ||
9 | #define LDT_entry_a(info) \ | ||
10 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
11 | |||
12 | #define LDT_entry_b(info) \ | ||
13 | (((info)->base_addr & 0xff000000) | \ | ||
14 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
15 | ((info)->limit & 0xf0000) | \ | ||
16 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
17 | ((info)->contents << 10) | \ | ||
18 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
19 | ((info)->seg_32bit << 22) | \ | ||
20 | ((info)->limit_in_pages << 23) | \ | ||
21 | ((info)->useable << 20) | \ | ||
22 | 0x7000) | ||
23 | |||
24 | #define LDT_empty(info) (\ | ||
25 | (info)->base_addr == 0 && \ | ||
26 | (info)->limit == 0 && \ | ||
27 | (info)->contents == 0 && \ | ||
28 | (info)->read_exec_only == 1 && \ | ||
29 | (info)->seg_32bit == 0 && \ | ||
30 | (info)->limit_in_pages == 0 && \ | ||
31 | (info)->seg_not_present == 1 && \ | ||
32 | (info)->useable == 0 ) | ||
33 | |||
34 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-i386/tls.h b/arch/um/include/shared/sysdep-i386/tls.h index 918fd3c5ff9c..34550755b2a1 100644 --- a/arch/um/include/shared/sysdep-i386/tls.h +++ b/arch/um/include/shared/sysdep-i386/tls.h | |||
@@ -21,7 +21,7 @@ typedef struct um_dup_user_desc { | |||
21 | 21 | ||
22 | # else /* __KERNEL__ */ | 22 | # else /* __KERNEL__ */ |
23 | 23 | ||
24 | # include <asm/ldt.h> | 24 | # include <ldt.h> |
25 | typedef struct user_desc user_desc_t; | 25 | typedef struct user_desc user_desc_t; |
26 | 26 | ||
27 | # endif /* __KERNEL__ */ | 27 | # endif /* __KERNEL__ */ |
diff --git a/arch/um/include/shared/sysdep-x86_64/host_ldt.h b/arch/um/include/shared/sysdep-x86_64/host_ldt.h new file mode 100644 index 000000000000..e8b1be1e154f --- /dev/null +++ b/arch/um/include/shared/sysdep-x86_64/host_ldt.h | |||
@@ -0,0 +1,38 @@ | |||
1 | #ifndef __ASM_HOST_LDT_X86_64_H | ||
2 | #define __ASM_HOST_LDT_X86_64_H | ||
3 | |||
4 | #include <asm/ldt.h> | ||
5 | |||
6 | /* | ||
7 | * macros stolen from include/asm-x86_64/desc.h | ||
8 | */ | ||
9 | #define LDT_entry_a(info) \ | ||
10 | ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff)) | ||
11 | |||
12 | /* Don't allow setting of the lm bit. It is useless anyways because | ||
13 | * 64bit system calls require __USER_CS. */ | ||
14 | #define LDT_entry_b(info) \ | ||
15 | (((info)->base_addr & 0xff000000) | \ | ||
16 | (((info)->base_addr & 0x00ff0000) >> 16) | \ | ||
17 | ((info)->limit & 0xf0000) | \ | ||
18 | (((info)->read_exec_only ^ 1) << 9) | \ | ||
19 | ((info)->contents << 10) | \ | ||
20 | (((info)->seg_not_present ^ 1) << 15) | \ | ||
21 | ((info)->seg_32bit << 22) | \ | ||
22 | ((info)->limit_in_pages << 23) | \ | ||
23 | ((info)->useable << 20) | \ | ||
24 | /* ((info)->lm << 21) | */ \ | ||
25 | 0x7000) | ||
26 | |||
27 | #define LDT_empty(info) (\ | ||
28 | (info)->base_addr == 0 && \ | ||
29 | (info)->limit == 0 && \ | ||
30 | (info)->contents == 0 && \ | ||
31 | (info)->read_exec_only == 1 && \ | ||
32 | (info)->seg_32bit == 0 && \ | ||
33 | (info)->limit_in_pages == 0 && \ | ||
34 | (info)->seg_not_present == 1 && \ | ||
35 | (info)->useable == 0 && \ | ||
36 | (info)->lm == 0) | ||
37 | |||
38 | #endif | ||
diff --git a/arch/um/include/shared/sysdep-x86_64/tls.h b/arch/um/include/shared/sysdep-x86_64/tls.h index 35f19f25bd3b..18c000d0357a 100644 --- a/arch/um/include/shared/sysdep-x86_64/tls.h +++ b/arch/um/include/shared/sysdep-x86_64/tls.h | |||
@@ -22,7 +22,7 @@ typedef struct um_dup_user_desc { | |||
22 | 22 | ||
23 | # else /* __KERNEL__ */ | 23 | # else /* __KERNEL__ */ |
24 | 24 | ||
25 | # include <asm/ldt.h> | 25 | # include <ldt.h> |
26 | typedef struct user_desc user_desc_t; | 26 | typedef struct user_desc user_desc_t; |
27 | 27 | ||
28 | # endif /* __KERNEL__ */ | 28 | # endif /* __KERNEL__ */ |
diff --git a/arch/um/include/shared/um_mmu.h b/arch/um/include/shared/um_mmu.h index f575ff91f2a0..4cc1ef4d022b 100644 --- a/arch/um/include/shared/um_mmu.h +++ b/arch/um/include/shared/um_mmu.h | |||
@@ -8,7 +8,7 @@ | |||
8 | 8 | ||
9 | #include "uml-config.h" | 9 | #include "uml-config.h" |
10 | #include "mm_id.h" | 10 | #include "mm_id.h" |
11 | #include "asm/ldt.h" | 11 | #include "ldt.h" |
12 | 12 | ||
13 | typedef struct mm_context { | 13 | typedef struct mm_context { |
14 | struct mm_id id; | 14 | struct mm_id id; |