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

64 lines
1.1 KiB
ArmAsm
Raw Normal View History

2024-10-28 15:51:12 +08:00
#include "custom_ops.S"
2024-10-28 18:01:25 +08:00
.extern main
.globl _prog_start
.section .text.init
2024-10-28 15:51:12 +08:00
2024-10-28 18:01:25 +08:00
_prog_start:
2024-10-29 17:32:17 +08:00
li sp, 0
2024-10-28 18:01:25 +08:00
picorv32_maskirq_insn(zero, zero)
2024-10-29 17:32:17 +08:00
2024-10-28 18:01:25 +08:00
call main
2024-10-28 15:51:12 +08:00
2024-10-29 17:32:17 +08:00
2024-10-28 18:01:25 +08:00
ecall
2024-10-28 15:51:12 +08:00
2024-10-28 18:01:25 +08:00
.balign 32
2024-10-29 09:33:29 +08:00
.section .trap_entry, "ax", %progbits
trap_entry:
2024-10-28 18:01:25 +08:00
# q0 return address
# q1 bitmask of all IRQ to be handled, may be more than one IRQ
# q2 q3 unused, can be use as temp storage register
# q Without the q-registers, the irq return address will be stored in x3 (gp) and the IRQ bitmask in x4 (tp),
2024-10-29 17:32:17 +08:00
# addi x15, x4, 0
# io.interrupt(0) := intTxError
# io.interrupt(1) := intTxFifoFull
# io.interrupt(2) := intTxFinish
# io.interrupt(3) := intRxError
# io.interrupt(4) := intRxValid
# io.interrupt(5) := intTxError
# io.interrupt(6) := intTxFifoFull
# io.interrupt(7) := intTxFinish
# io.interrupt(8) := intRxError
# io.interrupt(9) := intRxValid
# andi ra, x4, 0x02
# bnez ra, 1f
# addi, sp, sp, 2048
1:
andi ra, x4, 0x10
bnez ra, 2f
addi sp, sp, 1
2:
# andi ra, x4, 0x40
# bnez ra, 3f
# addi, sp, sp, 2048
3:
andi ra, x4, 0x200
bnez ra, 4f
addi sp, sp, 1
4:
2024-10-28 18:01:25 +08:00
picorv32_retirq_insn()