| 1 | /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ | 
|---|
| 2 | /* | 
|---|
| 3 | * ldt.h | 
|---|
| 4 | * | 
|---|
| 5 | * Definitions of structures used with the modify_ldt system call. | 
|---|
| 6 | */ | 
|---|
| 7 | #ifndef _ASM_X86_LDT_H | 
|---|
| 8 | #define _ASM_X86_LDT_H | 
|---|
| 9 |  | 
|---|
| 10 | /* Maximum number of LDT entries supported. */ | 
|---|
| 11 | #define LDT_ENTRIES	8192 | 
|---|
| 12 | /* The size of each LDT entry. */ | 
|---|
| 13 | #define LDT_ENTRY_SIZE	8 | 
|---|
| 14 |  | 
|---|
| 15 | #ifndef __ASSEMBLER__ | 
|---|
| 16 | /* | 
|---|
| 17 | * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS | 
|---|
| 18 | * not to the default values if you still want to do syscalls. This | 
|---|
| 19 | * call is more for 32bit mode therefore. | 
|---|
| 20 | */ | 
|---|
| 21 | struct user_desc { | 
|---|
| 22 | unsigned int  entry_number; | 
|---|
| 23 | unsigned int  base_addr; | 
|---|
| 24 | unsigned int  limit; | 
|---|
| 25 | unsigned int  seg_32bit:1; | 
|---|
| 26 | unsigned int  contents:2; | 
|---|
| 27 | unsigned int  read_exec_only:1; | 
|---|
| 28 | unsigned int  limit_in_pages:1; | 
|---|
| 29 | unsigned int  seg_not_present:1; | 
|---|
| 30 | unsigned int  useable:1; | 
|---|
| 31 | #ifdef __x86_64__ | 
|---|
| 32 | /* | 
|---|
| 33 | * Because this bit is not present in 32-bit user code, user | 
|---|
| 34 | * programs can pass uninitialized values here.  Therefore, in | 
|---|
| 35 | * any context in which a user_desc comes from a 32-bit program, | 
|---|
| 36 | * the kernel must act as though lm == 0, regardless of the | 
|---|
| 37 | * actual value. | 
|---|
| 38 | */ | 
|---|
| 39 | unsigned int  lm:1; | 
|---|
| 40 | #endif | 
|---|
| 41 | }; | 
|---|
| 42 |  | 
|---|
| 43 | #define MODIFY_LDT_CONTENTS_DATA	0 | 
|---|
| 44 | #define MODIFY_LDT_CONTENTS_STACK	1 | 
|---|
| 45 | #define MODIFY_LDT_CONTENTS_CODE	2 | 
|---|
| 46 |  | 
|---|
| 47 | #endif /* !__ASSEMBLER__ */ | 
|---|
| 48 | #endif /* _ASM_X86_LDT_H */ | 
|---|
| 49 |  | 
|---|