aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/um/shared
diff options
context:
space:
mode:
authorAl Viro <viro@ftp.linux.org.uk>2011-08-18 15:09:29 -0400
committerRichard Weinberger <richard@nod.at>2011-11-02 09:15:15 -0400
commit2014d01878a8c38111eba3333f0d70ceb91f0bb7 (patch)
tree12ef1cec8ca70acaa3cdebafe243ea73d3da9679 /arch/x86/um/shared
parent09e129a6038ead049b3ee509475420963f052a80 (diff)
um: merge host_ldt_{32,64}.h
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'arch/x86/um/shared')
-rw-r--r--arch/x86/um/shared/sysdep/host_ldt.h38
-rw-r--r--arch/x86/um/shared/sysdep/host_ldt_32.h34
-rw-r--r--arch/x86/um/shared/sysdep/host_ldt_64.h38
3 files changed, 35 insertions, 75 deletions
diff --git a/arch/x86/um/shared/sysdep/host_ldt.h b/arch/x86/um/shared/sysdep/host_ldt.h
index 94518b3e0da5..246ff7ace5e5 100644
--- a/arch/x86/um/shared/sysdep/host_ldt.h
+++ b/arch/x86/um/shared/sysdep/host_ldt.h
@@ -1,5 +1,37 @@
1#ifdef __i386__ 1#ifndef __ASM_HOST_LDT_H
2#include "host_ldt_32.h" 2#define __ASM_HOST_LDT_H
3
4#include <asm/ldt.h>
5
6#define LDT_entry_a(info) \
7 ((((info)->base_addr & 0x0000ffff) << 16) | ((info)->limit & 0x0ffff))
8
9#define LDT_entry_b(info) \
10 (((info)->base_addr & 0xff000000) | \
11 (((info)->base_addr & 0x00ff0000) >> 16) | \
12 ((info)->limit & 0xf0000) | \
13 (((info)->read_exec_only ^ 1) << 9) | \
14 ((info)->contents << 10) | \
15 (((info)->seg_not_present ^ 1) << 15) | \
16 ((info)->seg_32bit << 22) | \
17 ((info)->limit_in_pages << 23) | \
18 ((info)->useable << 20) | \
19 0x7000)
20
21#define _LDT_empty(info) (\
22 (info)->base_addr == 0 && \
23 (info)->limit == 0 && \
24 (info)->contents == 0 && \
25 (info)->read_exec_only == 1 && \
26 (info)->seg_32bit == 0 && \
27 (info)->limit_in_pages == 0 && \
28 (info)->seg_not_present == 1 && \
29 (info)->useable == 0 )
30
31#ifdef CONFIG_X86_64
32#define LDT_empty(info) (_LDT_empty(info) && ((info)->lm == 0))
3#else 33#else
4#include "host_ldt_64.h" 34#define LDT_empty(info) (_LDT_empty(info))
35#endif
36
5#endif 37#endif
diff --git a/arch/x86/um/shared/sysdep/host_ldt_32.h b/arch/x86/um/shared/sysdep/host_ldt_32.h
deleted file mode 100644
index 0953cc4df652..000000000000
--- a/arch/x86/um/shared/sysdep/host_ldt_32.h
+++ /dev/null
@@ -1,34 +0,0 @@
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/x86/um/shared/sysdep/host_ldt_64.h b/arch/x86/um/shared/sysdep/host_ldt_64.h
deleted file mode 100644
index e8b1be1e154f..000000000000
--- a/arch/x86/um/shared/sysdep/host_ldt_64.h
+++ /dev/null
@@ -1,38 +0,0 @@
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