23.11.22 최초 작성
23.11.27 ftrace 메시지 추가

Armv8아키텍처는 EL0 ~ EL3까지 Exception Level 을 정의한다.
EL0, PL0
사용자 Application이 구동 됨unprivileged level : 하드웨어에 직접 접근할 수 없음인터럽트, MMU, 캐시 기능을 설정할 수 없음EL1, PL1
OS kernel이나 privileged function이 구동 됨인터럽트, MMU, 캐시 와 같은 시스템을 설정 가능EL2, PL2
하이퍼바이저가 구동 됨게스트 OS끼리 스위칭하고 게스트 OS의 시스템에 접근 가능EL3, PL3
Non-Secure Mode와 Secure Mode를 구분해 구동 함Booting 과정에서 해당 레벨로 설정 됨Synchronous
System call, Data abort, Instruction abort,Misaligned 스택 포인터 접근, Unknown reasonIRQ Interrupt : 외부 인터럽트(Non-secure interrupt)
FIQ Interrupt : 외부 인터럽트(Secure interrupt)
Serror : 외부 메모리 Data abort
Exception발생 시 종류별로 미리 정의된 주소(Exception Vector)로 분기
해당 주소에는 Exception을 핸들링하는 코드가 존재
Exception Vector Table에 지정된 주소에 따라 분기함
Lower EL : EL0에서 발생하는 ExceptionCurrent EL : EL1에서 발생하는 Exception각 Exception Level에 따라 Exception Vector Table이 존재하며
Exception발생 시 ELR<N>에 복귀 주소를, 현재 프로세스 상태를 SPSR_EL<N>에 저장
프로세스 상태 갱신 후 Exception Vector Table엔트리로 분기
정해진 Exception Vector에 따라PC값 변경
ESR<N>에 Exception원인 저장
ERET을 통해 Exception처리 복귀 및 SPSR_EL<N>, ELR<N>값을 통해 프로세스 상태, PC값 복원
IRQ의 경우IRQ발생 시 EL2의 Exception Vector로 분기Guest OS의 EL1에 Interrupt분배Abort의 경우IRQ발생 시 EL2의 Exception Vector로 분기<idle>-0 [000] d.h1. 2228.822487: irq_handler_entry: irq=37 name=mmc1
<idle>-0 [000] d.h1. 2228.822488: bcm2835_mmc_irq+0x4/0x680 <-__handle_irq_event_percpu+0x88/0x280
<idle>-0 [000] d.h1. 2228.822489: <stack trace>
=> bcm2835_mmc_irq+0x8/0x680
=> __handle_irq_event_percpu+0x88/0x280
=> handle_irq_event_percpu+0x20/0x68
=> handle_irq_event+0x50/0xa8
=> handle_fasteoi_irq+0xe4/0x198
=> generic_handle_domain_irq+0x34/0x50 // handle_domain_irq
=> gic_handle_irq+0xa0/0xd8
=> call_on_irq_stack+0x2c/0x54
=> do_interrupt_handler+0xe0/0xf8
=> el1_interrupt+0x38/0x70
=> el1h_64_irq_handler+0x18/0x28
=> el1h_64_irq+0x64/0x68
=> finish_task_switch+0x98/0x290
=> __schedule+0x2ac/0x830
=> schedule_idle+0x28/0x50
=> do_idle+0xec/0x240
=> cpu_startup_entry+0x2c/0x38
=> rest_init+0xe4/0xe8
=> arch_post_acpi_subsys_init+0x0/0x28
=> start_kernel+0x6f8/0x730
=> __primary_switched+0xbc/0xc4
<idle>-0 [000] d.h1. 2228.822487: irq_handler_entry: irq=37 name=mmc1
mmc인 37번 인터럽트 핸들러에 진입VBAR_EL_1 + 0x280 (Current EL with SPx/IRQ) 주소로 분기
arch/arm64/kernel/entry-common.c
el1h_64_irqe1h_64_irq_handlerel1_interruptdo_interrupt_handlerarch/arm64/kernel/entry.S
call_on_irqarch/arm64/kernel/entry-common.c
gic_handle_irqhandle_domain_irq/source/kernel/irq/irqdesc.c
handle_fasteoi_irq/source/kernel/irq/handle.c
handle_irq_eventhandle_irq_event_percpu