# This Code derived from xv6-riscv (64bit) # -- https://github.com/mit-pdos/xv6-riscv/blob/riscv/kernel/swtch.S .globl sys_timer .align 4 sys_timer: # call the C timer_handler(reg_t epc, reg_t cause) csrr a0, mepc csrr a1, mcause call timer_handler # timer_handler will return the return address via a0. csrw mepc, a0 mret # back to interrupt location (pc=mepc)