18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * ldt.h 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Definitions of structures used with the modify_ldt system call. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci#ifndef _ASM_X86_LDT_H 88c2ecf20Sopenharmony_ci#define _ASM_X86_LDT_H 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci/* Maximum number of LDT entries supported. */ 118c2ecf20Sopenharmony_ci#define LDT_ENTRIES 8192 128c2ecf20Sopenharmony_ci/* The size of each LDT entry. */ 138c2ecf20Sopenharmony_ci#define LDT_ENTRY_SIZE 8 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_ci#ifndef __ASSEMBLY__ 168c2ecf20Sopenharmony_ci/* 178c2ecf20Sopenharmony_ci * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS 188c2ecf20Sopenharmony_ci * not to the default values if you still want to do syscalls. This 198c2ecf20Sopenharmony_ci * call is more for 32bit mode therefore. 208c2ecf20Sopenharmony_ci */ 218c2ecf20Sopenharmony_cistruct user_desc { 228c2ecf20Sopenharmony_ci unsigned int entry_number; 238c2ecf20Sopenharmony_ci unsigned int base_addr; 248c2ecf20Sopenharmony_ci unsigned int limit; 258c2ecf20Sopenharmony_ci unsigned int seg_32bit:1; 268c2ecf20Sopenharmony_ci unsigned int contents:2; 278c2ecf20Sopenharmony_ci unsigned int read_exec_only:1; 288c2ecf20Sopenharmony_ci unsigned int limit_in_pages:1; 298c2ecf20Sopenharmony_ci unsigned int seg_not_present:1; 308c2ecf20Sopenharmony_ci unsigned int useable:1; 318c2ecf20Sopenharmony_ci#ifdef __x86_64__ 328c2ecf20Sopenharmony_ci /* 338c2ecf20Sopenharmony_ci * Because this bit is not present in 32-bit user code, user 348c2ecf20Sopenharmony_ci * programs can pass uninitialized values here. Therefore, in 358c2ecf20Sopenharmony_ci * any context in which a user_desc comes from a 32-bit program, 368c2ecf20Sopenharmony_ci * the kernel must act as though lm == 0, regardless of the 378c2ecf20Sopenharmony_ci * actual value. 388c2ecf20Sopenharmony_ci */ 398c2ecf20Sopenharmony_ci unsigned int lm:1; 408c2ecf20Sopenharmony_ci#endif 418c2ecf20Sopenharmony_ci}; 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ci#define MODIFY_LDT_CONTENTS_DATA 0 448c2ecf20Sopenharmony_ci#define MODIFY_LDT_CONTENTS_STACK 1 458c2ecf20Sopenharmony_ci#define MODIFY_LDT_CONTENTS_CODE 2 468c2ecf20Sopenharmony_ci 478c2ecf20Sopenharmony_ci#endif /* !__ASSEMBLY__ */ 488c2ecf20Sopenharmony_ci#endif /* _ASM_X86_LDT_H */ 49