Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:arch\x86\kernel\tls.c Create Date:2022-07-28 07:52:10
Last Modify:2022-05-18 16:59:10 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Set a given TLS descriptor:

Proto:int do_set_thread_area(struct task_struct *p, int idx, struct user_desc __user *u_info, int can_allocate)

Type:int

Parameter:

TypeParameterName
struct task_struct *p
intidx
struct user_desc __user *u_info
intcan_allocate
119  unsigned short __maybe_unused sel, modified_sel
121  If copy_from_user( & info, u_info, size of info ) Then Return -EFAULT
124  If Not tls_desc_okay( & info) Then Return -EINVAL
127  If idx == -1 Then idx = entry_number
134  If idx == -1 && can_allocate Then
135  idx = sys_alloc_thread_area: get a yet unused TLS descriptor index.
136  If idx < 0 Then Return idx
138  If Write a simple value into user space(idx, & entry_number) Then Return -EFAULT
142  If idx < The layout of the per-CPU GDT under Linux:* 0 - null <=== cacheline #1* 1 - reserved* 2 - reserved* 3 - reserved* 4 - unused <=== cacheline #2* 5 - unused* ------- start of TLS (Thread-Local Storage) segments:* 6 - TLS segment #1 [ glibc's TLS segment ]* || idx > GDT_ENTRY_TLS_MAX Then Return -EINVAL
145  set_tls_desc(p, idx, & info, 1)
152  modified_sel = idx << 3 | 3
154  If p == current process Then
156  Save a segment register away:(These functions are used to reference data in other segments. , sel)
157  If sel == modified_sel Then loadsegment(These functions are used to reference data in other segments. , sel)
160  Save a segment register away:(es, sel)
161  If sel == modified_sel Then loadsegment(es, sel)
164  Save a segment register away:(fs, sel)
165  If sel == modified_sel Then loadsegment(fs, sel)
168  Save a segment register away:(gs, sel)
169  If sel == modified_sel Then load_gs_index(sel)
178  Else
180  If fsindex == modified_sel Then fsbase = base_addr
183  If gsindex == modified_sel Then gsbase = base_addr
188  Return 0
Caller
NameDescribe
arch_ptrace