0

This code keeps looping instead of returning to _start. What am I missing here? MIE is enabled for reference.

.section .text
.globl _start
_start:
        #set vtbar
        auipc sp, 0x400
        la a0, handler
        csrw mtvec,a0
        #enable MIE 
        li      t0, 8
        csrrs   zero, mstatus, t0

.balign 4
handler:
        #shift top bit

        csrrc   t0, mcause, zero
        slli    t0, t0, 1      # shift off high bit
        srli    t0, t0, 1
        li a3, 4
        mret

0 Answers0