.\" Copyright (C) 2003 Andi Kleen .\" .\" %%%LICENSE_START(VERBATIM) .\" Permission is granted to make and distribute verbatim copies of this .\" manual provided the copyright notice and this permission notice are .\" preserved on all copies. .\" .\" Permission is granted to copy and distribute modified versions of this .\" manual under the conditions for verbatim copying, provided that the .\" entire resulting derived work is distributed under the terms of a .\" permission notice identical to this one. .\" .\" Since the Linux kernel and libraries are constantly changing, this .\" manual page may be incorrect or out-of-date. The author(s) assume no .\" responsibility for errors or omissions, or for damages resulting from .\" the use of the information contained herein. The author(s) may not .\" have taken the same level of care in the production of this manual, .\" which is licensed free of charge, as they might when working .\" professionally. .\" .\" Formatted or processed versions of this manual, if unaccompanied by .\" the source, must acknowledge the copyright and authors of this work. .\" %%%LICENSE_END .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .\" .\" Japanese Version Copyright (c) 2004 Yuichi SATO .\" all rights reserved. .\" Translated 2004-06-08, Yuichi SATO .\" Updated 2005-11-19, Akihiro MOTOKI .\" Updated 2008-02-10, Akihiro MOTOKI , LDP v2.77 .\" .TH ARCH_PRCTL 2 2020\-04\-11 Linux "Linux Programmer's Manual" .SH 名前 arch_prctl \- アーキテクチャー固有のスレッド状態を設定する .SH 書式 .nf \fB#include \fP \fB#include \fP .PP \fBint arch_prctl(int \fP\fIcode\fP\fB, unsigned long \fP\fIaddr\fP\fB);\fP \fBint arch_prctl(int \fP\fIcode\fP\fB, unsigned long *\fP\fIaddr\fP\fB);\fP .fi .SH 説明 \fBarch_prctl\fP() はアーキテクチャー固有のプロセス状態またはスレッド状態を設定する。 \fIcode\fP は副機能を選択し、引数 \fIaddr\fP を副機能に渡す。 \fIaddr\fP は、"set" 操作では \fIunsigned long\fP として、"get" 操作では \fIunsigned long\ *\fP として解釈される。 .PP x86 と x86\-64 の両方での使える副機能は以下の通り: .TP \fBARCH_SET_CPUID\fP (Linux 4.12 以降) .\" commit e9ea1e7f53b852147cbd568b0568c7ad97ec21a3 Enable (\fIaddr != 0\fP) or disable (\fIaddr == 0\fP) the \fIcpuid\fP instruction for the calling thread. The instruction is enabled by default. If disabled, any execution of a \fIcpuid\fP instruction will instead generate a \fBSIGSEGV\fP signal. This feature can be used to emulate \fIcpuid\fP results that differ from what the underlying hardware would have produced (e.g., in a paravirtualization setting). .IP The \fBARCH_SET_CPUID\fP setting is preserved across \fBfork\fP(2) and \fBclone\fP(2) but reset to the default (i.e., \fIcpuid\fP enabled) on \fBexecve\fP(2). .TP \fBARCH_GET_CPUID\fP (Linux 4.12 以降) Return the setting of the flag manipulated by \fBARCH_SET_CPUID\fP as the result of the system call (1 for enabled, 0 for disabled). \fIaddr\fP is ignored. .TP x86\-64 のみで使える副機能は以下の通り: .TP \fBARCH_SET_FS\fP \fIFS\fP レジスターの 64 ビットベースを \fIaddr\fP に設定する。 .TP \fBARCH_GET_FS\fP 呼び出し元のスレッドの \fIFS\fP レジスターの 64 ビットベース値を、 \fIaddr\fP が指す \fIunsigned long\fP の領域に格納する。 .TP \fBARCH_SET_GS\fP \fIGS\fP レジスターの 64 ビットベースを \fIaddr\fP に設定する。 .TP \fBARCH_GET_GS\fP 呼び出し元のスレッドの \fIGS\fP レジスターの 64 ビットベース値を、 \fIaddr\fP が指す \fIunsigned long\fP の領域に格納する。 .SH 返り値 成功すると、 \fBarch_prctl\fP() は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP をエラーを示す値に設定する。 .SH エラー .TP \fBEFAULT\fP \fIaddr\fP がアンマップされたアドレスを指しているか、プロセスのアドレス空間の外にある。 .TP \fBEINVAL\fP \fIcode\fP が有効なサブコマンドでない。 .TP \fBEPERM\fP \fIaddr\fP がプロセスのアドレス空間の外にある。 .TP \fBENODEV\fP .\" .SH AUTHOR .\" Man page written by Andi Kleen. \fBARCH_SET_CPUID\fP was requested, but the underlying hardware does not support CPUID faulting. .SH 準拠 \fBarch_prctl\fP() は Linux/x86\-64 拡張であり、移植性を意図したプログラムでは使うべきでない。 .SH 注意 \fBarch_prctl\fP() は現在のところ Linux/x86\-64 上の 64 ビットプログラムでのみサポートされている。 .PP 新しい 32 ビットセグメントセレクタがロードされた場合、 64 ビットベースは変更される。 .PP \fBARCH_SET_GS\fP が無効にされているカーネルもある。 .PP Context switches for 64\-bit segment bases are rather expensive. As an optimization, if a 32\-bit TLS base address is used, \fBarch_prctl\fP() may use a real TLS entry as if \fBset_thread_area\fP(2) had been called, instead of manipulating the segment base register directly. Memory in the first 2\ GB of address space can be allocated by using \fBmmap\fP(2) with the \fBMAP_32BIT\fP flag. .PP Because of the aforementioned optimization, using \fBarch_prctl\fP() and \fBset_thread_area\fP(2) in the same thread is dangerous, as they may overwrite each other's TLS entries. .PP バージョン 2.7 時点では、glibc には \fBarch_prctl\fP() のプロトタイプがない。 今のところユーザーは自分自身で宣言する必要がある。 これは将来の glibc のバージョンで修正されるかもしれない。 .PP \fIFS\fP may be already used by the threading library. Programs that use \fBARCH_SET_FS\fP directly are very likely to crash. .SH 関連項目 \fBmmap\fP(2), \fBmodify_ldt\fP(2), \fBprctl\fP(2), \fBset_thread_area\fP(2) .PP AMD X86\-64 Programmer's manual .SH この文書について この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 5.10 の一部である。プロジェクトの説明とバグ報告に関する情報は \%https://www.kernel.org/doc/man\-pages/ に書かれている。