162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * ldt.h
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Definitions of structures used with the modify_ldt system call.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci#ifndef _ASM_X86_LDT_H
862306a36Sopenharmony_ci#define _ASM_X86_LDT_H
962306a36Sopenharmony_ci
1062306a36Sopenharmony_ci/* Maximum number of LDT entries supported. */
1162306a36Sopenharmony_ci#define LDT_ENTRIES	8192
1262306a36Sopenharmony_ci/* The size of each LDT entry. */
1362306a36Sopenharmony_ci#define LDT_ENTRY_SIZE	8
1462306a36Sopenharmony_ci
1562306a36Sopenharmony_ci#ifndef __ASSEMBLY__
1662306a36Sopenharmony_ci/*
1762306a36Sopenharmony_ci * Note on 64bit base and limit is ignored and you cannot set DS/ES/CS
1862306a36Sopenharmony_ci * not to the default values if you still want to do syscalls. This
1962306a36Sopenharmony_ci * call is more for 32bit mode therefore.
2062306a36Sopenharmony_ci */
2162306a36Sopenharmony_cistruct user_desc {
2262306a36Sopenharmony_ci	unsigned int  entry_number;
2362306a36Sopenharmony_ci	unsigned int  base_addr;
2462306a36Sopenharmony_ci	unsigned int  limit;
2562306a36Sopenharmony_ci	unsigned int  seg_32bit:1;
2662306a36Sopenharmony_ci	unsigned int  contents:2;
2762306a36Sopenharmony_ci	unsigned int  read_exec_only:1;
2862306a36Sopenharmony_ci	unsigned int  limit_in_pages:1;
2962306a36Sopenharmony_ci	unsigned int  seg_not_present:1;
3062306a36Sopenharmony_ci	unsigned int  useable:1;
3162306a36Sopenharmony_ci#ifdef __x86_64__
3262306a36Sopenharmony_ci	/*
3362306a36Sopenharmony_ci	 * Because this bit is not present in 32-bit user code, user
3462306a36Sopenharmony_ci	 * programs can pass uninitialized values here.  Therefore, in
3562306a36Sopenharmony_ci	 * any context in which a user_desc comes from a 32-bit program,
3662306a36Sopenharmony_ci	 * the kernel must act as though lm == 0, regardless of the
3762306a36Sopenharmony_ci	 * actual value.
3862306a36Sopenharmony_ci	 */
3962306a36Sopenharmony_ci	unsigned int  lm:1;
4062306a36Sopenharmony_ci#endif
4162306a36Sopenharmony_ci};
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci#define MODIFY_LDT_CONTENTS_DATA	0
4462306a36Sopenharmony_ci#define MODIFY_LDT_CONTENTS_STACK	1
4562306a36Sopenharmony_ci#define MODIFY_LDT_CONTENTS_CODE	2
4662306a36Sopenharmony_ci
4762306a36Sopenharmony_ci#endif /* !__ASSEMBLY__ */
4862306a36Sopenharmony_ci#endif /* _ASM_X86_LDT_H */
49