trap.S 修改注释格式

ch2
zhangxinyu 2 years ago
parent e3f52de1fd
commit 7f64711219

@ -1,71 +1,73 @@
# trap__alltraps, __restore
.altmacro .altmacro
.macro SAVE_GP n .macro SAVE_GP n
sd x\n, \n*8(sp) // x_n sd x\n, \n*8(sp) # x_n
.endm .endm
.macro LOAD_GP n .macro LOAD_GP n
ld x\n, \n*8(sp) // x_n ld x\n, \n*8(sp) # x_n
.endm .endm
.section .text // .text .section .text # .text
.globl __alltraps // __alltraps .globl __alltraps # __alltraps
.globl __restore // __restore .globl __restore # __restore
.align 2 // 2^2 = 4 .align 2 # 2^2 = 4
__alltraps: // __alltraps __alltraps: # __alltraps
csrrw sp, sscratch, sp // sp sscratch csrrw sp, sscratch, sp # sp sscratch
# sp sscratch # sp sscratch
# TrapContext # TrapContext
addi sp, sp, -34*8 // 34*8 addi sp, sp, -34*8 # 34*8
# #
sd x1, 1*8(sp) // x1 (x0, 便) sd x1, 1*8(sp) # x1 (x0, 便)
# sp(x2) # sp(x2)
sd x3, 3*8(sp) // x3 (x4, 便) sd x3, 3*8(sp) # x3 (x4, 便)
# tp(x4)使 # tp(x4)使
# x5~x31 # x5~x31
.set n, 5 // n 5 .set n, 5 # n 5
.rept 27 // 27 .rept 27 # 27
SAVE_GP %n // x_n SAVE_GP %n # x_n
.set n, n+1 // n 1 .set n, n+1 # n 1
.endr // .endr #
# 使 t0/t1/t2 # 使 t0/t1/t2
csrr t0, sstatus // sstatus csrr t0, sstatus # sstatus
csrr t1, sepc // sepc csrr t1, sepc # sepc
sd t0, 32*8(sp) // sstatus sd t0, 32*8(sp) # sstatus
sd t1, 33*8(sp) // sepc sd t1, 33*8(sp) # sepc
# sscratch # sscratch
csrr t2, sscratch // sscratch csrr t2, sscratch # sscratch
sd t2, 2*8(sp) // trap context sd t2, 2*8(sp) # trap context
# trap_handler(cx: &mut TrapContext) # trap_handler(cx: &mut TrapContext)
mv a0, sp // TrapContext a0 mv a0, sp # TrapContext a0
call trap_handler // trap_handler # call trap_handler # trap_handler #
__restore: // __restore __restore: # __restore
# case1: # case1:
# case2: U # case2: U
mv sp, a0 // a0 sp sp KERNEL_STACK_SIZE, mv sp, a0 # a0 sp sp KERNEL_STACK_SIZE,
# sstatus/sepc # sstatus/sepc
ld t0, 32*8(sp) // sstatus ld t0, 32*8(sp) # sstatus
ld t1, 33*8(sp) // sepc ld t1, 33*8(sp) # sepc
ld t2, 2*8(sp) // ld t2, 2*8(sp) #
csrw sstatus, t0 // sstatus csrw sstatus, t0 # sstatus
csrw sepc, t1 // sepc csrw sepc, t1 # sepc
csrw sscratch, t2 // sscratch csrw sscratch, t2 # sscratch
# sp sscratch # sp sscratch
# sp/tp # sp/tp
# x0 # x0
ld x1, 1*8(sp) // x1 ld x1, 1*8(sp) # x1
# x2 # x2
ld x3, 3*8(sp) // x3 ld x3, 3*8(sp) # x3
# #
.set n, 5 // n 5 .set n, 5 # n 5
.rept 27 // 27 .rept 27 # 27
LOAD_GP %n // x_n LOAD_GP %n # x_n
.set n, n+1 // n 1 .set n, n+1 # n 1
.endr // .endr #
# sp sscratch , TrapContext, , # sp sscratch , TrapContext, ,
addi sp, sp, 34*8 // sizeof<TrapContext> addi sp, sp, 34*8 # sizeof<TrapContext>
csrrw sp, sscratch, sp // sp sscratch , sscratch, sp USER_STACK() csrrw sp, sscratch, sp # sp sscratch , sscratch, sp USER_STACK()
sret // , sstatus(/) sepc(/ pc) sret # , sstatus(/) sepc(/ pc)
Loading…
Cancel
Save