添加 entry.S 文件的一些注释
This commit is contained in:
@@ -218,9 +218,12 @@ interrupt:
|
|||||||
.global entry_mip
|
.global entry_mip
|
||||||
.global entry_mcause
|
.global entry_mcause
|
||||||
|
|
||||||
|
|
||||||
|
// cpu产生异常时会自动进入这个入口
|
||||||
trap_entry:
|
trap_entry:
|
||||||
|
|
||||||
/* Interrupt trap */
|
/* Interrupt trap */
|
||||||
|
// 把t0的值暂时保存到临时寄存器中
|
||||||
csrw mscratch, t0
|
csrw mscratch, t0
|
||||||
/* 保存mcause && mip 到pmpaddr中 */
|
/* 保存mcause && mip 到pmpaddr中 */
|
||||||
csrr t0, mcause
|
csrr t0, mcause
|
||||||
@@ -228,11 +231,15 @@ trap_entry:
|
|||||||
csrr t0, mip
|
csrr t0, mip
|
||||||
csrw pmpaddr15, t0
|
csrw pmpaddr15, t0
|
||||||
|
|
||||||
|
// 在线程栈中直接处理中断
|
||||||
andi t0, t0, -1912 // -1912 = 0x888
|
andi t0, t0, -1912 // -1912 = 0x888
|
||||||
|
// bnez不会更新返回地址 jal x1 会把返回地址更新到ra
|
||||||
bnez t0, interrupt
|
bnez t0, interrupt
|
||||||
|
|
||||||
/* System call and other traps */
|
/* System call and other traps */
|
||||||
|
// 把mscratch的值拷贝到t0中 然后把sp的值写入到mscratch
|
||||||
csrrw t0, mscratch, sp
|
csrrw t0, mscratch, sp
|
||||||
|
// 切到异常处理栈
|
||||||
la sp, _trap_sp
|
la sp, _trap_sp
|
||||||
#ifndef __riscv_float_abi_soft
|
#ifndef __riscv_float_abi_soft
|
||||||
addi sp, sp, -REGBYTES*64
|
addi sp, sp, -REGBYTES*64
|
||||||
|
Reference in New Issue
Block a user