Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[driver] fix irq handler #151

Merged
merged 1 commit into from
Oct 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 88 additions & 2 deletions board/avaota-cam/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ _start:
csrw mtvec, a0

/* Setup int vectors */
la a0, vectors
la a0, irq_handler
csrw mtvt, a0

/* Setup stack */
Expand Down Expand Up @@ -168,4 +168,90 @@ vectors:
LREG x30, 30 * REGSZ(a0)
LREG x31, 31 * REGSZ(a0)
LREG x10, 10 * REGSZ(a0)
mret
mret

/*
* IRQ vectors.
*/
.align 6
.globl irq_handler
irq_handler:
csrw mscratch, sp
addi sp, sp, -(37 * REGSZ)
SREG x1, 1 * REGSZ(x2)
SREG x3, 3 * REGSZ(x2)
SREG x4, 4 * REGSZ(x2)
SREG x5, 5 * REGSZ(x2)
SREG x6, 6 * REGSZ(x2)
SREG x7, 7 * REGSZ(x2)
SREG x8, 8 * REGSZ(x2)
SREG x9, 9 * REGSZ(x2)
SREG x10, 10 * REGSZ(x2)
SREG x11, 11 * REGSZ(x2)
SREG x12, 12 * REGSZ(x2)
SREG x13, 13 * REGSZ(x2)
SREG x14, 14 * REGSZ(x2)
SREG x15, 15 * REGSZ(x2)
SREG x16, 16 * REGSZ(x2)
SREG x17, 17 * REGSZ(x2)
SREG x18, 18 * REGSZ(x2)
SREG x19, 19 * REGSZ(x2)
SREG x20, 20 * REGSZ(x2)
SREG x21, 21 * REGSZ(x2)
SREG x22, 22 * REGSZ(x2)
SREG x23, 23 * REGSZ(x2)
SREG x24, 24 * REGSZ(x2)
SREG x25, 25 * REGSZ(x2)
SREG x26, 26 * REGSZ(x2)
SREG x27, 27 * REGSZ(x2)
SREG x28, 28 * REGSZ(x2)
SREG x29, 29 * REGSZ(x2)
SREG x30, 30 * REGSZ(x2)
SREG x31, 31 * REGSZ(x2)
csrrw t0, mscratch, x0
csrr s0, mstatus
csrr t1, mepc
csrr t2, mbadaddr
csrr t3, mcause
SREG t0, 2 * REGSZ(x2)
SREG s0, 32 * REGSZ(x2)
SREG t1, 33 * REGSZ(x2)
SREG t2, 34 * REGSZ(x2)
SREG t3, 35 * REGSZ(x2)
li x5, -1
SREG x5, 36 * REGSZ(x2)
move a0, sp
jal riscv_handle_exception
csrr a0, mscratch
LREG x1, 1 * REGSZ(a0)
LREG x2, 2 * REGSZ(a0)
LREG x3, 3 * REGSZ(a0)
LREG x4, 4 * REGSZ(a0)
LREG x5, 5 * REGSZ(a0)
LREG x6, 6 * REGSZ(a0)
LREG x7, 7 * REGSZ(a0)
LREG x8, 8 * REGSZ(a0)
LREG x9, 9 * REGSZ(a0)
LREG x11, 11 * REGSZ(a0)
LREG x12, 12 * REGSZ(a0)
LREG x13, 13 * REGSZ(a0)
LREG x14, 14 * REGSZ(a0)
LREG x15, 15 * REGSZ(a0)
LREG x16, 16 * REGSZ(a0)
LREG x17, 17 * REGSZ(a0)
LREG x18, 18 * REGSZ(a0)
LREG x19, 19 * REGSZ(a0)
LREG x20, 20 * REGSZ(a0)
LREG x21, 21 * REGSZ(a0)
LREG x22, 22 * REGSZ(a0)
LREG x23, 23 * REGSZ(a0)
LREG x24, 24 * REGSZ(a0)
LREG x25, 25 * REGSZ(a0)
LREG x26, 26 * REGSZ(a0)
LREG x27, 27 * REGSZ(a0)
LREG x28, 28 * REGSZ(a0)
LREG x29, 29 * REGSZ(a0)
LREG x30, 30 * REGSZ(a0)
LREG x31, 31 * REGSZ(a0)
LREG x10, 10 * REGSZ(a0)
mret
Loading