Documentation/translations/zh_TW/arch/arm/kernel_user_helpers.txt

Source file repositories/reference/linux-study-clean/Documentation/translations/zh_TW/arch/arm/kernel_user_helpers.txt

File Facts

System
Linux kernel
Corpus path
Documentation/translations/zh_TW/arch/arm/kernel_user_helpers.txt
Extension
.txt
Size
7942 bytes
Lines
286
Domain
Support Tooling And Documentation
Bucket
Documentation
Inferred role
Support Tooling And Documentation: documentation
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

Chinese translated version of Documentation/arch/arm/kernel_user_helpers.rst

If you have any comment or update to the content, please contact the
original document maintainer directly.  However, if you have a problem
communicating in English you can also ask the Chinese maintainer for
help.  Contact the Chinese maintainer if this translation is outdated
or if there is a problem with the translation.

Maintainer: Nicolas Pitre <nicolas.pitre@linaro.org>
		Dave Martin <dave.martin@linaro.org>
Chinese maintainer: Fu Wei <tekkamanninja@gmail.com>
---------------------------------------------------------------------
Documentation/arch/arm/kernel_user_helpers.rst 的中文翻譯

如果想評論或更新本文的內容,請直接聯繫原文檔的維護者。如果你使用英文
交流有困難的話,也可以向中文版維護者求助。如果本翻譯更新不及時或者翻
譯存在問題,請聯繫中文版維護者。
英文版維護者: Nicolas Pitre <nicolas.pitre@linaro.org>
		Dave Martin <dave.martin@linaro.org>
中文版維護者: 傅煒 Fu Wei <tekkamanninja@gmail.com>
中文版翻譯者: 傅煒 Fu Wei <tekkamanninja@gmail.com>
中文版校譯者: 宋冬生 Dongsheng Song <dongshneg.song@gmail.com>
		傅煒 Fu Wei <tekkamanninja@gmail.com>


以下爲正文
---------------------------------------------------------------------
內核提供的用戶空間輔助代碼
=========================

在內核內存空間的固定地址處,有一個由內核提供並可從用戶空間訪問的代碼
段。它用於向用戶空間提供因在許多 ARM CPU 中未實現的特性和/或指令而需
內核提供幫助的某些操作。這些代碼直接在用戶模式下執行的想法是爲了獲得
最佳效率,但那些與內核計數器聯繫過於緊密的部分,則被留給了用戶庫實現。
事實上,此代碼甚至可能因不同的 CPU 而異,這取決於其可用的指令集或它
是否爲 SMP 系統。換句話說,內核保留在不作出警告的情況下根據需要更改
這些代碼的權利。只有本文檔描述的入口及其結果是保證穩定的。

這與完全成熟的 VDSO 實現不同(但兩者並不衝突),儘管如此,VDSO 可阻止
某些通過常量高效跳轉到那些代碼段的彙編技巧。且由於那些代碼段在返回用戶
代碼前僅使用少量的代碼週期,則一個 VDSO 間接遠程調用將會在這些簡單的
操作上增加一個可測量的開銷。

在對那些擁有原生支持的新型處理器進行代碼優化時,僅在已爲其他操作使用
了類似的新增指令,而導致二進制結果已與早期 ARM 處理器不兼容的情況下,
用戶空間才應繞過這些輔助代碼,並在內聯函數中實現這些操作(無論是通過
編譯器在代碼中直接放置,還是作爲庫函數調用實現的一部分)。也就是說,
如果你編譯的代碼不會爲了其他目的使用新指令,則不要僅爲了避免使用這些
內核輔助代碼,導致二進制程序無法在早期處理器上運行。

新的輔助代碼可能隨着時間的推移而增加,所以新內核中的某些輔助代碼在舊
內核中可能不存在。因此,程序必須在對任何輔助代碼調用假設是安全之前,
檢測 __kuser_helper_version 的值(見下文)。理想情況下,這種檢測應該
只在進程啓動時執行一次;如果內核版本不支持所需輔助代碼,則該進程可儘早
中止執行。

kuser_helper_version
--------------------

位置:	0xffff0ffc

參考聲明:

  extern int32_t __kuser_helper_version;

定義:

  這個區域包含了當前運行內核實現的輔助代碼版本號。用戶空間可以通過讀
  取此版本號以確定特定的輔助代碼是否存在。

Annotation

Implementation Notes