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

[RISC-V ECLIC] Fix t0 restore when exiting interrupt #277

Merged
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
14 changes: 7 additions & 7 deletions os/common/ports/RISCV-ECLIC/compilers/GCC/chcoreasm.S
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@
# registers and status csr registers from stack.
# --------------------------------------------------------------------------
.macro RESTORE_CONTEXT
LOAD t0, 17*REGBYTES(sp)
csrw CSR_MEPC, t0
LOAD t0, 18*REGBYTES(sp)
csrw CSR_MCAUSE, t0
LOAD t0, 19*REGBYTES(sp)
csrw CSR_MSUBM, t0

LOAD ra, 0*REGBYTES(sp)
LOAD tp, 1*REGBYTES(sp)
LOAD t0, 2*REGBYTES(sp)
Expand All @@ -121,13 +128,6 @@
LOAD t5, 15*REGBYTES(sp)
LOAD t6, 16*REGBYTES(sp)

LOAD t0, 17*REGBYTES(sp)
csrw CSR_MEPC, t0
LOAD t0, 18*REGBYTES(sp)
csrw CSR_MCAUSE, t0
LOAD t0, 19*REGBYTES(sp)
csrw CSR_MSUBM, t0

# De-allocate the stack space
addi sp, sp, 20*REGBYTES
.endm
Expand Down