Skip to content

Commit

Permalink
riscv64: interrupt handling optimizations
Browse files Browse the repository at this point in the history
JIRA: RTOS-844
  • Loading branch information
lukileczo authored and agkaminski committed Jul 9, 2024
1 parent b0730e3 commit 0708492
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions hal/riscv64/_interrupts.S
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@
sd sp, 232(sp) /* ksp */

/* Check FPU status */
csrr t0, sstatus
srli t0, t0, 13
csrr s1, sstatus
srli t0, s1, 13

/* If FPU is clean or dirty, save context */
andi t0, t0, 2
Expand Down Expand Up @@ -148,15 +148,13 @@
csrc sstatus, t0
li t0, (2 << 13)
csrs sstatus, t0
3:
csrr s1, sstatus
3:
csrr s2, sepc
csrr s3, sbadaddr
csrr s4, scause

sd s1, 240(sp) /* sstatus */
sd s2, 248(sp) /* sepc */
sd s3, 256(sp) /* sbadaddr */
sd s4, 264(sp) /* scause */
sd tp, 280(sp) /* tp */
.endm
Expand Down Expand Up @@ -308,8 +306,7 @@ _interrupts_exception:
bnez t2, _interrupts_exceptionNotFpu

/* Get failing instruction */
csrr t0, sepc
lw t2, (t0)
csrr t2, stval
andi t0, t2, 0x7f

/* Check opcode:
Expand Down Expand Up @@ -425,8 +422,10 @@ _interrupts_exceptionFpu:
tail _interrupts_returnUnlocked

_interrupts_exceptionNotFpu:
csrr s3, sbadaddr
/* Save sscratch to be able to get hart ID */
csrr s5, sscratch
sd s3, 256(sp) /* sbadaddr */
sd s5, 272(sp)

mv a1, sp
Expand Down

0 comments on commit 0708492

Please sign in to comment.