162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _SYSDEP_TLS_H
362306a36Sopenharmony_ci#define _SYSDEP_TLS_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci#ifdef __UM_HOST__
662306a36Sopenharmony_ci
762306a36Sopenharmony_ci/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
862306a36Sopenharmony_ci * may be named user_desc (but in 2.4 and in header matching its API was named
962306a36Sopenharmony_ci * modify_ldt_ldt_s). */
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_citypedef struct um_dup_user_desc {
1262306a36Sopenharmony_ci	unsigned int  entry_number;
1362306a36Sopenharmony_ci	unsigned int  base_addr;
1462306a36Sopenharmony_ci	unsigned int  limit;
1562306a36Sopenharmony_ci	unsigned int  seg_32bit:1;
1662306a36Sopenharmony_ci	unsigned int  contents:2;
1762306a36Sopenharmony_ci	unsigned int  read_exec_only:1;
1862306a36Sopenharmony_ci	unsigned int  limit_in_pages:1;
1962306a36Sopenharmony_ci	unsigned int  seg_not_present:1;
2062306a36Sopenharmony_ci	unsigned int  useable:1;
2162306a36Sopenharmony_ci#ifdef __x86_64__
2262306a36Sopenharmony_ci	unsigned int  lm:1;
2362306a36Sopenharmony_ci#endif
2462306a36Sopenharmony_ci} user_desc_t;
2562306a36Sopenharmony_ci
2662306a36Sopenharmony_ci#else /* __UM_HOST__ */
2762306a36Sopenharmony_ci
2862306a36Sopenharmony_citypedef struct user_desc user_desc_t;
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_ci#endif /* __UM_HOST__ */
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciextern int os_set_thread_area(user_desc_t *info, int pid);
3362306a36Sopenharmony_ciextern int os_get_thread_area(user_desc_t *info, int pid);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#ifdef __i386__
3662306a36Sopenharmony_ci#define GDT_ENTRY_TLS_MIN_I386 6
3762306a36Sopenharmony_ci#define GDT_ENTRY_TLS_MIN_X86_64 12
3862306a36Sopenharmony_ci#endif
3962306a36Sopenharmony_ci
4062306a36Sopenharmony_ci#endif /* _SYSDEP_TLS_H */
41