Module Name:    src
Committed By:   skrll
Date:           Fri Nov 22 20:01:04 UTC 2024

Modified Files:
        src/sys/arch/riscv/include: locore.h
        src/sys/arch/riscv/riscv: riscv_machdep.c syscall.c trap.c
Added Files:
        src/sys/arch/riscv/include: userret.h

Log Message:
risc-v: split userret into its own header as per other ports

Helps with crash(8)


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/riscv/include/locore.h
cvs rdiff -u -r0 -r1.1 src/sys/arch/riscv/include/userret.h
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/riscv/riscv/riscv_machdep.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/riscv/riscv/syscall.c
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/riscv/riscv/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/riscv/include/locore.h
diff -u src/sys/arch/riscv/include/locore.h:1.13 src/sys/arch/riscv/include/locore.h:1.14
--- src/sys/arch/riscv/include/locore.h:1.13	Thu May  2 18:18:17 2024
+++ src/sys/arch/riscv/include/locore.h	Fri Nov 22 20:01:04 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.13 2024/05/02 18:18:17 skrll Exp $ */
+/* $NetBSD: locore.h,v 1.14 2024/11/22 20:01:04 skrll Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -77,12 +77,6 @@ stack_align(vaddr_t sp)
 }
 
 static inline void
-userret(struct lwp *l)
-{
-	mi_userret(l);
-}
-
-static inline void
 fpu_load(void)
 {
 #ifdef FPE

Index: src/sys/arch/riscv/riscv/riscv_machdep.c
diff -u src/sys/arch/riscv/riscv/riscv_machdep.c:1.38 src/sys/arch/riscv/riscv/riscv_machdep.c:1.39
--- src/sys/arch/riscv/riscv/riscv_machdep.c:1.38	Thu Aug 15 07:03:57 2024
+++ src/sys/arch/riscv/riscv/riscv_machdep.c	Fri Nov 22 20:01:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: riscv_machdep.c,v 1.38 2024/08/15 07:03:57 skrll Exp $	*/
+/*	$NetBSD: riscv_machdep.c,v 1.39 2024/11/22 20:01:04 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2019, 2022 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
 #include "opt_riscv_debug.h"
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: riscv_machdep.c,v 1.38 2024/08/15 07:03:57 skrll Exp $");
+__RCSID("$NetBSD: riscv_machdep.c,v 1.39 2024/11/22 20:01:04 skrll Exp $");
 
 #include <sys/param.h>
 
@@ -64,6 +64,7 @@ __RCSID("$NetBSD: riscv_machdep.c,v 1.38
 #include <riscv/machdep.h>
 #include <riscv/pte.h>
 #include <riscv/sbi.h>
+#include <riscv/userret.h>
 
 #include <libfdt.h>
 #include <dev/fdt/fdtvar.h>

Index: src/sys/arch/riscv/riscv/syscall.c
diff -u src/sys/arch/riscv/riscv/syscall.c:1.5 src/sys/arch/riscv/riscv/syscall.c:1.6
--- src/sys/arch/riscv/riscv/syscall.c:1.5	Thu Oct  5 19:41:05 2023
+++ src/sys/arch/riscv/riscv/syscall.c	Fri Nov 22 20:01:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: syscall.c,v 1.5 2023/10/05 19:41:05 ad Exp $	*/
+/*	$NetBSD: syscall.c,v 1.6 2024/11/22 20:01:04 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.5 2023/10/05 19:41:05 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: syscall.c,v 1.6 2024/11/22 20:01:04 skrll Exp $");
 
 #include <sys/param.h>
 #include <sys/cpu.h>
@@ -39,7 +39,7 @@ __KERNEL_RCSID(0, "$NetBSD: syscall.c,v 
 #include <sys/systm.h>
 
 #include <riscv/frame.h>
-#include <riscv/locore.h>
+#include <riscv/userret.h>
 
 #ifndef EMULNAME
 #define EMULNAME(x)	(x)

Index: src/sys/arch/riscv/riscv/trap.c
diff -u src/sys/arch/riscv/riscv/trap.c:1.27 src/sys/arch/riscv/riscv/trap.c:1.28
--- src/sys/arch/riscv/riscv/trap.c:1.27	Sun Aug  4 08:16:26 2024
+++ src/sys/arch/riscv/riscv/trap.c	Fri Nov 22 20:01:04 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.27 2024/08/04 08:16:26 skrll Exp $	*/
+/*	$NetBSD: trap.c,v 1.28 2024/11/22 20:01:04 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #define	__PMAP_PRIVATE
 #define	__UFETCHSTORE_PRIVATE
 
-__RCSID("$NetBSD: trap.c,v 1.27 2024/08/04 08:16:26 skrll Exp $");
+__RCSID("$NetBSD: trap.c,v 1.28 2024/11/22 20:01:04 skrll Exp $");
 
 #include <sys/param.h>
 
@@ -47,9 +47,9 @@ __RCSID("$NetBSD: trap.c,v 1.27 2024/08/
 
 #include <uvm/uvm.h>
 
-#include <machine/locore.h>
 #include <machine/machdep.h>
 #include <machine/db_machdep.h>
+#include <machine/userret.h>
 
 #define	MACHINE_ECALL_TRAP_MASK	(__BIT(CAUSE_MACHINE_ECALL))
 

Added files:

Index: src/sys/arch/riscv/include/userret.h
diff -u /dev/null src/sys/arch/riscv/include/userret.h:1.1
--- /dev/null	Fri Nov 22 20:01:04 2024
+++ src/sys/arch/riscv/include/userret.h	Fri Nov 22 20:01:04 2024
@@ -0,0 +1,44 @@
+/* $NetBSD: userret.h,v 1.1 2024/11/22 20:01:04 skrll Exp $ */
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _RISCV_USERRET_H_
+#define _RISCV_USERRET_H_
+
+#include <sys/lwp.h>
+#include <sys/userret.h>
+
+static inline void
+userret(struct lwp *l)
+{
+	mi_userret(l);
+}
+
+#endif /* _RISCV_USERRET_H_ */

Reply via email to