Commit f6a2e7f2012eeced1dbf093bb98a1c38fee91f78

Authored by Thomas Gleixner
Committed by Thomas Gleixner
1 parent 686d8c63d5

x86: unify include/asm/ldt_32/64.h

The additional struct member of user_desc can be made conditional for
64 bit compiles.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Ingo Molnar <mingo@elte.hu>

Showing 4 changed files with 39 additions and 82 deletions Side-by-side Diff

include/asm-x86/Kbuild
... ... @@ -4,8 +4,6 @@
4 4 header-y += debugreg_32.h
5 5 header-y += debugreg_64.h
6 6 header-y += debugreg.h
7   -header-y += ldt_32.h
8   -header-y += ldt_64.h
9 7 header-y += ldt.h
10 8 header-y += msr-index.h
11 9 header-y += prctl.h
include/asm-x86/ldt.h
1   -#ifdef __KERNEL__
2   -# ifdef CONFIG_X86_32
3   -# include "ldt_32.h"
4   -# else
5   -# include "ldt_64.h"
6   -# endif
7   -#else
8   -# ifdef __i386__
9   -# include "ldt_32.h"
10   -# else
11   -# include "ldt_64.h"
12   -# endif
  1 +/*
  2 + * ldt.h
  3 + *
  4 + * Definitions of structures used with the modify_ldt system call.
  5 + */
  6 +#ifndef _ASM_X86_LDT_H
  7 +#define _ASM_X86_LDT_H
  8 +
  9 +/* Maximum number of LDT entries supported. */
  10 +#define LDT_ENTRIES 8192
  11 +/* The size of each LDT entry. */
  12 +#define LDT_ENTRY_SIZE 8
  13 +
  14 +#ifndef __ASSEMBLY__
  15 +/*
  16 + * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS
  17 + * not to the default values if you still want to do syscalls. This
  18 + * call is more for 32bit mode therefore.
  19 + */
  20 +struct user_desc {
  21 + unsigned int entry_number;
  22 + unsigned int base_addr;
  23 + unsigned int limit;
  24 + unsigned int seg_32bit:1;
  25 + unsigned int contents:2;
  26 + unsigned int read_exec_only:1;
  27 + unsigned int limit_in_pages:1;
  28 + unsigned int seg_not_present:1;
  29 + unsigned int useable:1;
  30 +#ifdef __x86_64__
  31 + unsigned int lm:1;
  32 +#endif
  33 +};
  34 +
  35 +#define MODIFY_LDT_CONTENTS_DATA 0
  36 +#define MODIFY_LDT_CONTENTS_STACK 1
  37 +#define MODIFY_LDT_CONTENTS_CODE 2
  38 +
  39 +#endif /* !__ASSEMBLY__ */
13 40 #endif
include/asm-x86/ldt_32.h
1   -/*
2   - * ldt.h
3   - *
4   - * Definitions of structures used with the modify_ldt system call.
5   - */
6   -#ifndef _LINUX_LDT_H
7   -#define _LINUX_LDT_H
8   -
9   -/* Maximum number of LDT entries supported. */
10   -#define LDT_ENTRIES 8192
11   -/* The size of each LDT entry. */
12   -#define LDT_ENTRY_SIZE 8
13   -
14   -#ifndef __ASSEMBLY__
15   -struct user_desc {
16   - unsigned int entry_number;
17   - unsigned long base_addr;
18   - unsigned int limit;
19   - unsigned int seg_32bit:1;
20   - unsigned int contents:2;
21   - unsigned int read_exec_only:1;
22   - unsigned int limit_in_pages:1;
23   - unsigned int seg_not_present:1;
24   - unsigned int useable:1;
25   -};
26   -
27   -#define MODIFY_LDT_CONTENTS_DATA 0
28   -#define MODIFY_LDT_CONTENTS_STACK 1
29   -#define MODIFY_LDT_CONTENTS_CODE 2
30   -
31   -#endif /* !__ASSEMBLY__ */
32   -#endif
include/asm-x86/ldt_64.h
1   -/*
2   - * ldt.h
3   - *
4   - * Definitions of structures used with the modify_ldt system call.
5   - */
6   -#ifndef _LINUX_LDT_H
7   -#define _LINUX_LDT_H
8   -
9   -/* Maximum number of LDT entries supported. */
10   -#define LDT_ENTRIES 8192
11   -/* The size of each LDT entry. */
12   -#define LDT_ENTRY_SIZE 8
13   -
14   -#ifndef __ASSEMBLY__
15   -/* Note on 64bit base and limit is ignored and you cannot set
16   - DS/ES/CS not to the default values if you still want to do syscalls. This
17   - call is more for 32bit mode therefore. */
18   -struct user_desc {
19   - unsigned int entry_number;
20   - unsigned int base_addr;
21   - unsigned int limit;
22   - unsigned int seg_32bit:1;
23   - unsigned int contents:2;
24   - unsigned int read_exec_only:1;
25   - unsigned int limit_in_pages:1;
26   - unsigned int seg_not_present:1;
27   - unsigned int useable:1;
28   - unsigned int lm:1;
29   -};
30   -
31   -#define MODIFY_LDT_CONTENTS_DATA 0
32   -#define MODIFY_LDT_CONTENTS_STACK 1
33   -#define MODIFY_LDT_CONTENTS_CODE 2
34   -
35   -#endif /* !__ASSEMBLY__ */
36   -#endif