Line 40... |
Line 40... |
.section .text
|
.section .text
|
.balign 4
|
.balign 4
|
.global _start
|
.global _start
|
|
|
|
|
// standard CSRs
|
|
.set mtinst, 0x34a
|
|
|
|
// custom CSRs
|
// custom CSRs
|
.set CSR_MISPACEBASE, 0xfc4 // CUSTOM (r/-): Base address of instruction memory space (via MEM_ISPACE_BASE generic) */
|
.set CSR_MISPACEBASE, 0xfc4 // CUSTOM (r/-): Base address of instruction memory space (via MEM_ISPACE_BASE generic) */
|
.set CSR_MDSPACEBASE, 0xfc5 // CUSTOM (r/-): Base address of data memory space (via MEM_DSPACE_BASE generic) */
|
.set CSR_MDSPACEBASE, 0xfc5 // CUSTOM (r/-): Base address of data memory space (via MEM_DSPACE_BASE generic) */
|
.set CSR_MISPACESIZE, 0xfc6 // CUSTOM (r/-): Total size of instruction memory space in byte (via MEM_ISPACE_SIZE generic) */
|
.set CSR_MISPACESIZE, 0xfc6 // CUSTOM (r/-): Total size of instruction memory space in byte (via MEM_ISPACE_SIZE generic) */
|
.set CSR_MDSPACESIZE, 0xfc7 // CUSTOM (r/-): Total size of data memory space in byte (via MEM_DSPACE_SIZE generic) */
|
.set CSR_MDSPACESIZE, 0xfc7 // CUSTOM (r/-): Total size of data memory space in byte (via MEM_DSPACE_SIZE generic) */
|
Line 293... |
Line 290... |
// --------------------------------------------
|
// --------------------------------------------
|
// compute return address for EXCEPTIONS only
|
// compute return address for EXCEPTIONS only
|
// --------------------------------------------
|
// --------------------------------------------
|
__crt0_neorv32_rte_is_exc:
|
__crt0_neorv32_rte_is_exc:
|
|
|
// is faulting instruction compressed?
|
// check if faulting instruction is compressed and adjust return address
|
csrr t0, mtinst
|
|
andi t0, t0, 2 // get compression flag (bit #1): 0=compressed, 1=uncompressed
|
lh t0, 0(ra) // get compressed instruction or lower 16 bits of uncompressed instruction that caused exception
|
|
addi t2, zero, 3 // mask
|
|
and t0, t0, t2 // isolate lowest 2 opcode bits (= 11 for uncompressed instructions)
|
|
|
addi ra, ra, +2 // only this for compressed instructions
|
addi ra, ra, +2 // only this for compressed instructions
|
add ra, ra, t0 // add another 2 (making +4) for uncompressed instructions
|
bne t0, t2, __crt0_neorv32_rte_execute // jump if compressed instruction
|
|
|
|
addi ra, ra, +2 // add another 2 (making +4) for uncompressed instructions
|
j __crt0_neorv32_rte_execute
|
j __crt0_neorv32_rte_execute
|
|
|
|
|
// --------------------------------------------
|
// --------------------------------------------
|
// vector table offset for INTERRUPTS only
|
// vector table offset for INTERRUPTS only
|