요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
===================
Legacy instructions
===================
The arm64 port of the Linux kernel provides infrastructure to support
emulation of instructions which have been deprecated, or obsoleted in
the architecture. The infrastructure code uses undefined instruction
hooks to support emulation. Where available it also allows turning on
the instruction execution in hardware.
The emulation mode can be controlled by writing to sysctl nodes
(/proc/sys/abi). The following explains the different execution
behaviours and the corresponding values of the sysctl nodes -
* Undef
Value: 0
Generates undefined instruction abort. Default for instructions that
have been obsoleted in the architecture, e.g., SWP
* Emulate
Value: 1
Uses software emulation. To aid migration of software, in this mode
usage of emulated instruction is traced as well as rate limited
warnings are issued. This is the default for deprecated
instructions, .e.g., CP15 barriers
* Hardware Execution
Value: 2
Although marked as deprecated, some implementations may support the
enabling/disabling of hardware support for the execution of these
instructions. Using hardware execution generally provides better
performance, but at the loss of ability to gather runtime statistics
about the use of the deprecated instructions.
The default mode depends on the status of the instruction in the
architecture. Deprecated instructions should default to emulation
while obsolete instructions must be undefined by default.
Note: Instruction emulation may not be possible in all cases. See
individual instruction notes for further information.
Supported legacy instructions
-----------------------------
* SWP{B}
:Node: /proc/sys/abi/swp
:Status: Obsolete
:Default: Undef (0)
* CP15 Barriers
:Node: /proc/sys/abi/cp15_barrier
:Status: Deprecated
:Default: Emulate (1)
* SETEND
:Node: /proc/sys/abi/setend
:Status: Deprecated
:Default: Emulate (1)*
Note: All the cpus on the system must have mixed endian support at EL0
for this feature to be enabled. If a new CPU - which doesn't support mixed
endian - is hotplugged in after this feature has been enabled, there could
be unexpected results in the application.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Legacy instruction emulation
1-14Arm64 Linux port는 architecture에서 deprecated 또는 obsolete가 된 instruction을 emulate하는 infrastructure를 제공합니다. Undefined-instruction hook으로 emulation을 지원하고, hardware가 제공하는 경우 instruction의 hardware execution을 켤 수도 있습니다.
실행 mode는 `/proc/sys/abi` 아래 sysctl node에 값을 써서 제어합니다.
실행 mode와 기본 정책
15-44| Mode | 값 | 동작과 기본 사용처 |
|---|---|---|
| `Undef` | `0` | Undefined-instruction abort를 발생시킵니다. `SWP`처럼 obsolete instruction의 기본값입니다. |
| `Emulate` | `1` | Software emulation을 사용하고 usage trace와 rate-limited warning을 제공합니다. CP15 barrier처럼 deprecated instruction의 기본값입니다. |
| `Hardware Execution` | `2` | 지원 구현에서 hardware 실행을 사용합니다. 성능은 좋지만 deprecated instruction의 runtime 통계를 수집할 수 없습니다. |
기본 mode는 architecture에서 instruction의 상태에 따라 결정됩니다. Deprecated instruction은 emulation이 기본이고 obsolete instruction은 undefined가 기본이어야 합니다.
모든 상황에서 instruction emulation이 가능한 것은 아닙니다. 개별 instruction 설명을 확인해야 합니다.
지원 legacy instruction
45-68| Instruction | sysctl node | 상태 | 기본값 |
|---|---|---|---|
| `SWP{B}` | `/proc/sys/abi/swp` | Obsolete | `Undef (0)` |
| `CP15 Barriers` | `/proc/sys/abi/cp15_barrier` | Deprecated | `Emulate (1)` |
| `SETEND` | `/proc/sys/abi/setend` | Deprecated | `Emulate (1)*` |
`SETEND`를 활성화하려면 system의 모든 CPU가 EL0 `mixed endian`을 지원해야 합니다. 활성화 후 이를 지원하지 않는 CPU를 hotplug하면 application에서 예기치 않은 결과가 생길 수 있습니다.
요약과 해설
legacy_instructions.rst:1-68Legacy instruction infrastructure는 old binary migration을 돕되 obsolete instruction은 기본 차단하고 deprecated instruction은 warning과 통계를 곁들여 emulate합니다.
Architecture 상태와 sysctl mode가 실제 실행 경로를 결정합니다.
Obsolete와 deprecated 상태에 따라 기본 정책이 다릅니다.