1 .\" Hey Emacs! This file is -*- nroff -*- source.
3 .\" Copyright (C) 2003 Andi Kleen
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.
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.
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
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 2007-12-26 "Linux" "Linux Programmer's Manual"
26 arch_prctl \- set architecture-specific thread state
29 .B #include <asm/prctl.h>
31 .B #include <sys/prctl.h>
33 .BI "int arch_prctl(int " code ", unsigned long " addr );
34 .BI "int arch_prctl(int " code ", unsigned long *" addr );
39 function sets architecture-specific process or thread state.
46 is interpreted as either an
48 for the "set" operations, or as an
49 .IR "unsigned long *" ,
50 for the "get" operations.
52 Sub functions for x86-64 are:
55 Set the 64-bit base for the
61 Return the 64-bit base value for the
63 register of the current thread in the
69 Set the 64-bit base for the
75 Return the 64-bit base value for the
77 register of the current thread in the
84 returns 0; on error, \-1 is returned, and
86 is set to indicate the error.
91 points to an unmapped address or is outside the process address space.
95 is not a valid subcommand.
99 is outside the process address space.
101 .\" Man page written by Andi Kleen.
104 is a Linux/x86-64 extension and should not be used in programs intended
108 is only supported on Linux/x86-64 for 64-bit programs currently.
110 The 64-bit base changes when a new 32-bit segment selector is loaded.
113 is disabled in some kernels.
115 Context switches for 64-bit segment bases are rather expensive.
116 It may be a faster alternative to set a 32-bit base using a
117 segment selector by setting up an LDT with
120 .BR set_thread_area (2)
121 system call in kernel 2.5 or later.
123 is only needed when you want to set bases that are larger than 4GB.
124 Memory in the first 2GB of address space can be allocated by using
130 As of version 2.7, glibc provides no prototype for
132 You have to declare it yourself for now.
133 This may be fixed in future glibc versions.
136 may be already used by the threading library.
141 .BR set_thread_area (2)
143 AMD X86-64 Programmer's manual