Files
eb001/tb/sw/src/mstSvr.S

103 lines
2.1 KiB
ArmAsm
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#include "tl2cdr.h"
.globl _prog_start
.globl _rv32i_plic_handle
.section .text.init, "ax", %progbits
#if 0
#使RV32E RV32I 使x0, x16~x31
#便使ABI使x0, x16~x31x1~x15使ABI
#endif
_prog_start:
li x16, 0
mv x17, a0 # plic_claim
mv x18, a1 # flag_intTxEnd
mv x19, a2 # flag_intRxError
mv x20, a3 # flag_intRxStart
mv x21, a4 # flag_intRxEnd
mv x22, x0
#lui x23, %hi(_rv32i_plic_handle)
#lw x24, %lo(_rv32i_plic_handle)(x23)
la x24, _rv32i_plic_handle
li x25, 1
li x26, 0
li x27, 0
li x28, CDR_INT_TXEND
li x29, CDR_INT_RXERROR
li x30, CDR_INT_RXSTART
li x31, CDR_INT_RXEND
mv a0, x24
li x23, 0
li x24, 0
ret
.balign 32
_rv32i_plic_handle:
#if 0 /*RV32*/
csrr x16, mstatus # mstatus
andi x16, x16, ~(1 << 3) # MIE ()
csrw mstatus, x16 # mstatus
#endif
lw x23, 0(x17) # x23 = *plic_claim
sw x23, 0(x17) # *plic_claim = x23
#li x25, 1
#if 0
li x24, CDR_INT_TXEND
bne x23, x24, 1f #_if (x23 != x24) goto 1f
sw x25, 0(x18) #_else
j 4f
1:
li x24, CDR_INT_RXERROR
bne x23, x24, 2f #_if (x23 != x24) goto 2f
sw x25, 0(x19) #_else
j 4f
2:
li x24, CDR_INT_RXSTART
bne x23, x24, 3f #_if (x23 != x24) goto 3f
sw x25, 0(x20) #_else
j 4f
3:
li x24, CDR_INT_RXEND
bne x23, x24, 4f #_if (x23 != x24) goto 4f
sw x25, 0(x21) #_else
#else
bne x23, x28, 1f #_if (x23 != x24) goto 1f
sw x25, 0(x18) #_else
j 4f
1:
bne x23, x29, 2f #_if (x23 != x24) goto 2f
sw x25, 0(x19) #_else
j 4f
2:
bne x23, x30, 3f #_if (x23 != x24) goto 3f
sw x25, 0(x20) #_else
j 4f
3:
bne x23, x31, 4f #_if (x23 != x24) goto 4f
sw x25, 0(x21) #_else
#endif
4:
#if 0 /*RV32*/
csrr x16, mstatus
ori x16, x16, 1<<3
csrw mstatus, x16
#endif
mret