---
# System prepended metadata

title: OSDI lab3 notes

---

# OSDI lab3 notes

## 索引
很多register連結可以點
p.1546

irqs1
peripheral.pdf
p.116

elr_el2 
spsr_el2 p.283


el0 to el1
spsr_el1 p.278

ELR_EL1
p.258

VBAR_EL1
p.2065

ESR_EL1
p.1899
ESR_EL1的內容
Ec IL ISS

p.1860
timers (64-bit, 32-bit)

armv8 p.2179
cntp_ctl_el0 他是控制el1的!!! 

p. 2182
cntp_tval_el0 (time value)

piripheral p.12
AUX_MU_IIR_REG


## el2 register explanations
// mov x1, (1 << 31)
// msr hcr_el2, x1
// hcr_el2: page 1923, 64-bit register. Configuration controls for EL2.
// hcr_el2[31]: RW bit, indicates EL1 runs in AArch64.

// mov x1, 0x3c5
// msr spsr_el2, x1
// spsr_el2: page 283, 32-bit register. Holds the saved process state when an exception is taken to EL2.
// 0011: bit [11:10]: reserved. D(bit [9]): mask bit of watchpoint, breakpoint, etc. A(bit [8]): SError mask bit.
// 1100: I(bit [7]): IRQ mask bit. F(bit [6]): FIQ mask bit. bit [5]: reserved. bit [4]: 0 means exception taken from AArch64.
// 0101: M[3:0](bit [3:0])Exception was taken from EL1h. h(M[0]) means the saved processor state is determined by the EL.

// msr elr_el2, lr
// elr_el2: page 259, 64-bit register. When taking an exception to EL2, holds the address to return to.
// lr: Link Register, holds the return address.

// eret
// Exception return from EL2 to EL1.



## Basic 3
Peripheral pdf p.12
AUX_MU_IER_REG(0x3f215044)
最低位(1) enable read interrupt
(2) enable write interrupt

Peripheral pdf p.112
Enable IRQs1(0x3f00b210)’s bit29
0x21C (21C-200=1C -> 28)

Peripheral pdf p.113
bit29: aux int

https://github.com/Tekki/raspberrypi-documentation/blob/master/hardware/raspberrypi/bcm2836/QA7_rev3.4.pdf p.16
CORE0_INTERRUPT_SOURCE bit explanation

CNTPNSIRQ
P: physical
NS: non secure