Documentation/translations/zh_CN/arch/arm/kernel_user_helpers.txt
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/arch/arm/kernel_user_helpers.txt
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/arch/arm/kernel_user_helpers.txt- Extension
.txt- Size
- 7941 bytes
- Lines
- 285
- 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.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function check_kuser_versionfunction foofunction atomic_addfunction atomic_add64
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
- Detected declarations: `function check_kuser_version`, `function foo`, `function atomic_add`, `function atomic_add64`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.