18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _SYSDEP_TLS_H
38c2ecf20Sopenharmony_ci#define _SYSDEP_TLS_H
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#ifdef __UM_HOST__
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci/* Change name to avoid conflicts with the original one from <asm/ldt.h>, which
88c2ecf20Sopenharmony_ci * may be named user_desc (but in 2.4 and in header matching its API was named
98c2ecf20Sopenharmony_ci * modify_ldt_ldt_s). */
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_citypedef struct um_dup_user_desc {
128c2ecf20Sopenharmony_ci	unsigned int  entry_number;
138c2ecf20Sopenharmony_ci	unsigned int  base_addr;
148c2ecf20Sopenharmony_ci	unsigned int  limit;
158c2ecf20Sopenharmony_ci	unsigned int  seg_32bit:1;
168c2ecf20Sopenharmony_ci	unsigned int  contents:2;
178c2ecf20Sopenharmony_ci	unsigned int  read_exec_only:1;
188c2ecf20Sopenharmony_ci	unsigned int  limit_in_pages:1;
198c2ecf20Sopenharmony_ci	unsigned int  seg_not_present:1;
208c2ecf20Sopenharmony_ci	unsigned int  useable:1;
218c2ecf20Sopenharmony_ci#ifdef __x86_64__
228c2ecf20Sopenharmony_ci	unsigned int  lm:1;
238c2ecf20Sopenharmony_ci#endif
248c2ecf20Sopenharmony_ci} user_desc_t;
258c2ecf20Sopenharmony_ci
268c2ecf20Sopenharmony_ci#else /* __UM_HOST__ */
278c2ecf20Sopenharmony_ci
288c2ecf20Sopenharmony_citypedef struct user_desc user_desc_t;
298c2ecf20Sopenharmony_ci
308c2ecf20Sopenharmony_ci#endif /* __UM_HOST__ */
318c2ecf20Sopenharmony_ci
328c2ecf20Sopenharmony_ciextern int os_set_thread_area(user_desc_t *info, int pid);
338c2ecf20Sopenharmony_ciextern int os_get_thread_area(user_desc_t *info, int pid);
348c2ecf20Sopenharmony_ci
358c2ecf20Sopenharmony_ci#ifdef __i386__
368c2ecf20Sopenharmony_ci#define GDT_ENTRY_TLS_MIN_I386 6
378c2ecf20Sopenharmony_ci#define GDT_ENTRY_TLS_MIN_X86_64 12
388c2ecf20Sopenharmony_ci#endif
398c2ecf20Sopenharmony_ci
408c2ecf20Sopenharmony_ci#endif /* _SYSDEP_TLS_H */
41