[PATCH 2/2] lib: sbi: sse: Fix a6 and a7 register content upon injection

Clément Léger cleger at rivosinc.com
Mon Nov 25 02:53:00 PST 2024


The specification states that a6 contains the current hart id and a7
contains the entry argument. This was inverted in the current
implementation.

Reported-by: Andrew Jones <andrew.jones at linux.dev>
Signed-off-by: Clément Léger <cleger at rivosinc.com>
---
 lib/sbi/sbi_sse.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/sbi/sbi_sse.c b/lib/sbi/sbi_sse.c
index bf5620e..c9f9a9d 100644
--- a/lib/sbi/sbi_sse.c
+++ b/lib/sbi/sbi_sse.c
@@ -509,8 +509,8 @@ static void sse_event_inject(struct sbi_sse_event *e,
 	csr_write(CSR_SEPC, regs->mepc);
 
 	/* Setup entry context */
-	regs->a6 = e->attrs.entry.arg;
-	regs->a7 = current_hartid();
+	regs->a6 = current_hartid();
+	regs->a7 = e->attrs.entry.arg;
 	regs->mepc = e->attrs.entry.pc;
 
 	/* Return to S-mode with virtualization disabled */
-- 
2.45.2




More information about the opensbi mailing list