# Keep each function in a separate named section
#define _FUNCTION_SECTIONS_

#include <mips/regdef.h>
#include <mips/asm.h>
#include <mips/cpu.h>

#define VEC_SPACE 32

LEAF(__isr_vec)
    .set    push
    .set    noat

AENT(__isr_vec_000)
    li  k0, 0
    LA  k1, _risc_isr_sw0
    beqz    k1, 1f
    jr  k1
.org    VEC_SPACE
AENT(__isr_vec_001)
    li  k0, 1
    LA  k1, _risc_isr_sw1
    beqz    k1, 1f
    jr  k1
.org    2 * VEC_SPACE
AENT(__isr_vec_002)
    li  k0, 2
    LA  k1, _risc_isr_hw0
    beqz    k1, 1f
    jr  k1
.org    3 * VEC_SPACE
AENT(__isr_vec_003)
    li  k0, 3
    LA  k1, _risc_isr_hw1
    beqz    k1, 1f
    jr  k1
.org    4 * VEC_SPACE
AENT(__isr_vec_004)
    li  k0, 4
    LA  k1, _risc_isr_hw2
    beqz    k1, 1f
    jr  k1
.org    5 * VEC_SPACE
AENT(__isr_vec_005)
    li  k0, 5
    LA  k1, _risc_isr_hw3
    beqz    k1, 1f
    jr  k1
.org    6 * VEC_SPACE
AENT(__isr_vec_006)
    li  k0, 6
    LA  k1, _risc_isr_hw4
    beqz    k1, 1f
    jr  k1
.org    7 * VEC_SPACE
AENT(__isr_vec_007)
    li  k0, 7
    LA  k1, _risc_isr_hw5
    beqz    k1, 1f
    jr  k1
.org    8 * VEC_SPACE
AENT(__isr_vec_fallback)
.weak   _risc_interrupt
    li      k0, -1
1:
    LA      k1, _risc_interrupt
    beqz    k1, 1b
    jr      k1
    .set    pop
END(__isr_vec)

