]>
Commit | Line | Data |
---|---|---|
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 | |
26 | arch_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 | |
34 | The | |
e511ffb6 | 35 | .BR arch_prctl () |
fea681da MK |
36 | function sets architecture specific process or thread state. |
37 | .I code | |
38 | selects a subfunction | |
39 | and passes argument | |
40 | .I addr | |
41 | to it. | |
42 | .LP | |
43 | Sub functions for x86-64 are: | |
44 | .TP | |
45 | .B ARCH_SET_FS | |
46 | Set the 64bit base for the | |
47 | .I FS | |
48 | register to | |
49 | .IR addr . | |
50 | .TP | |
51 | .B ARCH_GET_FS | |
52 | Return the 64bit base value for the | |
53 | .I FS | |
54 | register of the current thread in the | |
55 | .I unsigned long | |
56 | pointed to by the | |
57 | .I address | |
58 | parameter | |
59 | .TP | |
60 | .B ARCH_SET_GS | |
61 | Set the 64bit base for the | |
62 | .I GS | |
63 | register to | |
64 | .IR addr . | |
65 | .TP | |
66 | .B ARCH_GET_GS | |
67 | Return the 64bit base value for the | |
68 | .I GS | |
69 | register of the current thread in the | |
70 | .I unsigned long | |
71 | pointed to by the | |
72 | .I address | |
73 | parameter. | |
74 | .SH NOTES | |
e1d6264d | 75 | .IR arch_prctl () |
fea681da MK |
76 | is only supported on Linux/x86-64 for 64bit programs currently. |
77 | ||
78 | The 64bit base changes when a new 32bit segment selector is loaded. | |
79 | ||
80 | .B ARCH_SET_GS | |
81 | is disabled in some kernels. | |
82 | ||
83 | Context switches for 64bit segment bases are rather expensive. It may be a | |
84 | faster alternative to set a 32bit base using a segment selector by setting up | |
85 | an LDT with | |
86 | .BR modify_ldt (2) | |
87 | or using the | |
88 | .BR set_thread_area (2) | |
89 | system call in a 2.5 kernel. | |
e511ffb6 | 90 | .BR arch_prctl () |
fea681da MK |
91 | is only needed when you want to set bases that are larger than 4GB. |
92 | Memory in the first 2GB of address space can be allocated by using | |
93 | .BR mmap (2) | |
94 | with the | |
95 | .I MAP_32BIT | |
96 | flag. | |
97 | ||
98 | No prototype for | |
e1d6264d | 99 | .IR arch_prctl () |
fea681da MK |
100 | in glibc 2.2. You have to declare it yourself for now. |
101 | This will be fixed in future glibc versions. | |
102 | ||
103 | .I FS | |
104 | may be already used by the threading library. | |
105 | .SH ERRORS | |
106 | .TP | |
107 | .B EFAULT | |
108 | .I addr | |
109 | points to an unmapped address or is outside the process address space. | |
110 | .TP | |
111 | .B EINVAL | |
112 | .I code | |
113 | is not a valid subcommand. | |
114 | .TP | |
115 | .B EPERM | |
116 | .I addr | |
117 | is outside the process address space. | |
118 | .SH AUTHOR | |
119 | Man page written by Andi Kleen. | |
120 | .SH CONFORMANCE | |
e1d6264d | 121 | .IR arch_prctl () |
fea681da MK |
122 | is 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 | |
129 | AMD X86-64 Programmer's manual |