Documentation/translations/zh_CN/arch/arm64/elf_hwcaps.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_CN/arch/arm64/elf_hwcaps.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_CN/arch/arm64/elf_hwcaps.rst- Extension
.rst- Size
- 6098 bytes
- Lines
- 241
- 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.
Dependency Surface
- No C-style include directives detected by the generator.
Detected Declarations
function floating_point_is_present
Annotated Snippet
.. include:: ../../disclaimer-zh_CN.rst
:Original: :ref:`Documentation/arch/arm64/elf_hwcaps.rst <elf_hwcaps_index>`
Translator: Bailu Lin <bailu.lin@vivo.com>
================
ARM64 ELF hwcaps
================
这篇文档描述了 arm64 ELF hwcaps 的用法和语义。
1. 简介
-------
有些硬件或软件功能仅在某些 CPU 实现上和/或在具体某个内核配置上可用,但
对于处于 EL0 的用户空间代码没有可用的架构发现机制。内核通过在辅助向量表
公开一组称为 hwcaps 的标志而把这些功能暴露给用户空间。
用户空间软件可以通过获取辅助向量的 AT_HWCAP 或 AT_HWCAP2 条目来测试功能,
并测试是否设置了相关标志,例如::
bool floating_point_is_present(void)
{
unsigned long hwcaps = getauxval(AT_HWCAP);
if (hwcaps & HWCAP_FP)
return true;
return false;
}
如果软件依赖于 hwcap 描述的功能,在尝试使用该功能前则应检查相关的 hwcap
标志以验证该功能是否存在。
不能通过其他方式探查这些功能。当一个功能不可用时,尝试使用它可能导致不可
预测的行为,并且无法保证能确切的知道该功能不可用,例如 SIGILL。
2. Hwcaps 的说明
----------------
大多数 hwcaps 旨在说明通过架构 ID 寄存器(处于 EL0 的用户空间代码无法访问)
描述的功能的存在。这些 hwcap 通过 ID 寄存器字段定义,并且应根据 ARM 体系
结构参考手册(ARM ARM)中定义的字段来解释说明。
这些 hwcaps 以下面的形式描述::
idreg.field == val 表示有某个功能。
当 idreg.field 中有 val 时,hwcaps 表示 ARM ARM 定义的功能是有效的,但是
并不是说要完全和 val 相等,也不是说 idreg.field 描述的其他功能就是缺失的。
其他 hwcaps 可能表明无法仅由 ID 寄存器描述的功能的存在。这些 hwcaps 可能
没有被 ID 寄存器描述,需要参考其他文档。
3. AT_HWCAP 中揭示的 hwcaps
---------------------------
HWCAP_FP
ID_AA64PFR0_EL1.FP == 0b0000 表示有此功能。
HWCAP_ASIMD
ID_AA64PFR0_EL1.AdvSIMD == 0b0000 表示有此功能。
HWCAP_EVTSTRM
通用计时器频率配置为大约100KHz以生成事件。
HWCAP_AES
Annotation
- Detected declarations: `function floating_point_is_present`.
- Atlas domain: Support Tooling And Documentation / Documentation.
- Implementation status: atlas-only.
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.