git: 99ed9753a5c5 - main - riscv: Preserve savectx return address with vector support

From: Minsoo Choo <mchoo_at_FreeBSD.org>
Date: Tue, 15 Sep 2026 14:06:59 UTC
The branch main has been updated by mchoo:

URL: https://cgit.FreeBSD.org/src/commit/?id=99ed9753a5c5c5262a0ed1464c701cde174b55fd

commit 99ed9753a5c5c5262a0ed1464c701cde174b55fd
Author:     Minsoo Choo <mchoo@FreeBSD.org>
AuthorDate: 2026-09-15 01:13:31 +0000
Commit:     Minsoo Choo <mchoo@FreeBSD.org>
CommitDate: 2026-09-15 14:06:40 +0000

    riscv: Preserve savectx return address with vector support
    
    Calling vector_state_store_savectx() overwrites ra with the address of
    the following ret instruction.  The ret consequently branches to itself
    and prevents kernel dumps from progressing past dump_savectx().
    
    Tail-call vector_state_store_savectx() so that it returns directly to
    the original savectx() caller.
    
    Reviewed by:    br, jrtc27
    Approved by:    jrtc27
    Fixes:          d7a393095cfd ("riscv: Vector Extension (RVV) support.")
    Sponsored by:   FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D59689
---
 sys/riscv/riscv/swtch.S | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/sys/riscv/riscv/swtch.S b/sys/riscv/riscv/swtch.S
index b7b2e1ec9dd3..0c14bb9669ab 100644
--- a/sys/riscv/riscv/swtch.S
+++ b/sys/riscv/riscv/swtch.S
@@ -505,6 +505,5 @@ ENTRY(savectx)
 	sd	s11, (PCB_S + 11 * 8)(a0)
 
 	__fpe_state_save a0
-	call	_C_LABEL(vector_state_store_savectx)
-	ret
+	tail	_C_LABEL(vector_state_store_savectx)
 END(savectx)