1 .\" Copyright (C) 2003 Andi Kleen
3 .\" %%%LICENSE_START(VERBATIM)
4 .\" Permission is granted to make and distribute verbatim copies of this
5 .\" manual provided the copyright notice and this permission notice are
6 .\" preserved on all copies.
8 .\" Permission is granted to copy and distribute modified versions of this
9 .\" manual under the conditions for verbatim copying, provided that the
10 .\" entire resulting derived work is distributed under the terms of a
11 .\" permission notice identical to this one.
13 .\" Since the Linux kernel and libraries are constantly changing, this
14 .\" manual page may be incorrect or out-of-date. The author(s) assume no
15 .\" responsibility for errors or omissions, or for damages resulting from
16 .\" the use of the information contained herein. The author(s) may not
17 .\" have taken the same level of care in the production of this manual,
18 .\" which is licensed free of charge, as they might when working
21 .\" Formatted or processed versions of this manual, if unaccompanied by
22 .\" the source, must acknowledge the copyright and authors of this work.
25 .TH ARCH_PRCTL 2 2007-12-26 "Linux" "Linux Programmer's Manual"
27 arch_prctl \- set architecture-specific thread state
30 .B #include <asm/prctl.h>
32 .B #include <sys/prctl.h>
34 .BI "int arch_prctl(int " code ", unsigned long " addr );
35 .BI "int arch_prctl(int " code ", unsigned long *" addr );
40 function sets architecture-specific process or thread state.
47 is interpreted as either an
49 for the "set" operations, or as an
50 .IR "unsigned long\ *" ,
51 for the "get" operations.
53 Subfunctions for x86-64 are:
56 Set the 64-bit base for the
62 Return the 64-bit base value for the
64 register of the current thread in the
70 Set the 64-bit base for the
76 Return the 64-bit base value for the
78 register of the current thread in the
85 returns 0; on error, \-1 is returned, and
87 is set to indicate the error.
92 points to an unmapped address or is outside the process address space.
96 is not a valid subcommand.
100 is outside the process address space.
102 .\" Man page written by Andi Kleen.
105 is a Linux/x86-64 extension and should not be used in programs intended
109 is supported only on Linux/x86-64 for 64-bit programs currently.
111 The 64-bit base changes when a new 32-bit segment selector is loaded.
114 is disabled in some kernels.
116 Context switches for 64-bit segment bases are rather expensive.
117 It may be a faster alternative to set a 32-bit base using a
118 segment selector by setting up an LDT with
121 .BR set_thread_area (2)
122 system call in kernel 2.5 or later.
124 is needed only when you want to set bases that are larger than 4GB.
125 Memory in the first 2GB of address space can be allocated by using
131 As of version 2.7, glibc provides no prototype for
133 You have to declare it yourself for now.
134 This may be fixed in future glibc versions.
137 may be already used by the threading library.
142 .BR set_thread_area (2)
144 AMD X86-64 Programmer's manual
146 This page is part of release 3.68 of the Linux
149 A description of the project,
150 information about reporting bugs,
151 and the latest version of this page,
153 \%http://www.kernel.org/doc/man\-pages/.