]> git.ipfire.org Git - thirdparty/man-pages.git/blame - man2/arch_prctl.2
Formatting fixes
[thirdparty/man-pages.git] / man2 / arch_prctl.2
CommitLineData
fea681da
MK
1.\" Hey Emacs! This file is -*- nroff -*- source.
2.\"
3.\" Copyright (C) 2003 Andi Kleen
4.\"
5.\" Permission is granted to make and distribute verbatim copies of this
6.\" manual provided the copyright notice and this permission notice are
7.\" preserved on all copies.
8.\"
9.\" Permission is granted to copy and distribute modified versions of this
10.\" manual under the conditions for verbatim copying, provided that the
11.\" entire resulting derived work is distributed under the terms of a
12.\" permission notice identical to this one.
13.\"
14.\" Since the Linux kernel and libraries are constantly changing, this
15.\" manual page may be incorrect or out-of-date. The author(s) assume no
16.\" responsibility for errors or omissions, or for damages resulting from
17.\" the use of the information contained herein. The author(s) may not
18.\" have taken the same level of care in the production of this manual,
19.\" which is licensed free of charge, as they might when working
20.\" professionally.
21.\"
22.\" Formatted or processed versions of this manual, if unaccompanied by
23.\" the source, must acknowledge the copyright and authors of this work.
24.TH ARCH_PRCTL 2 2003-02-02 "Linux 2.4.20" "Linux Programmer's Manual"
25.SH NAME
26arch_prctl \- set architecture specific thread state
27.SH SYNOPSIS
28.B #include <asm/prctl.h>
29.sp
30.B #include <sys/prctl.h>
31.sp
32.BI "int arch_prctl(int code, unsigned long addr)"
33.SH DESCRIPTION
34The
e511ffb6 35.BR arch_prctl ()
fea681da
MK
36function sets architecture specific process or thread state.
37.I code
38selects a subfunction
39and passes argument
40.I addr
41to it.
42.LP
43Sub functions for x86-64 are:
44.TP
45.B ARCH_SET_FS
46Set the 64bit base for the
47.I FS
48register to
49.IR addr .
50.TP
51.B ARCH_GET_FS
52Return the 64bit base value for the
53.I FS
54register of the current thread in the
55.I unsigned long
56pointed to by the
57.I address
58parameter
59.TP
60.B ARCH_SET_GS
61Set the 64bit base for the
62.I GS
63register to
64.IR addr .
65.TP
66.B ARCH_GET_GS
67Return the 64bit base value for the
68.I GS
69register of the current thread in the
70.I unsigned long
71pointed to by the
72.I address
73parameter.
74.SH NOTES
e1d6264d 75.IR arch_prctl ()
fea681da
MK
76is only supported on Linux/x86-64 for 64bit programs currently.
77
78The 64bit base changes when a new 32bit segment selector is loaded.
79
80.B ARCH_SET_GS
81is disabled in some kernels.
82
83Context switches for 64bit segment bases are rather expensive. It may be a
84faster alternative to set a 32bit base using a segment selector by setting up
85an LDT with
86.BR modify_ldt (2)
87or using the
88.BR set_thread_area (2)
89system call in a 2.5 kernel.
e511ffb6 90.BR arch_prctl ()
fea681da
MK
91is only needed when you want to set bases that are larger than 4GB.
92Memory in the first 2GB of address space can be allocated by using
93.BR mmap (2)
94with the
95.I MAP_32BIT
96flag.
97
98No prototype for
e1d6264d 99.IR arch_prctl ()
fea681da
MK
100in glibc 2.2. You have to declare it yourself for now.
101This will be fixed in future glibc versions.
102
103.I FS
104may be already used by the threading library.
105.SH ERRORS
106.TP
107.B EFAULT
108.I addr
109points to an unmapped address or is outside the process address space.
110.TP
111.B EINVAL
112.I code
113is not a valid subcommand.
114.TP
115.B EPERM
116.I addr
117is outside the process address space.
118.SH AUTHOR
119Man page written by Andi Kleen.
120.SH CONFORMANCE
e1d6264d 121.IR arch_prctl ()
fea681da
MK
122is a Linux/x86-64 extension and should not be used in programs intended to be portable.
123.SH "SEE ALSO"
124.BR mmap (2),
125.BR modify_ldt (2),
126.BR prctl (2),
127.BR set_thread_area (2)
128.sp
129AMD X86-64 Programmer's manual