set_thread_area.2: Minor tweaks to Eugene's changes

Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
This commit is contained in:
Michael Kerrisk 2018-05-02 13:37:59 +02:00
parent f7c3bc5ce6
commit e7871dadf9
1 changed files with 20 additions and 12 deletions

View File

@ -48,12 +48,12 @@ allows storing an arbitrary pointer (provided in the
.B tp
argument on m68k and in the
.B addr
argument on MIPS) in kernel's structure associated with the caller thread
and then retrieving it via the
argument on MIPS)
in the kernel data structure associated with the calling thread;
this pointer can later be retrieved using
.BR get_thread_area ()
syscall (see also
.I NOTES
for the information regarding obtaining thread pointer on MIPS).
(see also NOTES
for information regarding obtaining the thread pointer on MIPS).
.PP
On x86, Linux dedicates three global descriptor table (GDT) entries for
thread-local storage.
@ -130,19 +130,19 @@ Since Linux 3.19,
cannot be used to write non-present segments, 16-bit segments, or code
segments, although clearing a segment is still acceptable.
.SH RETURN VALUE
On x86, these syscalls
On x86, these system calls
return 0 on success, and \-1 on failure, with
.I errno
set appropriately.
.PP
On MIPS and m68k,
.BR set_thread_area ()
syscall always returns 0.
always returns 0.
On m68k,
.BR get_thread_area ()
syscall returns (previously set via
.BR set_thread_area ())
thread area pointer value.
returns the thread area pointer value
(previously set via
.BR set_thread_area ()).
.SH ERRORS
.TP
.B EFAULT
@ -186,8 +186,16 @@ This is not normally a problem, as
.BR arch_prctl (2)
is normally used only by 64-bit programs.
.PP
On MIPS, in order to obtain thread area pointer, "rdhwr dest, $29" instruction
can be used; it traps and is handled by kernel.
On MIPS, the current value of the thread area pointer can be obtained
using the instruction:
.PP
.in +4n
.EX
rdhwr dest, $29
.EE
.in
.PP
This instruction traps and is handled by kernel.
.SH BUGS
On 64-bit kernels before Linux 3.19,
.\" commit e30ab185c490e9a9381385529e0fd32f0a399495