Documentation/translations/zh_TW/arch/loongarch/introduction.rst
Source file repositories/reference/linux-study-clean/Documentation/translations/zh_TW/arch/loongarch/introduction.rst
File Facts
- System
- Linux kernel
- Corpus path
Documentation/translations/zh_TW/arch/loongarch/introduction.rst- Extension
.rst- Size
- 16716 bytes
- Lines
- 355
- 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
- No top-level syscall, struct, function, initcall, or export declaration detected by the generator.
Annotated Snippet
.. SPDX-License-Identifier: GPL-2.0
.. include:: ../../disclaimer-zh_TW.rst
:Original: Documentation/arch/loongarch/introduction.rst
:Translator: Huacai Chen <chenhuacai@loongson.cn>
=============
LoongArch介紹
=============
LoongArch是一種新的RISC ISA,在一定程度上類似於MIPS和RISC-V。LoongArch指令集
包括一個精簡32位版(LA32R)、一個標準32位版(LA32S)、一個64位版(LA64)。
LoongArch定義了四個特權級(PLV0~PLV3),其中PLV0是最高特權級,用於內核;而PLV3
是最低特權級,用於應用程序。本文檔介紹了LoongArch的寄存器、基礎指令集、虛擬內
存以及其他一些主題。
寄存器
======
LoongArch的寄存器包括通用寄存器(GPRs)、浮點寄存器(FPRs)、向量寄存器(VRs)
和用於特權模式(PLV0)的控制狀態寄存器(CSRs)。
通用寄存器
----------
LoongArch包括32個通用寄存器( ``$r0`` ~ ``$r31`` ),LA32中每個寄存器爲32位寬,
LA64中每個寄存器爲64位寬。 ``$r0`` 的內容總是固定爲0,而其他寄存器在體系結構層面
沒有特殊功能。( ``$r1`` 算是一個例外,在BL指令中固定用作鏈接返回寄存器。)
內核使用了一套LoongArch寄存器約定,定義在LoongArch ELF psABI規範中,詳細描述參見
:ref:`參考文獻 <loongarch-references-zh_TW>`:
================= =============== =================== ==========
寄存器名 別名 用途 跨調用保持
================= =============== =================== ==========
``$r0`` ``$zero`` 常量0 不使用
``$r1`` ``$ra`` 返回地址 否
``$r2`` ``$tp`` TLS/線程信息指針 不使用
``$r3`` ``$sp`` 棧指針 是
``$r4``-``$r11`` ``$a0``-``$a7`` 參數寄存器 否
``$r4``-``$r5`` ``$v0``-``$v1`` 返回值 否
``$r12``-``$r20`` ``$t0``-``$t8`` 臨時寄存器 否
``$r21`` ``$u0`` 每CPU變量基地址 不使用
``$r22`` ``$fp`` 幀指針 是
``$r23``-``$r31`` ``$s0``-``$s8`` 靜態寄存器 是
================= =============== =================== ==========
.. note::
注意: ``$r21`` 寄存器在ELF psABI中保留未使用,但是在Linux內核用於保
存每CPU變量基地址。該寄存器沒有ABI命名,不過在內核中稱爲 ``$u0`` 。在
一些遺留代碼中有時可能見到 ``$v0`` 和 ``$v1`` ,它們是 ``$a0`` 和
``$a1`` 的別名,屬於已經廢棄的用法。
浮點寄存器
----------
當系統中存在FPU時,LoongArch有32個浮點寄存器( ``$f0`` ~ ``$f31`` )。在LA64
的CPU核上,每個寄存器均爲64位寬。
浮點寄存器的使用約定與LoongArch ELF psABI規範的描述相同:
================= ================== =================== ==========
寄存器名 別名 用途 跨調用保持
================= ================== =================== ==========
``$f0``-``$f7`` ``$fa0``-``$fa7`` 參數寄存器 否
``$f0``-``$f1`` ``$fv0``-``$fv1`` 返回值 否
``$f8``-``$f23`` ``$ft0``-``$ft15`` 臨時寄存器 否
``$f24``-``$f31`` ``$fs0``-``$fs7`` 靜態寄存器 是
================= ================== =================== ==========
Annotation
- 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.