← Interrupt 상세 목차DUJINLABS.COM

Hardware · Interrupt detailed manual 01 · Linux v6.18.37

1. mcause/scause와 mie/mip에서 trap entry를 시작한다

interrupt/exception bit, cause number, delegation, xIE/xPIE와 xtvec mode를 hart별로 확인합니다. 외부 controller pending과 hart external-interrupt pending bit를 같은 번호로 보지 않습니다.

상세 표
2
검증 행
14
절차
4 checkpoints
기준
RISC-V PLIC · AIA · Linux v6.18.37

CHAPTER 01

1. mcause/scause와 mie/mip에서 trap entry를 시작한다

interrupt/exception bit, cause number, delegation, xIE/xPIE와 xtvec mode를 hart별로 확인합니다. 외부 controller pending과 hart external-interrupt pending bit를 같은 번호로 보지 않습니다.

cause

최상위 interrupt bit와 cause code를 분리합니다.

delegation

mideleg에 따라 M-mode interrupt가 S-mode로 위임됩니다.

xtvec

direct/vectored mode와 base alignment가 entry 주소를 결정합니다.

xstatus

trap entry 시 xIE/xPIE와 privilege stack이 갱신됩니다.

레지스터·번호·소유권 대조

항목소유자값의 의미정상 증거오류 해석
mcause/scausehart CSRinterrupt와 cause예상 external causeexception과 오인
mie/siehart CSRlocal enableexternal bit enabledcontroller 정상이나 hart 차단
mip/siphart CSRpending summarycontroller delivery와 일치PLIC/IMSIC 앞 경계
mideleghart CSRS-mode 위임OS 실행 level과 일치M-mode에 머묾
mtvec/stvechart CSRentry base/mode정렬된 유효 주소잘못된 vector entry

실패 경계 판정

증상직전 통과우선 확인반증 시험판정
PLIC pending, sip.SEIP 0source pendingcontext delivery/thresholdthreshold 0과 enable 확인controller→hart
SEIP 1, trap 없음hart pendingsie/sstatus.SIEmask 해제 시험hart masking
trap cause 다름entry 실행scause decoderaw XLEN 값 보존decode 오류
M-mode만 받음external pendingmideleg/firmwaredelegation readbackprivilege routing
return 후 즉시 재진입handler 실행source/completeclaim/complete tracecontroller 완료
그림 1. 1. mcause/scause와 mie/mip에서 trap entry를 시작한다의 실행 순서왼쪽에서 오른쪽으로 실제 소유권과 관찰 지점이 이동합니다.
01 source controller
02 mip/sip pending
03 mie/sie
04 xstatus IE
05 xtvec
06 trap prologue
07 scause decode
08 irqdomain dispatch

실제 검증 절차

순서실행남길 증거판정 목적
1trap 직전 CSR snapshot을 per-hart 저장합니다.cause/enable/pendingentry 조건
2delegation과 실행 privilege를 boot 단계별로 기록합니다.M/S handoffrouting 확인
3direct/vectored target 주소를 disassembly와 대조합니다.실제 PCentry 검증
4local timer/software/external cause를 각각 주입합니다.cause별 handler분류 검증

주의CSR pending bit는 외부 source ID를 담지 않습니다. PLIC claim 또는 IMSIC top-of-pending 정보를 별도로 읽어야 합니다.

공개적으로 다시 확인할 수 있는 자료

공개되지 않은 vendor register나 integration별 offset을 추측해서 채우지 않았습니다. 아래 제조사 자료, architecture 문서와 Linux v6.18.37 원본에서 다시 확인할 수 있는 범위만 사용했습니다.