요약·해설과 원문, 전문 번역을 서로 분리했습니다. API 이름, symbol, source path는 원문 표기를 사용합니다.
1. 요약·해설
원문의 핵심 논리와 kernel programming 관점의 보충 설명입니다. 아래의 전문 번역과는 별도로 작성했습니다.
2. 영어 원문 전체
번역 기준이 된 Linux v6.18.37 원문입니다. 줄 번호는 이 버전의 파일 좌표입니다.
원문 전체 펼치기
=================
PA-RISC Debugging
=================
okay, here are some hints for debugging the lower-level parts of
linux/parisc.
1. Absolute addresses
=====================
A lot of the assembly code currently runs in real mode, which means
absolute addresses are used instead of virtual addresses as in the
rest of the kernel. To translate an absolute address to a virtual
address you can lookup in System.map, add __PAGE_OFFSET (0x10000000
currently).
2. HPMCs
========
When real-mode code tries to access non-existent memory, you'll get
an HPMC instead of a kernel oops. To debug an HPMC, try to find
the System Responder/Requestor addresses. The System Requestor
address should match (one of the) processor HPAs (high addresses in
the I/O range); the System Responder address is the address real-mode
code tried to access.
Typical values for the System Responder address are addresses larger
than __PAGE_OFFSET (0x10000000) which mean a virtual address didn't
get translated to a physical address before real-mode code tried to
access it.
3. Q bit fun
============
Certain, very critical code has to clear the Q bit in the PSW. What
happens when the Q bit is cleared is the CPU does not update the
registers interruption handlers read to find out where the machine
was interrupted - so if you get an interruption between the instruction
that clears the Q bit and the RFI that sets it again you don't know
where exactly it happened. If you're lucky the IAOQ will point to the
instruction that cleared the Q bit, if you're not it points anywhere
at all. Usually Q bit problems will show themselves in unexplainable
system hangs or running off the end of physical memory.
3. 한국어 전문 번역
영어 원문의 문단 순서와 의미를 유지한 전체 번역입니다. 코드, 함수명, symbol과 URL은 원문 표기를 유지합니다.
Real-mode absolute address
1-17이 문서는 Linux/PA-RISC low-level code debugging을 위한 실무 hint를 설명합니다. 많은 assembly code가 real mode에서 실행되어 kernel 나머지 부분의 virtual address 대신 absolute address를 사용합니다.
Absolute address를 `System.map`에서 찾을 virtual address로 바꾸려면 현재 `__PAGE_OFFSET` 값인 `0x10000000`을 더합니다.
HPMC 분석
18-33Real-mode code가 존재하지 않는 memory를 접근하면 kernel oops 대신 HPMC가 발생합니다. System Responder와 System Requestor address를 찾는 것이 첫 단계입니다.
| Address | 예상값과 의미 |
|---|---|
| System Requestor | Processor HPA 중 하나와 일치해야 함. I/O range의 높은 address |
| System Responder | Real-mode code가 실제로 접근하려 한 address |
Responder가 `__PAGE_OFFSET` (`0x10000000`)보다 크면 virtual address를 physical address로 변환하지 않고 real-mode code가 접근했을 가능성이 큽니다.
PSW Q bit 주의
34-46아주 critical한 code는 PSW의 Q bit를 clear해야 합니다. Q bit가 0이면 CPU가 interruption handler가 참조하는 interruption-state register를 갱신하지 않습니다.
Q bit clear instruction과 Q를 다시 set하는 `RFI` 사이에 interruption이 발생하면 정확한 위치를 알 수 없습니다. 운이 좋으면 `IAOQ`가 clear instruction을 가리키지만 그렇지 않으면 임의 위치가 될 수 있습니다. Q bit 문제는 설명하기 어려운 system hang이나 physical memory 끝을 넘어 실행하는 현상으로 나타납니다.
요약과 해설
debugging.rst:1-46PA-RISC low-level fault는 virtual/physical address 혼동, HPMC responder address, Q-bit 비가시 구간을 순서대로 확인해야 합니다.
Address와 interruption state를 차례로 좁힙니다.
Fault 종류별 대표 단서입니다.