微自幹的作業系統輕旅行
Ian Chen
About me
Preliminary work
Outline
1. RISC-V 沿革
2. Instruction Set
3. Calling Convention
4. Interrupt & Exception Handle
5. Trace the source code of mini-riscv-os
The Skills you got to know
1. Virtual Machine or Evaluation Board
2. RISC-V GNU Compiler Toolchain
3. Git
4. C Programming Skill
5. Assembly code
The History of RISC-V
Instruction Set - RV32I
Privileged architecture
Reference: The RISC-V Instruction Set Manual
Calling Convention
Reference: The RISC-V Instruction Set Manual
Calling Convention
a0
a1
a0
Reference: The RISC-V Instruction Set Manual
Control and Status Register
Reference: The RISC-V Instruction Set Manual
Control and Status Register
Reference: The RISC-V Instruction Set Manual
Interrupt & Exception Handle
Trap
更新 mcause
更新 mepc
更新 mtval
更新 mstatus
退出異常狀態
https://github.com/ianchen0119/AwesomeCS/wiki/
Intro: mini-riscv-os
https://github.com/cccriscv/mini-riscv-os
Trace the source code !
探討目標: MINI-RISCV-OS 的中斷處理 (07-ExterInterrupt)
https://github.com/cccriscv/mini-riscv-os/blob/master/07-ExterInterrupt/os.c
Timer interrupt
Timer interrupt
External Interrupt
https://github.com/qemu/qemu/blob/master/hw/riscv/virt.c
Trap Handler
https://github.dev/cccriscv/mini-riscv-os
Trap Handler (Cont′d)
https://github.com/cccriscv/mini-riscv-os/blob/master/07-ExterInterrupt/trap.c
Trap Handler (Cont′d)
https://github.com/cccriscv/mini-riscv-os/blob/master/07-ExterInterrupt/timer.c
Trap Handler (Cont′d)
A: 我是無情的原始碼閱讀機器。
https://github.com/cccriscv/mini-riscv-os/blob/master/07-ExterInterrupt/trap.c
Why we don’t make a Shell
Acquisition
Thanks for your listening !
Any further question?