You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
hi,I find there somthing wrong in freedom-metal/src/trap.S:
see source code below, this will set the mtvec zero in MSB, except LSB two bits
and "jr t0" will go somewhere wrong!
The text was updated successfully, but these errors were encountered:
one more thing, the codes in line 20/21, actually also don't make sense in my test. it'ok when I changed those to "csrw mepc, ra".
when the trap returns by calling mret, the mepc will set into pc, and the pc=mepc=ra, where ra contains the address next to instruction like "call _metal_trap".
So I don't think the original code blow works well. how do you think? Or could you please explain why it should be like this? what "ra-1" means?
Thanks
/* Store the instruction which called _metal_trap in mepc */
addi t0, ra, -1 //line 20
csrw mepc, t0 //line 21
besides, the address of the instruction called the _metal_trap may be "ra-4" or "ra-2"
hi,I find there somthing wrong in freedom-metal/src/trap.S:
see source code below, this will set the mtvec zero in MSB, except LSB two bits
and "jr t0" will go somewhere wrong!
The text was updated successfully, but these errors were encountered: