CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Sun Sep 17 14:22:28 UTC 2023 Modified Files: src/sys/arch/sh3/dev: sci.c Log Message: remove unneeded whitespace in empty line from my previous commit. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sh3/dev/sci.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/sh3/dev/sci.c diff -u src/sys/arch/sh3/dev/sci.c:1.64 src/sys/arch/sh3/dev/sci.c:1.65 --- src/sys/arch/sh3/dev/sci.c:1.64 Sat Sep 16 18:56:39 2023 +++ src/sys/arch/sh3/dev/sci.c Sun Sep 17 14:22:28 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.64 2023/09/16 18:56:39 andvar Exp $ */ +/* $NetBSD: sci.c,v 1.65 2023/09/17 14:22:28 andvar Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.64 2023/09/16 18:56:39 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.65 2023/09/17 14:22:28 andvar Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -1215,7 +1215,7 @@ sciintr(void *arg) if (ISSET(~msr, sc->sc_msr_mask)) { sc->sc_tbc = 0; sc->sc_heldtbc = 0; - + DPRINTF(("%s: sciintr\n", device_xname(sc->sc_dev))); }
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Sun Sep 17 14:22:28 UTC 2023 Modified Files: src/sys/arch/sh3/dev: sci.c Log Message: remove unneeded whitespace in empty line from my previous commit. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/sys/arch/sh3/dev/sci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Sat Sep 16 18:56:40 UTC 2023 Modified Files: src/sys/arch/sh3/dev: sci.c Log Message: sh3/sci(4): replace undefined scistatus with DPRINTF. Fixes the build with SCI_DEBUG enabled. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sh3/dev/sci.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/sh3/dev/sci.c diff -u src/sys/arch/sh3/dev/sci.c:1.63 src/sys/arch/sh3/dev/sci.c:1.64 --- src/sys/arch/sh3/dev/sci.c:1.63 Sat Nov 21 17:25:52 2020 +++ src/sys/arch/sh3/dev/sci.c Sat Sep 16 18:56:39 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: sci.c,v 1.63 2020/11/21 17:25:52 thorpej Exp $ */ +/* $NetBSD: sci.c,v 1.64 2023/09/16 18:56:39 andvar Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.63 2020/11/21 17:25:52 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.64 2023/09/16 18:56:39 andvar Exp $"); #include "opt_kgdb.h" #include "opt_sci.h" @@ -119,6 +119,13 @@ __KERNEL_RCSID(0, "$NetBSD: sci.c,v 1.63 #include #include +#ifdef SCI_DEBUG +int sci_debug = 1; +#define DPRINTF(x) if (sci_debug) printf x +#else +#define DPRINTF(x) +#endif + static void scistart(struct tty *); static int sciparam(struct tty *, struct termios *); @@ -573,10 +580,7 @@ sciparam(struct tty *tp, struct termios splx(s); -#ifdef SCI_DEBUG - if (sci_debug) - scistatus(sc, "sciparam "); -#endif + DPRINTF(("%s: sciparam\n", device_xname(sc->sc_dev))); if (!ISSET(t->c_cflag, CHWFLOW)) { if (sc->sc_tx_stopped) { @@ -692,10 +696,7 @@ sciopen(dev_t dev, int flag, int mode, s sci_hwiflow(sc); #endif -#ifdef SCI_DEBUG - if (sci_debug) - scistatus(sc, "sciopen "); -#endif + DPRINTF(("%s: sciopen\n", device_xname(sc->sc_dev))); splx(s2); } @@ -1025,10 +1026,7 @@ sci_stsoft(struct sci_softc *sc, struct } } -#ifdef SCI_DEBUG - if (sci_debug) - scistatus(sc, "sci_stsoft"); -#endif + DPRINTF(("%s: sci_stsoft\n", device_xname(sc->sc_dev))); #endif } @@ -1217,10 +1215,8 @@ sciintr(void *arg) if (ISSET(~msr, sc->sc_msr_mask)) { sc->sc_tbc = 0; sc->sc_heldtbc = 0; -#ifdef SCI_DEBUG - if (sci_debug) -scistatus(sc, "sciintr "); -#endif + + DPRINTF(("%s: sciintr\n", device_xname(sc->sc_dev))); } sc->sc_st_check = 1;
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Sat Sep 16 18:56:40 UTC 2023 Modified Files: src/sys/arch/sh3/dev: sci.c Log Message: sh3/sci(4): replace undefined scistatus with DPRINTF. Fixes the build with SCI_DEBUG enabled. To generate a diff of this commit: cvs rdiff -u -r1.63 -r1.64 src/sys/arch/sh3/dev/sci.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Sat Sep 16 15:42:01 UTC 2023 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: sh3/scif(4): redefine DPRINTF again, not all SH ports has machine/debug.h. Those are defined for hpc only. unbreaks build for evbsh some kernel configs and SFIC_DEBUG still builds. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/dev/scif.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/sh3/dev/scif.c diff -u src/sys/arch/sh3/dev/scif.c:1.69 src/sys/arch/sh3/dev/scif.c:1.70 --- src/sys/arch/sh3/dev/scif.c:1.69 Fri Sep 15 20:59:56 2023 +++ src/sys/arch/sh3/dev/scif.c Sat Sep 16 15:42:01 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.69 2023/09/15 20:59:56 andvar Exp $ */ +/* $NetBSD: scif.c,v 1.70 2023/09/16 15:42:01 andvar Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.69 2023/09/15 20:59:56 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.70 2023/09/16 15:42:01 andvar Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -177,10 +177,11 @@ struct scif_softc { }; #ifdef SCIF_DEBUG -#define DPRINTF_ENABLE -#define DPRINTF_DEBUG scif_debug +int scif_debug = 1; +#define DPRINTF(x) if (scif_debug) printf x +#else +#define DPRINTF(x) #endif -#include static int scif_match(device_t, cfdata_t, void *); static void scif_attach(device_t, device_t, void *); @@ -688,7 +689,7 @@ scifparam(struct tty *tp, struct termios splx(s); - DPRINTF("%s: scifparam\n", device_xname(sc->sc_dev)); + DPRINTF(("%s: scifparam\n", device_xname(sc->sc_dev))); if (!ISSET(t->c_cflag, CHWFLOW)) { if (sc->sc_tx_stopped) { @@ -799,7 +800,7 @@ scifopen(dev_t dev, int flag, int mode, scif_hwiflow(sc); #endif - DPRINTF("%s: scifopen\n", device_xname(sc->sc_dev)); + DPRINTF(("%s: scifopen\n", device_xname(sc->sc_dev))); splx(s2); } @@ -1147,7 +1148,7 @@ scif_stsoft(struct scif_softc *sc, struc } } - DPRINTF("%s: scif_stsoft\n", device_xname(sc->sc_dev)); + DPRINTF(("%s: scif_stsoft\n", device_xname(sc->sc_dev))); } #endif /* 0 */ @@ -1343,7 +1344,7 @@ scifintr(void *arg) if (ISSET(~msr, sc->sc_msr_mask)) { sc->sc_tbc = 0; sc->sc_heldtbc = 0; - DPRINTF("%s: scifintr\n", device_xname(sc->sc_dev)); + DPRINTF(("%s: scifintr\n", device_xname(sc->sc_dev))); } sc->sc_st_check = 1;
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Sat Sep 16 15:42:01 UTC 2023 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: sh3/scif(4): redefine DPRINTF again, not all SH ports has machine/debug.h. Those are defined for hpc only. unbreaks build for evbsh some kernel configs and SFIC_DEBUG still builds. To generate a diff of this commit: cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/dev/scif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Fri Sep 15 20:59:56 UTC 2023 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: sh3/scif(4): replace undefined scifstatus with DPRINTF. fixes the build with SCIF_DEBUG enabled. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sh3/dev/scif.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/sh3/dev/scif.c diff -u src/sys/arch/sh3/dev/scif.c:1.68 src/sys/arch/sh3/dev/scif.c:1.69 --- src/sys/arch/sh3/dev/scif.c:1.68 Sat Nov 21 17:25:52 2020 +++ src/sys/arch/sh3/dev/scif.c Fri Sep 15 20:59:56 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: scif.c,v 1.68 2020/11/21 17:25:52 thorpej Exp $ */ +/* $NetBSD: scif.c,v 1.69 2023/09/15 20:59:56 andvar Exp $ */ /*- * Copyright (C) 1999 T.Horiuchi and SAITOH Masanobu. All rights reserved. @@ -93,7 +93,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.68 2020/11/21 17:25:52 thorpej Exp $"); +__KERNEL_RCSID(0, "$NetBSD: scif.c,v 1.69 2023/09/15 20:59:56 andvar Exp $"); #include "opt_kgdb.h" #include "opt_scif.h" @@ -176,6 +176,11 @@ struct scif_softc { volatile u_char sc_heldchange; }; +#ifdef SCIF_DEBUG +#define DPRINTF_ENABLE +#define DPRINTF_DEBUG scif_debug +#endif +#include static int scif_match(device_t, cfdata_t, void *); static void scif_attach(device_t, device_t, void *); @@ -683,10 +688,7 @@ scifparam(struct tty *tp, struct termios splx(s); -#ifdef SCIF_DEBUG - if (scif_debug) - scifstatus(sc, "scifparam "); -#endif + DPRINTF("%s: scifparam\n", device_xname(sc->sc_dev)); if (!ISSET(t->c_cflag, CHWFLOW)) { if (sc->sc_tx_stopped) { @@ -797,10 +799,7 @@ scifopen(dev_t dev, int flag, int mode, scif_hwiflow(sc); #endif -#ifdef SCIF_DEBUG - if (scif_debug) - scifstatus(sc, "scifopen "); -#endif + DPRINTF("%s: scifopen\n", device_xname(sc->sc_dev)); splx(s2); } @@ -1148,10 +1147,7 @@ scif_stsoft(struct scif_softc *sc, struc } } -#ifdef SCIF_DEBUG - if (scif_debug) - scifstatus(sc, "scif_stsoft"); -#endif + DPRINTF("%s: scif_stsoft\n", device_xname(sc->sc_dev)); } #endif /* 0 */ @@ -1347,10 +1343,7 @@ scifintr(void *arg) if (ISSET(~msr, sc->sc_msr_mask)) { sc->sc_tbc = 0; sc->sc_heldtbc = 0; -#ifdef SCIF_DEBUG - if (scif_debug) -scifstatus(sc, "scifintr "); -#endif + DPRINTF("%s: scifintr\n", device_xname(sc->sc_dev)); } sc->sc_st_check = 1;
CVS commit: src/sys/arch/sh3/dev
Module Name:src Committed By: andvar Date: Fri Sep 15 20:59:56 UTC 2023 Modified Files: src/sys/arch/sh3/dev: scif.c Log Message: sh3/scif(4): replace undefined scifstatus with DPRINTF. fixes the build with SCIF_DEBUG enabled. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.69 src/sys/arch/sh3/dev/scif.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: andvar Date: Sat Sep 2 21:54:55 UTC 2023 Modified Files: src/sys/arch/sh3/include: db_machdep.h Log Message: remove (db_addr_t) cast in sh3 PC_REGS(regs) definition. Fixes KGDB build option for SH3/4 code. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/include/db_machdep.h 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/sh3/include/db_machdep.h diff -u src/sys/arch/sh3/include/db_machdep.h:1.17 src/sys/arch/sh3/include/db_machdep.h:1.18 --- src/sys/arch/sh3/include/db_machdep.h:1.17 Mon Nov 6 03:47:48 2017 +++ src/sys/arch/sh3/include/db_machdep.h Sat Sep 2 21:54:55 2023 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.17 2017/11/06 03:47:48 christos Exp $ */ +/* $NetBSD: db_machdep.h,v 1.18 2023/09/02 21:54:55 andvar Exp $ */ /* * Mach Operating System @@ -46,7 +46,7 @@ typedef struct trapframe db_regs_t; extern db_regs_t ddb_regs; /* register state */ #define DDB_REGS (_regs) -#define PC_REGS(regs) ((db_addr_t)(regs)->tf_spc) +#define PC_REGS(regs) ((regs)->tf_spc) #define PC_ADVANCE(regs) ((regs)->tf_spc += BKPT_SIZE) #define BKPT_ADDR(addr) (addr) /* breakpoint address */
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: andvar Date: Sat Sep 2 21:54:55 UTC 2023 Modified Files: src/sys/arch/sh3/include: db_machdep.h Log Message: remove (db_addr_t) cast in sh3 PC_REGS(regs) definition. Fixes KGDB build option for SH3/4 code. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: riastradh Date: Sun Feb 13 13:41:53 UTC 2022 Modified Files: src/sys/arch/sh3/include: lock.h Log Message: sh3: __cpu_simple_unlock needs __insn_barrier. No multiprocessor support here but the compiler can still reorder memory access. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sh3/include/lock.h 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/sh3/include/lock.h diff -u src/sys/arch/sh3/include/lock.h:1.18 src/sys/arch/sh3/include/lock.h:1.19 --- src/sys/arch/sh3/include/lock.h:1.18 Fri Nov 29 20:06:08 2019 +++ src/sys/arch/sh3/include/lock.h Sun Feb 13 13:41:53 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: lock.h,v 1.18 2019/11/29 20:06:08 riastradh Exp $ */ +/* $NetBSD: lock.h,v 1.19 2022/02/13 13:41:53 riastradh Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -107,6 +107,7 @@ static __inline void __cpu_simple_unlock(__cpu_simple_lock_t *alp) { + __insn_barrier(); *alp = __SIMPLELOCK_UNLOCKED; }
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: riastradh Date: Sun Feb 13 13:41:53 UTC 2022 Modified Files: src/sys/arch/sh3/include: lock.h Log Message: sh3: __cpu_simple_unlock needs __insn_barrier. No multiprocessor support here but the compiler can still reorder memory access. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sh3/include/lock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: thorpej Date: Fri Oct 29 04:14:44 UTC 2021 Modified Files: src/sys/arch/sh3/include: signal.h Log Message: Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sh3/include/signal.h 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/sh3/include/signal.h diff -u src/sys/arch/sh3/include/signal.h:1.16 src/sys/arch/sh3/include/signal.h:1.17 --- src/sys/arch/sh3/include/signal.h:1.16 Wed Oct 27 01:11:34 2021 +++ src/sys/arch/sh3/include/signal.h Fri Oct 29 04:14:44 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.16 2021/10/27 01:11:34 thorpej Exp $ */ +/* $NetBSD: signal.h,v 1.17 2021/10/29 04:14:44 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. @@ -36,6 +36,8 @@ #include +#define __HAVE_STRUCT_SIGCONTEXT + typedef int sig_atomic_t; #if defined(_NETBSD_SOURCE) @@ -78,7 +80,6 @@ struct sigcontext13 { #endif /* _KERNEL */ #if defined(_LIBC) || defined(_KERNEL) -#define __HAVE_STRUCT_SIGCONTEXT struct sigcontext { int sc_spc; int sc_ssr;
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: thorpej Date: Fri Oct 29 04:14:44 UTC 2021 Modified Files: src/sys/arch/sh3/include: signal.h Log Message: Define __HAVE_STRUCT_SIGCONTEXT regardless of its current visibility. To generate a diff of this commit: cvs rdiff -u -r1.16 -r1.17 src/sys/arch/sh3/include/signal.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: thorpej Date: Wed Oct 27 01:11:35 UTC 2021 Modified Files: src/sys/arch/sh3/include: signal.h Log Message: Make sigcontext13 visible only to _KERNEL. Make sigcontext visible only to _LIBC and _KERNEL. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/signal.h 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/sh3/include/signal.h diff -u src/sys/arch/sh3/include/signal.h:1.15 src/sys/arch/sh3/include/signal.h:1.16 --- src/sys/arch/sh3/include/signal.h:1.15 Tue Oct 26 16:16:35 2021 +++ src/sys/arch/sh3/include/signal.h Wed Oct 27 01:11:34 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: signal.h,v 1.15 2021/10/26 16:16:35 christos Exp $ */ +/* $NetBSD: signal.h,v 1.16 2021/10/27 01:11:34 thorpej Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1991 Regents of the University of California. @@ -47,7 +47,7 @@ typedef int sig_atomic_t; * to the handler to allow it to restore state properly if * a non-standard exit is performed. */ -#if defined(__LIBC12_SOURCE__) || defined(_KERNEL) +#if defined(_KERNEL) struct sigcontext13 { int sc_spc; int sc_ssr; @@ -75,8 +75,9 @@ struct sigcontext13 { int sc_expevt; /* XXX should be above */ int sc_err; }; -#endif +#endif /* _KERNEL */ +#if defined(_LIBC) || defined(_KERNEL) #define __HAVE_STRUCT_SIGCONTEXT struct sigcontext { int sc_spc; @@ -106,6 +107,7 @@ struct sigcontext { sigset_t sc_mask; /* signal mask to restore (new style) */ }; +#endif /* _LIBC || _KERNEL */ #endif /* _NETBSD_SOURCE */ #endif /* !_SH3_SIGNAL_H_ */
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: thorpej Date: Wed Oct 27 01:11:35 UTC 2021 Modified Files: src/sys/arch/sh3/include: signal.h Log Message: Make sigcontext13 visible only to _KERNEL. Make sigcontext visible only to _LIBC and _KERNEL. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/signal.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 21:34:57 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Fix trailing backslashes in a macro that got misaligned. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/sh3/cpu_in_cksum.S 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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.10 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.11 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.10 Sat Sep 18 19:21:39 2021 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Sat Sep 18 21:34:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.10 2021/09/18 19:21:39 uwe Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.11 2021/09/18 21:34:56 uwe Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -34,7 +34,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.10 2021/09/18 19:21:39 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.11 2021/09/18 21:34:56 uwe Exp $") #define reg_byte_swapped r1 @@ -58,9 +58,9 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum #if _BYTE_ORDER == BIG_ENDIAN #define ADDB \ - mov.b @reg_w+, r0 ; \ - ROL; \ - extu.b r0, r0 ; \ + mov.b @reg_w+, r0 ; \ + ROL ; \ + extu.b r0, r0 ; \ add r0, reg_sum ; \ not reg_byte_swapped, reg_byte_swapped #else
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 21:34:57 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Fix trailing backslashes in a macro that got misaligned. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/sys/arch/sh3/sh3/cpu_in_cksum.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 19:21:39 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Fix one comment edit missed in previous. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/sh3/cpu_in_cksum.S 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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.9 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.10 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.9 Sat Sep 18 15:09:05 2021 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Sat Sep 18 19:21:39 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.9 2021/09/18 15:09:05 uwe Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.10 2021/09/18 19:21:39 uwe Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -34,7 +34,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.9 2021/09/18 15:09:05 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.10 2021/09/18 19:21:39 uwe Exp $") #define reg_byte_swapped r1 @@ -213,7 +213,7 @@ mbuf_loop_done: tst reg_byte_swapped, reg_byte_swapped bt/s 1f - REDUCE /* 1st instruction break only r0(r0) */ + REDUCE /* 1st instruction break only r0 */ ROL 1:
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 19:21:39 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Fix one comment edit missed in previous. To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sh3/sh3/cpu_in_cksum.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 15:09:05 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Do not obfuscate r0 as "reg_tmp0". Using r0 as a temp is a common choice. Some instructions _must_ use r0 as the destination (like mova or instructions with immediates). ABI uses r0 as the return register. So a helpful name is not that helpful for the former use case (temp) and is confusing for the latter two (ISA or ABI constraints). Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sh3/sh3/cpu_in_cksum.S 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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.8 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.9 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.8 Sat Sep 18 14:57:10 2021 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Sat Sep 18 15:09:05 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.8 2021/09/18 14:57:10 uwe Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.9 2021/09/18 15:09:05 uwe Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -34,10 +34,9 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.8 2021/09/18 14:57:10 uwe Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.9 2021/09/18 15:09:05 uwe Exp $") -#define reg_tmp0 r0 #define reg_byte_swapped r1 #define reg_mlen r2 #define reg_tmp3 r3 @@ -49,39 +48,39 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum #define REDUCE \ - swap.w reg_sum, reg_tmp0 ; \ + swap.w reg_sum, r0 ; \ extu.w reg_sum, reg_sum ; \ - extu.w reg_tmp0, reg_tmp0 ; \ - add reg_tmp0, reg_sum + extu.w r0, r0 ; \ + add r0, reg_sum #define ROL \ shll8 reg_sum #if _BYTE_ORDER == BIG_ENDIAN #define ADDB \ - mov.b @reg_w+, reg_tmp0 ; \ + mov.b @reg_w+, r0 ; \ ROL; \ - extu.b reg_tmp0, reg_tmp0 ; \ - add reg_tmp0, reg_sum ; \ + extu.b r0, r0 ; \ + add r0, reg_sum ; \ not reg_byte_swapped, reg_byte_swapped #else #define ADDB \ - mov.b @reg_w+, reg_tmp0 ; \ - extu.b reg_tmp0, reg_tmp0 ; \ - add reg_tmp0, reg_sum ; \ - ROL; \ + mov.b @reg_w+, r0 ; \ + extu.b r0, r0 ; \ + add r0, reg_sum ; \ + ROL ; \ not reg_byte_swapped, reg_byte_swapped #endif #define ADDS \ - mov.w @reg_w+, reg_tmp0 ; \ - extu.w reg_tmp0, reg_tmp0 ; \ - add reg_tmp0, reg_sum + mov.w @reg_w+, r0 ; \ + extu.w r0, r0 ; \ + add r0, reg_sum #define ADDCL \ - mov.l @reg_w+, reg_tmp0 ; \ - addc reg_tmp0, reg_sum + mov.l @reg_w+, r0 ; \ + addc r0, reg_sum #define FORWARD1 \ add #-1, reg_mlen @@ -149,38 +148,38 @@ mbuf_loop: sub reg_mlen, reg_len - mov reg_w, reg_tmp0 - tst #1, reg_tmp0 + mov reg_w, r0 + tst #1, r0 bt/s 1f - REDUCE /* 1st instruction break only reg_tmp0(r0) */ + REDUCE /* 1st instruction break only r0 */ ADDB FORWARD1 1: - mov #1, reg_tmp0 - cmp/gt reg_tmp0, reg_mlen + mov #1, r0 + cmp/gt r0, reg_mlen bf/s 1f - mov reg_w, reg_tmp0 - tst #2, reg_tmp0 + mov reg_w, r0 + tst #2, r0 bt/s 1f - REDUCE /* 1st instruction break only reg_tmp0(r0) */ + REDUCE /* 1st instruction break only r0 */ ADDS FORWARD2 1: - mov #127, reg_tmp0 - cmp/hi reg_tmp0, reg_mlen + mov #127, r0 + cmp/hi r0, reg_mlen bf 1f do_cksum128: bsr cksum128 nop - mov #127, reg_tmp0 - cmp/hi reg_tmp0, reg_mlen + mov #127, r0 + cmp/hi r0, reg_mlen bt do_cksum128 1: @@ -190,8 +189,8 @@ do_cksum128: REDUCE - mov #1, reg_tmp0 - cmp/gt reg_tmp0, reg_mlen + mov #1, r0 + cmp/gt r0, reg_mlen bf 1f ADDS FORWARD2 @@ -214,7 +213,7 @@ mbuf_loop_done: tst reg_byte_swapped, reg_byte_swapped bt/s 1f - REDUCE /* 1st instruction break only reg_tmp0(r0) */ + REDUCE /* 1st instruction break only r0(r0) */ ROL 1: @@ -230,13 +229,13 @@ in_cksum_return: out_of_mbufs: - mova .L_message_out_of_data, reg_tmp0 + mova .L_message_out_of_data, r0 mov.l .L_printf, reg_tmp3 mov.l reg_sum, @-sp /* save: call clobbered register */ 1: CALL reg_tmp3 - mov reg_tmp0, r4 + mov r0, r4 bra in_cksum_return mov.l @sp+, reg_sum /* restore */ @@ -256,14 +255,14 @@ out_of_mbufs: .align 2 cksum128mod: - mov reg_mlen, reg_tmp0 - and #124, reg_tmp0 - sub reg_tmp0, reg_mlen - mov reg_tmp0, reg_tmp3 - - mova cksum128_tail, reg_tmp0 - sub reg_tmp3, reg_tmp0 - jmp @reg_tmp0 + mov reg_mlen, r0 + and #124, r0 + sub r0, reg_mlen + mov r0, reg_tmp3 + + mova cksum128_tail, r0 + sub reg_tmp3, r0 + jmp @r0 clrt .align 2 @@ -305,6 +304,6 @@ cksum128_unroll: ADDCL ADDCL cksum128_tail: - mov #0, reg_tmp0 + mov #0, r0 rts - addc reg_tmp0, reg_sum + addc r0, reg_sum
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 15:09:05 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Do not obfuscate r0 as "reg_tmp0". Using r0 as a temp is a common choice. Some instructions _must_ use r0 as the destination (like mova or instructions with immediates). ABI uses r0 as the return register. So a helpful name is not that helpful for the former use case (temp) and is confusing for the latter two (ISA or ABI constraints). Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sh3/sh3/cpu_in_cksum.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 14:57:10 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Space after comma in operands. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sh3/sh3/cpu_in_cksum.S 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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.7 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.8 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.7 Sat Sep 18 06:32:41 2021 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Sat Sep 18 14:57:10 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.7 2021/09/18 06:32:41 rin Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.8 2021/09/18 14:57:10 uwe Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -34,7 +34,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.7 2021/09/18 06:32:41 rin Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.8 2021/09/18 14:57:10 uwe Exp $") #define reg_tmp0 r0 @@ -49,45 +49,45 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum #define REDUCE \ - swap.w reg_sum,reg_tmp0 ; \ - extu.w reg_sum,reg_sum ; \ - extu.w reg_tmp0,reg_tmp0 ; \ - add reg_tmp0,reg_sum + swap.w reg_sum, reg_tmp0 ; \ + extu.w reg_sum, reg_sum ; \ + extu.w reg_tmp0, reg_tmp0 ; \ + add reg_tmp0, reg_sum #define ROL \ shll8 reg_sum #if _BYTE_ORDER == BIG_ENDIAN #define ADDB \ - mov.b @reg_w+,reg_tmp0 ; \ + mov.b @reg_w+, reg_tmp0 ; \ ROL; \ - extu.b reg_tmp0,reg_tmp0 ; \ - add reg_tmp0,reg_sum ; \ - not reg_byte_swapped,reg_byte_swapped + extu.b reg_tmp0, reg_tmp0 ; \ + add reg_tmp0, reg_sum ; \ + not reg_byte_swapped, reg_byte_swapped #else #define ADDB \ - mov.b @reg_w+,reg_tmp0 ; \ - extu.b reg_tmp0,reg_tmp0 ; \ - add reg_tmp0,reg_sum ; \ + mov.b @reg_w+, reg_tmp0 ; \ + extu.b reg_tmp0, reg_tmp0 ; \ + add reg_tmp0, reg_sum ; \ ROL; \ - not reg_byte_swapped,reg_byte_swapped + not reg_byte_swapped, reg_byte_swapped #endif #define ADDS \ - mov.w @reg_w+,reg_tmp0 ; \ - extu.w reg_tmp0,reg_tmp0 ; \ - add reg_tmp0,reg_sum + mov.w @reg_w+, reg_tmp0 ; \ + extu.w reg_tmp0, reg_tmp0 ; \ + add reg_tmp0, reg_sum #define ADDCL \ - mov.l @reg_w+,reg_tmp0 ; \ - addc reg_tmp0,reg_sum + mov.l @reg_w+, reg_tmp0 ; \ + addc reg_tmp0, reg_sum #define FORWARD1 \ - add #-1,reg_mlen + add #-1, reg_mlen #define FORWARD2 \ - add #-2,reg_mlen + add #-2, reg_mlen /* @@ -97,7 +97,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum * LINTSTUB: Func: int cpu_in_cksum(struct mbuf *m, int len, int off, uint32_t initial_sum); */ ENTRY(cpu_in_cksum) - sts.l pr,@-sp + sts.l pr, @-sp PIC_PROLOGUE(.L_got) tst reg_len, reg_len @@ -128,13 +128,13 @@ ENTRY(cpu_in_cksum) mbuf_loop: - tst reg_m,reg_m + tst reg_m, reg_m bt out_of_mbufs - mov.l @(M_LEN,reg_m),reg_mlen - tst reg_mlen,reg_mlen + mov.l @(M_LEN, reg_m), reg_mlen + tst reg_mlen, reg_mlen bt/s mbuf_loop_continue - mov.l @(M_DATA,reg_m),reg_w + mov.l @(M_DATA, reg_m), reg_w !! Entry point for mbuf loop. We jump here after we have @@ -142,15 +142,15 @@ mbuf_loop: !! offset. reg_mlen and reg_w were adjusted to point at the !! first interesting byte of data. .L_mbuf_loop_enter: - cmp/ge reg_mlen,reg_len + cmp/ge reg_mlen, reg_len bt 1f - mov reg_len,reg_mlen + mov reg_len, reg_mlen 1: - sub reg_mlen,reg_len + sub reg_mlen, reg_len - mov reg_w,reg_tmp0 - tst #1,reg_tmp0 + mov reg_w, reg_tmp0 + tst #1, reg_tmp0 bt/s 1f REDUCE /* 1st instruction break only reg_tmp0(r0) */ ADDB @@ -158,11 +158,11 @@ mbuf_loop: 1: - mov #1,reg_tmp0 - cmp/gt reg_tmp0,reg_mlen + mov #1, reg_tmp0 + cmp/gt reg_tmp0, reg_mlen bf/s 1f - mov reg_w,reg_tmp0 - tst #2,reg_tmp0 + mov reg_w, reg_tmp0 + tst #2, reg_tmp0 bt/s 1f REDUCE /* 1st instruction break only reg_tmp0(r0) */ ADDS @@ -171,16 +171,16 @@ mbuf_loop: - mov #127,reg_tmp0 - cmp/hi reg_tmp0,reg_mlen + mov #127, reg_tmp0 + cmp/hi reg_tmp0, reg_mlen bf 1f do_cksum128: bsr cksum128 nop - mov #127,reg_tmp0 - cmp/hi reg_tmp0,reg_mlen + mov #127, reg_tmp0 + cmp/hi reg_tmp0, reg_mlen bt do_cksum128 1: @@ -190,29 +190,29 @@ do_cksum128: REDUCE - mov #1,reg_tmp0 - cmp/gt reg_tmp0,reg_mlen + mov #1, reg_tmp0 + cmp/gt reg_tmp0, reg_mlen bf 1f ADDS FORWARD2 1: - mov reg_mlen,r0 - tst #1,r0 + mov reg_mlen, r0 + tst #1, r0 bt 1f ADDB 1: mbuf_loop_continue: - mov.l @(M_NEXT,reg_m),reg_m + mov.l @(M_NEXT, reg_m), reg_m - tst reg_len,reg_len + tst reg_len, reg_len bf/s mbuf_loop mbuf_loop_done: - tst reg_byte_swapped,reg_byte_swapped + tst reg_byte_swapped, reg_byte_swapped bt/s 1f REDUCE /* 1st instruction break only reg_tmp0(r0) */ ROL @@ -222,24 +222,24 @@ mbuf_loop_done: REDUCE in_cksum_return: - not reg_sum,r0 + not reg_sum, r0 PIC_EPILOGUE - lds.l @sp+,pr + lds.l
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: uwe Date: Sat Sep 18 14:57:10 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Space after comma in operands. Same object code is generated. To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sh3/sh3/cpu_in_cksum.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Sat Sep 18 06:32:41 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Support __PIC__ build, in order to avoid text relocations for /usr/tests/net/in_cksum/in_cksum. Now, all the tests for in_cksum successfully pass for sh[34]. No binary changes for kernel. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sh3/sh3/cpu_in_cksum.S 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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.6 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.7 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.6 Sat Sep 18 06:31:46 2021 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Sat Sep 18 06:32:41 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.6 2021/09/18 06:31:46 rin Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.7 2021/09/18 06:32:41 rin Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -34,7 +34,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.6 2021/09/18 06:31:46 rin Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.7 2021/09/18 06:32:41 rin Exp $") #define reg_tmp0 r0 @@ -98,6 +98,7 @@ __KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum */ ENTRY(cpu_in_cksum) sts.l pr,@-sp + PIC_PROLOGUE(.L_got) tst reg_len, reg_len bt/s mbuf_loop_done @@ -222,6 +223,7 @@ mbuf_loop_done: in_cksum_return: not reg_sum,r0 + PIC_EPILOGUE lds.l @sp+,pr rts extu.w r0,r0 @@ -233,15 +235,17 @@ out_of_mbufs: mov.l reg_sum,@-sp /* save: call clobbered register */ - jsr @reg_tmp3 +1: CALL reg_tmp3 mov reg_tmp0,r4 bra in_cksum_return mov.l @sp+,reg_sum /* restore */ .align 2 +.L_got: + PIC_GOT_DATUM .L_printf: - .long _C_LABEL(printf) + CALL_DATUM(_C_LABEL(printf), 1b) .align 2 /* mova target */ .L_message_out_of_data:
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Sat Sep 18 06:32:41 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: Support __PIC__ build, in order to avoid text relocations for /usr/tests/net/in_cksum/in_cksum. Now, all the tests for in_cksum successfully pass for sh[34]. No binary changes for kernel. To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/sys/arch/sh3/sh3/cpu_in_cksum.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Sat Sep 18 06:31:46 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: cksum128mod: Prepare jump address by 'mova', instead of 'mov.l'. Since both this 'mova' and 'and #imm' above must be used against r0, we need extra 'mov r0, r3'. However, this should still be good both for sh3 and sh4: - For sh3, 'mov.l' at odd half-word address is removed; pipeline hazard due to instruction fetch is resolved. - For sh4, data cache line is no longer assigned for this 'mov.l'. Also: - Upcoming __PIC__ support (in order to avoid text relocations when built in tests/net/in_cksum) becomes simpler; no need CALL_DATUM_LOCAL() for cksum128_tail. - Shave off 4 bytes from text. No regression is observed for sh3 (hpcsh) and sh4 (landisk). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sh3/sh3/cpu_in_cksum.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Sat Sep 18 06:31:46 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: cpu_in_cksum.S Log Message: cksum128mod: Prepare jump address by 'mova', instead of 'mov.l'. Since both this 'mova' and 'and #imm' above must be used against r0, we need extra 'mov r0, r3'. However, this should still be good both for sh3 and sh4: - For sh3, 'mov.l' at odd half-word address is removed; pipeline hazard due to instruction fetch is resolved. - For sh4, data cache line is no longer assigned for this 'mov.l'. Also: - Upcoming __PIC__ support (in order to avoid text relocations when built in tests/net/in_cksum) becomes simpler; no need CALL_DATUM_LOCAL() for cksum128_tail. - Shave off 4 bytes from text. No regression is observed for sh3 (hpcsh) and sh4 (landisk). To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/sys/arch/sh3/sh3/cpu_in_cksum.S 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/sh3/sh3/cpu_in_cksum.S diff -u src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.5 src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.6 --- src/sys/arch/sh3/sh3/cpu_in_cksum.S:1.5 Tue Jan 6 17:43:16 2015 +++ src/sys/arch/sh3/sh3/cpu_in_cksum.S Sat Sep 18 06:31:46 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: cpu_in_cksum.S,v 1.5 2015/01/06 17:43:16 christos Exp $ */ +/* $NetBSD: cpu_in_cksum.S,v 1.6 2021/09/18 06:31:46 rin Exp $ */ /*- * Copyright (c) 2000 SHIMIZU Ryo @@ -34,7 +34,7 @@ #include #include "assym.h" -__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.5 2015/01/06 17:43:16 christos Exp $") +__KERNEL_RCSID(0, "$NetBSD: cpu_in_cksum.S,v 1.6 2021/09/18 06:31:46 rin Exp $") #define reg_tmp0 r0 @@ -255,18 +255,14 @@ cksum128mod: mov reg_mlen,reg_tmp0 and #124,reg_tmp0 sub reg_tmp0,reg_mlen + mov reg_tmp0,reg_tmp3 - mov.l .L_cksum128_tail_p,reg_tmp3 - sub reg_tmp0,reg_tmp3 - jmp @reg_tmp3 + mova cksum128_tail,reg_tmp0 + sub reg_tmp3,reg_tmp0 + jmp @reg_tmp0 clrt .align 2 -.L_cksum128_tail_p: - .long cksum128_tail - - - .align 2 cksum128: add #-128,reg_mlen clrt
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 15 11:03:25 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0 *before* checking pcb->pbc_onfault != NULL. Should fix part of PR port-sh3/56382 PR port-sh3/56401 i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode address error (and 0xe == EFAULT as r0). Yes, we have another bugs that cause panics described in the two PRs, but now we can examine them more easily :). To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sh3/sh3/exception.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 15 11:03:25 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: exception.c Log Message: For kernel mode address error, do not overwrite tf->tf_spc and tf->tf_r0 *before* checking pcb->pbc_onfault != NULL. Should fix part of PR port-sh3/56382 PR port-sh3/56401 i.e., DDB will no longer wrongly indicate NULL as fault PC for kernel mode address error (and 0xe == EFAULT as r0). Yes, we have another bugs that cause panics described in the two PRs, but now we can examine them more easily :). To generate a diff of this commit: cvs rdiff -u -r1.73 -r1.74 src/sys/arch/sh3/sh3/exception.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/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.73 src/sys/arch/sh3/sh3/exception.c:1.74 --- src/sys/arch/sh3/sh3/exception.c:1.73 Tue Dec 3 12:42:21 2019 +++ src/sys/arch/sh3/sh3/exception.c Wed Sep 15 11:03:24 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.73 2019/12/03 12:42:21 ad Exp $ */ +/* $NetBSD: exception.c,v 1.74 2021/09/15 11:03:24 rin Exp $ */ /*- * Copyright (c) 2002, 2019 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.73 2019/12/03 12:42:21 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.74 2021/09/15 11:03:24 rin Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -196,11 +196,10 @@ general_exception(struct lwp *l, struct case EXPEVT_ADDR_ERR_LD: /* FALLTHROUGH */ case EXPEVT_ADDR_ERR_ST: pcb = lwp_getpcb(l); - KDASSERT(pcb->pcb_onfault != NULL); + if (__predict_false(pcb->pcb_onfault == NULL)) + goto do_panic; tf->tf_spc = (int)pcb->pcb_onfault; tf->tf_r0 = EFAULT; - if (tf->tf_spc == 0) - goto do_panic; break; case EXPEVT_ADDR_ERR_LD | EXP_USER: /* FALLTHROUGH */
Re: CVS commit: src/sys/arch/sh3/sh3
On 2021/09/08 20:47, Izumi Tsutsui wrote: Module Name:src Committed By: rin Date: Wed Sep 8 07:22:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Redo a part of rev 1.89: - Remove redundant parentheses/braces/comments. - Fix indents. No binary changes confirmed this time. --- - if (kva) { + if (kva) entry |= PG_V | PG_SH | ((prot & VM_PROT_WRITE) ? (PG_PR_KRW | PG_D) : PG_PR_KRO); - } else { + else entry |= PG_V | ((prot & VM_PROT_WRITE) ? (PG_PR_URW | PG_D) : PG_PR_URO); - } } --- This part doesn't match KNF: http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style#rev1.58 Update style around single-line braces according to discussion. https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html https://mail-index.netbsd.org/tech-kern/2020/07/12/msg026594.html Retain some examples of technically unnecessary braces that likely aid legibility from the previous commit. So I don't think removing existing ones per "redundant" is a valid reason. Oops, I misread style. These and one more similar braces have been restored. Thanks for pointing it out! rin
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 12:00:50 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Hmm, remove one more parentheses from return. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.93 src/sys/arch/sh3/sh3/pmap.c:1.94 --- src/sys/arch/sh3/sh3/pmap.c:1.93 Wed Sep 8 11:59:43 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 12:00:50 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.93 2021/09/08 11:59:43 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.94 2021/09/08 12:00:50 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2021/09/08 11:59:43 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.94 2021/09/08 12:00:50 rin Exp $"); #include #include @@ -814,7 +814,7 @@ pmap_clear_reference(struct vm_page *pg) int s; if ((pvh->pvh_flags & PVH_REFERENCED) == 0) - return (false); + return false; pvh->pvh_flags &= ~PVH_REFERENCED;
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 12:00:50 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Hmm, remove one more parentheses from return. To generate a diff of this commit: cvs rdiff -u -r1.93 -r1.94 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 11:59:43 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Restore braces for if/else statements which have logically single line, but physically multiple lines. This is recommended by an example in style: http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style#rev1.58 Thanks tsutsui@ for pointing it out. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 11:59:43 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Restore braces for if/else statements which have logically single line, but physically multiple lines. This is recommended by an example in style: http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style#rev1.58 Thanks tsutsui@ for pointing it out. To generate a diff of this commit: cvs rdiff -u -r1.92 -r1.93 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.92 src/sys/arch/sh3/sh3/pmap.c:1.93 --- src/sys/arch/sh3/sh3/pmap.c:1.92 Wed Sep 8 07:25:55 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 11:59:43 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.92 2021/09/08 07:25:55 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.93 2021/09/08 11:59:43 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2021/09/08 07:25:55 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.93 2021/09/08 11:59:43 rin Exp $"); #include #include @@ -371,14 +371,15 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd panic("%s: cannot allocate pv", __func__); } } else { /* bus-space (always uncached map) */ - if (kva) + if (kva) { entry |= PG_V | PG_SH | ((prot & VM_PROT_WRITE) ? (PG_PR_KRW | PG_D) : PG_PR_KRO); - else + } else { entry |= PG_V | ((prot & VM_PROT_WRITE) ? (PG_PR_URW | PG_D) : PG_PR_URO); + } } /* Register to page table */ @@ -788,9 +789,10 @@ pmap_copy_page(paddr_t src, paddr_t dst) sh_dcache_wbinv_all(); memcpy((void *)SH3_PHYS_TO_P2SEG(dst), (void *)SH3_PHYS_TO_P2SEG(src), PAGE_SIZE); - } else + } else { memcpy((void *)SH3_PHYS_TO_P1SEG(dst), (void *)SH3_PHYS_TO_P1SEG(src), PAGE_SIZE); + } } bool
Re: CVS commit: src/sys/arch/sh3/sh3
> Module Name: src > Committed By: rin > Date: Wed Sep 8 07:22:56 UTC 2021 > > Modified Files: > src/sys/arch/sh3/sh3: pmap.c > > Log Message: > Redo a part of rev 1.89: > > - Remove redundant parentheses/braces/comments. > - Fix indents. > > No binary changes confirmed this time. --- - if (kva) { + if (kva) entry |= PG_V | PG_SH | ((prot & VM_PROT_WRITE) ? (PG_PR_KRW | PG_D) : PG_PR_KRO); - } else { + else entry |= PG_V | ((prot & VM_PROT_WRITE) ? (PG_PR_URW | PG_D) : PG_PR_URO); - } } --- This part doesn't match KNF: http://cvsweb.netbsd.org/bsdweb.cgi/src/share/misc/style#rev1.58 > Update style around single-line braces according to discussion. > > https://mail-index.netbsd.org/tech-userlevel/2020/07/12/msg012536.html > https://mail-index.netbsd.org/tech-kern/2020/07/12/msg026594.html > > Retain some examples of technically unnecessary braces that likely > aid legibility from the previous commit. So I don't think removing existing ones per "redundant" is a valid reason. --- Izumi Tsutsui
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 07:25:55 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Redo a part of rev 1.89: - Improve uniformity of panic messages. Also, use __func__ instead of hard-coded function names. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.91 src/sys/arch/sh3/sh3/pmap.c:1.92 --- src/sys/arch/sh3/sh3/pmap.c:1.91 Wed Sep 8 07:22:56 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 07:25:55 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.91 2021/09/08 07:22:56 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.92 2021/09/08 07:25:55 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.91 2021/09/08 07:22:56 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.92 2021/09/08 07:25:55 rin Exp $"); #include #include @@ -192,7 +192,7 @@ pmap_growkernel(vaddr_t maxkvaddr) return __pmap_kve; error: - panic("pmap_growkernel: out of memory."); + panic("%s: out of memory", __func__); /* NOTREACHED */ } @@ -368,7 +368,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd if (__pmap_pv_enter(pmap, pg, va)) { if (flags & PMAP_CANFAIL) return ENOMEM; - panic("%s: __pmap_pv_enter failed", __func__); + panic("%s: cannot allocate pv", __func__); } } else { /* bus-space (always uncached map) */ if (kva) @@ -392,7 +392,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd __pmap_pv_remove(pmap, pg, va); return ENOMEM; } - panic("%s: __pmap_pte_alloc failed", __func__); + panic("%s: cannot allocate pte", __func__); } } @@ -666,7 +666,7 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v switch (prot) { default: - panic("pmap_protect: invalid protection mode %x", prot); + panic("%s: invalid protection mode %x", __func__, prot); /* NOTREACHED */ case VM_PROT_READ: case VM_PROT_READ | VM_PROT_EXECUTE: @@ -1096,7 +1096,7 @@ __pmap_asid_alloc(void) } } - panic("No ASID allocated."); + panic("%s: no ASID allocated", __func__); /* NOTREACHED */ }
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 07:25:55 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Redo a part of rev 1.89: - Improve uniformity of panic messages. Also, use __func__ instead of hard-coded function names. To generate a diff of this commit: cvs rdiff -u -r1.91 -r1.92 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 07:22:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Redo a part of rev 1.89: - Remove redundant parentheses/braces/comments. - Fix indents. No binary changes confirmed this time. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.90 src/sys/arch/sh3/sh3/pmap.c:1.91 --- src/sys/arch/sh3/sh3/pmap.c:1.90 Wed Sep 8 07:13:18 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 07:22:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.90 2021/09/08 07:13:18 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.91 2021/09/08 07:22:56 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.90 2021/09/08 07:13:18 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.91 2021/09/08 07:22:56 rin Exp $"); #include #include @@ -153,7 +153,7 @@ pmap_steal_memory(vsize_t size, vaddr_t va = SH3_PHYS_TO_P1SEG(pa); memset((void *)va, 0, size); - return (va); + return va; } vaddr_t @@ -162,7 +162,7 @@ pmap_growkernel(vaddr_t maxkvaddr) int i, n; if (maxkvaddr <= __pmap_kve) - return (__pmap_kve); + return __pmap_kve; i = __PMAP_PTP_INDEX(__pmap_kve - VM_MIN_KERNEL_ADDRESS); __pmap_kve = __PMAP_PTP_TRUNC(maxkvaddr); @@ -190,7 +190,7 @@ pmap_growkernel(vaddr_t maxkvaddr) } } - return (__pmap_kve); + return __pmap_kve; error: panic("pmap_growkernel: out of memory."); /* NOTREACHED */ @@ -248,7 +248,7 @@ pmap_create(void) uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE | UVM_PGA_ZERO))); - return (pmap); + return pmap; } void @@ -271,7 +271,7 @@ pmap_destroy(pmap_t pmap) for (j = 0; j < __PMAP_PTP_PG_N; j++, pte++) KDASSERT(*pte == 0); } -#endif /* DEBUG */ +#endif /* Purge cache entry for next use of this page. */ if (SH_HAS_VIRTUAL_ALIAS) sh_dcache_inv_range(va, PAGE_SIZE); @@ -323,7 +323,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd struct vm_page *pg; struct vm_page_md *pvh; pt_entry_t entry, *pte; - bool kva = (pmap == pmap_kernel()); + bool kva = pmap == pmap_kernel(); /* "flags" never exceed "prot" */ KDASSERT(prot != 0 && ((flags & VM_PROT_ALL) & ~prot) == 0); @@ -362,7 +362,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd /* Check for existing mapping */ if (__pmap_map_change(pmap, va, pa, prot, entry)) - return (0); + return 0; /* Add to physical-virtual map list of this page */ if (__pmap_pv_enter(pmap, pg, va)) { @@ -371,15 +371,14 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd panic("%s: __pmap_pv_enter failed", __func__); } } else { /* bus-space (always uncached map) */ - if (kva) { + if (kva) entry |= PG_V | PG_SH | ((prot & VM_PROT_WRITE) ? (PG_PR_KRW | PG_D) : PG_PR_KRO); - } else { + else entry |= PG_V | ((prot & VM_PROT_WRITE) ? (PG_PR_URW | PG_D) : PG_PR_URO); - } } /* Register to page table */ @@ -410,7 +409,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd pmap->pm_stats.wired_count++; pmap->pm_stats.resident_count++; - return (0); + return 0; } /* @@ -428,13 +427,13 @@ __pmap_map_change(pmap_t pmap, vaddr_t v vaddr_t eva = va + PAGE_SIZE; if ((pte = __pmap_pte_lookup(pmap, va)) == NULL || - ((oentry = *pte) == 0)) - return (false); /* no mapping exists. */ + (oentry = *pte) == 0) + return false; /* no mapping exists. */ if (pa != (oentry & PG_PPN)) { /* Enter a mapping at a mapping to another physical page. */ pmap_remove(pmap, va, eva); - return (false); + return false; } /* Pre-existing mapping */ @@ -454,10 +453,10 @@ __pmap_map_change(pmap_t pmap, vaddr_t v } else if (entry & _PG_WIRED) { /* unwired -> wired. make sure to reflect "flags" */ pmap_remove(pmap, va, eva); - return (false); + return false; } - return (true); /* mapping was changed. */ + return true; /* mapping was changed. */ } /* @@ -575,7 +574,7 @@ __pmap_pv_remove(pmap_t pmap, struct vm_ #ifdef DEBUG /* Check duplicated map. */ SLIST_FOREACH(pv, >pvh_head, pv_link) - KDASSERT(!(pv->pv_pmap == pmap && pv->pv_va == vaddr)); + KDASSERT(!(pv->pv_pmap == pmap && pv->pv_va == vaddr)); #endif splx(s); } @@ -638,17 +637,17 @@ pmap_extract(pmap_t pmap, vaddr_t va, pa if (pmap == pmap_kernel() && (va >> 30) == 2) { if (pap != NULL) *pap = va & SH3_PHYS_MASK; - return (true); + return true; } pte = __pmap_pte_lookup(pmap, va); if (pte == NULL || *pte == 0) - return (false); + return false; if (pap != NULL) *pap = (*pte & PG_PPN) | (va & PGOFSET); - return (true); + return true; } void @@ -670,20 +669,17 @@ pmap_protect(pmap_t pmap, vaddr_t sva, v panic("pmap_protect:
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 07:22:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Redo a part of rev 1.89: - Remove redundant parentheses/braces/comments. - Fix indents. No binary changes confirmed this time. To generate a diff of this commit: cvs rdiff -u -r1.90 -r1.91 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 07:13:18 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Revert rev 1.89: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/sh3/sh3/pmap.c#rev1.89 I misunderstood evaluation order of ? operator. I should have split the commit into two parts, i.e., with and without binary diffs, in order to avoid such a serious mistake. Thanks rillig@ so much for careful check To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.89 src/sys/arch/sh3/sh3/pmap.c:1.90 --- src/sys/arch/sh3/sh3/pmap.c:1.89 Wed Sep 8 00:35:56 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 07:13:18 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.89 2021/09/08 00:35:56 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.90 2021/09/08 07:13:18 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 2021/09/08 00:35:56 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.90 2021/09/08 07:13:18 rin Exp $"); #include #include @@ -153,7 +153,7 @@ pmap_steal_memory(vsize_t size, vaddr_t va = SH3_PHYS_TO_P1SEG(pa); memset((void *)va, 0, size); - return va; + return (va); } vaddr_t @@ -162,7 +162,7 @@ pmap_growkernel(vaddr_t maxkvaddr) int i, n; if (maxkvaddr <= __pmap_kve) - return __pmap_kve; + return (__pmap_kve); i = __PMAP_PTP_INDEX(__pmap_kve - VM_MIN_KERNEL_ADDRESS); __pmap_kve = __PMAP_PTP_TRUNC(maxkvaddr); @@ -190,9 +190,9 @@ pmap_growkernel(vaddr_t maxkvaddr) } } - return __pmap_kve; + return (__pmap_kve); error: - panic("%s: out of memory", __func__); + panic("pmap_growkernel: out of memory."); /* NOTREACHED */ } @@ -248,7 +248,7 @@ pmap_create(void) uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE | UVM_PGA_ZERO))); - return pmap; + return (pmap); } void @@ -271,7 +271,7 @@ pmap_destroy(pmap_t pmap) for (j = 0; j < __PMAP_PTP_PG_N; j++, pte++) KDASSERT(*pte == 0); } -#endif +#endif /* DEBUG */ /* Purge cache entry for next use of this page. */ if (SH_HAS_VIRTUAL_ALIAS) sh_dcache_inv_range(va, PAGE_SIZE); @@ -323,7 +323,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd struct vm_page *pg; struct vm_page_md *pvh; pt_entry_t entry, *pte; - bool kva = pmap == pmap_kernel(); + bool kva = (pmap == pmap_kernel()); /* "flags" never exceed "prot" */ KDASSERT(prot != 0 && ((flags & VM_PROT_ALL) & ~prot) == 0); @@ -362,23 +362,24 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd /* Check for existing mapping */ if (__pmap_map_change(pmap, va, pa, prot, entry)) - return 0; + return (0); /* Add to physical-virtual map list of this page */ if (__pmap_pv_enter(pmap, pg, va)) { if (flags & PMAP_CANFAIL) return ENOMEM; - panic("%s: cannot allocate pv", __func__); + panic("%s: __pmap_pv_enter failed", __func__); } } else { /* bus-space (always uncached map) */ - if (kva) + if (kva) { entry |= PG_V | PG_SH | - (prot & VM_PROT_WRITE) ? - (PG_PR_KRW | PG_D) : PG_PR_KRO; - else + ((prot & VM_PROT_WRITE) ? + (PG_PR_KRW | PG_D) : PG_PR_KRO); + } else { entry |= PG_V | - (prot & VM_PROT_WRITE) ? - (PG_PR_URW | PG_D) : PG_PR_URO; + ((prot & VM_PROT_WRITE) ? + (PG_PR_URW | PG_D) : PG_PR_URO); + } } /* Register to page table */ @@ -392,7 +393,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd __pmap_pv_remove(pmap, pg, va); return ENOMEM; } - panic("%s: cannot allocate pte", __func__); + panic("%s: __pmap_pte_alloc failed", __func__); } } @@ -409,7 +410,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd pmap->pm_stats.wired_count++; pmap->pm_stats.resident_count++; - return 0; + return (0); } /* @@ -427,13 +428,13 @@ __pmap_map_change(pmap_t pmap, vaddr_t v vaddr_t eva = va + PAGE_SIZE; if ((pte = __pmap_pte_lookup(pmap, va)) == NULL || - (oentry = *pte) == 0) - return false; /* no mapping exists. */ + ((oentry = *pte) == 0)) + return (false); /* no mapping exists. */ if (pa != (oentry & PG_PPN)) { /* Enter a mapping at a mapping to another physical page. */ pmap_remove(pmap, va, eva); - return false; + return (false); } /* Pre-existing mapping */ @@ -453,10 +454,10 @@ __pmap_map_change(pmap_t pmap, vaddr_t v } else if (entry & _PG_WIRED) { /* unwired -> wired. make sure to reflect "flags" */ pmap_remove(pmap, va, eva); - return false; + return (false); } - return true; /* mapping was changed. */ + return (true); /* mapping was changed. */ } /* @@ -574,7 +575,7 @@ __pmap_pv_remove(pmap_t pmap, struct vm_ #ifdef DEBUG /* Check duplicated map. */ SLIST_FOREACH(pv, >pvh_head, pv_link) -
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 07:13:18 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Revert rev 1.89: http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/sh3/sh3/pmap.c#rev1.89 I misunderstood evaluation order of ? operator. I should have split the commit into two parts, i.e., with and without binary diffs, in order to avoid such a serious mistake. Thanks rillig@ so much for careful check To generate a diff of this commit: cvs rdiff -u -r1.89 -r1.90 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 00:35:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Misc cosmetic fixes: - Remove redundant parentheses/braces/comments. - Improve uniformity of panic messages. Also, use __func__ instead of hard-coded function names. - Fix indents. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.88 src/sys/arch/sh3/sh3/pmap.c:1.89 --- src/sys/arch/sh3/sh3/pmap.c:1.88 Wed Sep 8 00:24:29 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 00:35:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.88 2021/09/08 00:24:29 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.89 2021/09/08 00:35:56 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2021/09/08 00:24:29 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.89 2021/09/08 00:35:56 rin Exp $"); #include #include @@ -153,7 +153,7 @@ pmap_steal_memory(vsize_t size, vaddr_t va = SH3_PHYS_TO_P1SEG(pa); memset((void *)va, 0, size); - return (va); + return va; } vaddr_t @@ -162,7 +162,7 @@ pmap_growkernel(vaddr_t maxkvaddr) int i, n; if (maxkvaddr <= __pmap_kve) - return (__pmap_kve); + return __pmap_kve; i = __PMAP_PTP_INDEX(__pmap_kve - VM_MIN_KERNEL_ADDRESS); __pmap_kve = __PMAP_PTP_TRUNC(maxkvaddr); @@ -190,9 +190,9 @@ pmap_growkernel(vaddr_t maxkvaddr) } } - return (__pmap_kve); + return __pmap_kve; error: - panic("pmap_growkernel: out of memory."); + panic("%s: out of memory", __func__); /* NOTREACHED */ } @@ -248,7 +248,7 @@ pmap_create(void) uvm_pagealloc(NULL, 0, NULL, UVM_PGA_USERESERVE | UVM_PGA_ZERO))); - return (pmap); + return pmap; } void @@ -271,7 +271,7 @@ pmap_destroy(pmap_t pmap) for (j = 0; j < __PMAP_PTP_PG_N; j++, pte++) KDASSERT(*pte == 0); } -#endif /* DEBUG */ +#endif /* Purge cache entry for next use of this page. */ if (SH_HAS_VIRTUAL_ALIAS) sh_dcache_inv_range(va, PAGE_SIZE); @@ -323,7 +323,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd struct vm_page *pg; struct vm_page_md *pvh; pt_entry_t entry, *pte; - bool kva = (pmap == pmap_kernel()); + bool kva = pmap == pmap_kernel(); /* "flags" never exceed "prot" */ KDASSERT(prot != 0 && ((flags & VM_PROT_ALL) & ~prot) == 0); @@ -362,24 +362,23 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd /* Check for existing mapping */ if (__pmap_map_change(pmap, va, pa, prot, entry)) - return (0); + return 0; /* Add to physical-virtual map list of this page */ if (__pmap_pv_enter(pmap, pg, va)) { if (flags & PMAP_CANFAIL) return ENOMEM; - panic("%s: __pmap_pv_enter failed", __func__); + panic("%s: cannot allocate pv", __func__); } } else { /* bus-space (always uncached map) */ - if (kva) { + if (kva) entry |= PG_V | PG_SH | - ((prot & VM_PROT_WRITE) ? - (PG_PR_KRW | PG_D) : PG_PR_KRO); - } else { + (prot & VM_PROT_WRITE) ? + (PG_PR_KRW | PG_D) : PG_PR_KRO; + else entry |= PG_V | - ((prot & VM_PROT_WRITE) ? - (PG_PR_URW | PG_D) : PG_PR_URO); - } + (prot & VM_PROT_WRITE) ? + (PG_PR_URW | PG_D) : PG_PR_URO; } /* Register to page table */ @@ -393,7 +392,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd __pmap_pv_remove(pmap, pg, va); return ENOMEM; } - panic("%s: __pmap_pte_alloc failed", __func__); + panic("%s: cannot allocate pte", __func__); } } @@ -410,7 +409,7 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd pmap->pm_stats.wired_count++; pmap->pm_stats.resident_count++; - return (0); + return 0; } /* @@ -428,13 +427,13 @@ __pmap_map_change(pmap_t pmap, vaddr_t v vaddr_t eva = va + PAGE_SIZE; if ((pte = __pmap_pte_lookup(pmap, va)) == NULL || - ((oentry = *pte) == 0)) - return (false); /* no mapping exists. */ + (oentry = *pte) == 0) + return false; /* no mapping exists. */ if (pa != (oentry & PG_PPN)) { /* Enter a mapping at a mapping to another physical page. */ pmap_remove(pmap, va, eva); - return (false); + return false; } /* Pre-existing mapping */ @@ -454,10 +453,10 @@ __pmap_map_change(pmap_t pmap, vaddr_t v } else if (entry & _PG_WIRED) { /* unwired -> wired. make sure to reflect "flags" */ pmap_remove(pmap, va, eva); - return (false); + return false; } - return (true); /* mapping was changed. */ + return true; /* mapping was changed. */ } /* @@ -575,7 +574,7 @@ __pmap_pv_remove(pmap_t pmap, struct vm_ #ifdef DEBUG /* Check duplicated map. */ SLIST_FOREACH(pv, >pvh_head, pv_link) - KDASSERT(!(pv->pv_pmap == pmap && pv->pv_va == vaddr)); + KDASSERT(!(pv->pv_pmap == pmap && pv->pv_va == vaddr)); #endif
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 00:35:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Misc cosmetic fixes: - Remove redundant parentheses/braces/comments. - Improve uniformity of panic messages. Also, use __func__ instead of hard-coded function names. - Fix indents. To generate a diff of this commit: cvs rdiff -u -r1.88 -r1.89 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 00:24:29 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Turn KASSERT's added for PR port-sh3/56381 into KDASSERT's; they are less likely expected to fire again. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.87 src/sys/arch/sh3/sh3/pmap.c:1.88 --- src/sys/arch/sh3/sh3/pmap.c:1.87 Thu Sep 2 08:02:33 2021 +++ src/sys/arch/sh3/sh3/pmap.c Wed Sep 8 00:24:29 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.87 2021/09/02 08:02:33 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.88 2021/09/08 00:24:29 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2021/09/02 08:02:33 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.88 2021/09/08 00:24:29 rin Exp $"); #include #include @@ -737,10 +737,10 @@ pmap_page_protect(struct vm_page *pg, vm while ((pv = SLIST_FIRST(>pvh_head)) != NULL) { pmap = pv->pv_pmap; va = pv->pv_va; -#ifdef DIAGNOSTIC +#ifdef DEBUG pt_entry_t *pte = __pmap_pte_lookup(pmap, va); - KASSERT(pte != NULL); - KASSERT(*pte != 0); + KDASSERT(pte != NULL); + KDASSERT(*pte != 0); #endif pmap_remove(pmap, va, va + PAGE_SIZE); }
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Wed Sep 8 00:24:29 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Turn KASSERT's added for PR port-sh3/56381 into KDASSERT's; they are less likely expected to fire again. To generate a diff of this commit: cvs rdiff -u -r1.87 -r1.88 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Thu Sep 2 08:02:33 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Add missing NULL check for __pmap_pv_alloc() (== pool_get() with PR_NOWAIT) in __pmap_pv_enter(). Then, handle this failure in pmap_enter(); return ENOMEM if PMAP_CANFAIL, and panic otherwise. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Thu Sep 2 08:02:33 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: Add missing NULL check for __pmap_pv_alloc() (== pool_get() with PR_NOWAIT) in __pmap_pv_enter(). Then, handle this failure in pmap_enter(); return ENOMEM if PMAP_CANFAIL, and panic otherwise. To generate a diff of this commit: cvs rdiff -u -r1.86 -r1.87 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.86 src/sys/arch/sh3/sh3/pmap.c:1.87 --- src/sys/arch/sh3/sh3/pmap.c:1.86 Thu Sep 2 07:55:56 2021 +++ src/sys/arch/sh3/sh3/pmap.c Thu Sep 2 08:02:33 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.86 2021/09/02 07:55:56 rin Exp $ */ +/* $NetBSD: pmap.c,v 1.87 2021/09/02 08:02:33 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2021/09/02 07:55:56 rin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.87 2021/09/02 08:02:33 rin Exp $"); #include #include @@ -77,7 +77,7 @@ struct pv_entry { }; #define __pmap_pv_alloc() pool_get(&__pmap_pv_pool, PR_NOWAIT) #define __pmap_pv_free(pv) pool_put(&__pmap_pv_pool, (pv)) -STATIC void __pmap_pv_enter(pmap_t, struct vm_page *, vaddr_t); +STATIC int __pmap_pv_enter(pmap_t, struct vm_page *, vaddr_t); STATIC void __pmap_pv_remove(pmap_t, struct vm_page *, vaddr_t); STATIC void *__pmap_pv_page_alloc(struct pool *, int); STATIC void __pmap_pv_page_free(struct pool *, void *); @@ -365,8 +365,11 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd return (0); /* Add to physical-virtual map list of this page */ - __pmap_pv_enter(pmap, pg, va); - + if (__pmap_pv_enter(pmap, pg, va)) { + if (flags & PMAP_CANFAIL) +return ENOMEM; + panic("%s: __pmap_pv_enter failed", __func__); + } } else { /* bus-space (always uncached map) */ if (kva) { entry |= PG_V | PG_SH | @@ -458,11 +461,11 @@ __pmap_map_change(pmap_t pmap, vaddr_t v } /* - * void __pmap_pv_enter(pmap_t pmap, struct vm_page *pg, vaddr_t vaddr): + * int __pmap_pv_enter(pmap_t pmap, struct vm_page *pg, vaddr_t vaddr): * Insert physical-virtual map to vm_page. * Assume pre-existed mapping is already removed. */ -void +int __pmap_pv_enter(pmap_t pmap, struct vm_page *pg, vaddr_t va) { struct vm_page_md *pvh; @@ -495,11 +498,16 @@ __pmap_pv_enter(pmap_t pmap, struct vm_p /* Register pv map */ pvh = VM_PAGE_TO_MD(pg); pv = __pmap_pv_alloc(); + if (pv == NULL) { + splx(s); + return ENOMEM; + } pv->pv_pmap = pmap; pv->pv_va = va; SLIST_INSERT_HEAD(>pvh_head, pv, pv_link); splx(s); + return 0; } void
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Thu Sep 2 07:55:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: PR port-sh3/56381 pmap_enter() returns ENOMEM if __pmap_pte_alloc() fails and PMAP_CANFAIL flag is specified. In this case, remove pv via __pmap_pv_remove() if it is added to p-v map list via __pmap_pv_enter(). Otherwise, pmap becomes an inconsistent state, which results in an infinite loop in pmap_page_protect(), as reported in the PR. Also, KASSERT's are added for sure, in order to detect the infinite loops. Great thanks to chs@ for finding out this bug!! To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/sh3/sh3/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/sh3
Module Name:src Committed By: rin Date: Thu Sep 2 07:55:56 UTC 2021 Modified Files: src/sys/arch/sh3/sh3: pmap.c Log Message: PR port-sh3/56381 pmap_enter() returns ENOMEM if __pmap_pte_alloc() fails and PMAP_CANFAIL flag is specified. In this case, remove pv via __pmap_pv_remove() if it is added to p-v map list via __pmap_pv_enter(). Otherwise, pmap becomes an inconsistent state, which results in an infinite loop in pmap_page_protect(), as reported in the PR. Also, KASSERT's are added for sure, in order to detect the infinite loops. Great thanks to chs@ for finding out this bug!! To generate a diff of this commit: cvs rdiff -u -r1.85 -r1.86 src/sys/arch/sh3/sh3/pmap.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/sh3/sh3/pmap.c diff -u src/sys/arch/sh3/sh3/pmap.c:1.85 src/sys/arch/sh3/sh3/pmap.c:1.86 --- src/sys/arch/sh3/sh3/pmap.c:1.85 Mon Jul 26 21:43:11 2021 +++ src/sys/arch/sh3/sh3/pmap.c Thu Sep 2 07:55:56 2021 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.85 2021/07/26 21:43:11 andvar Exp $ */ +/* $NetBSD: pmap.c,v 1.86 2021/09/02 07:55:56 rin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.85 2021/07/26 21:43:11 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.86 2021/09/02 07:55:56 rin Exp $"); #include #include @@ -385,9 +385,12 @@ pmap_enter(pmap_t pmap, vaddr_t va, padd else { pte = __pmap_pte_alloc(pmap, va); if (pte == NULL) { - if (flags & PMAP_CANFAIL) + if (flags & PMAP_CANFAIL) { +if (pg != NULL) + __pmap_pv_remove(pmap, pg, va); return ENOMEM; - panic("pmap_enter: cannot allocate pte"); + } + panic("%s: __pmap_pte_alloc failed", __func__); } } @@ -724,8 +727,14 @@ pmap_page_protect(struct vm_page *pg, vm /* Remove all */ s = splvm(); while ((pv = SLIST_FIRST(>pvh_head)) != NULL) { + pmap = pv->pv_pmap; va = pv->pv_va; - pmap_remove(pv->pv_pmap, va, va + PAGE_SIZE); +#ifdef DIAGNOSTIC + pt_entry_t *pte = __pmap_pte_lookup(pmap, va); + KASSERT(pte != NULL); + KASSERT(*pte != 0); +#endif + pmap_remove(pmap, va, va + PAGE_SIZE); } splx(s); }
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: ad Date: Sat Nov 30 15:53:36 UTC 2019 Modified Files: src/sys/arch/sh3/include: userret.h src/sys/arch/sh3/sh3: exception.c Log Message: Revert previous. Looks like it requires a more extensive fix. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/userret.h cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/sh3/exception.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/sh3/include/userret.h diff -u src/sys/arch/sh3/include/userret.h:1.15 src/sys/arch/sh3/include/userret.h:1.16 --- src/sys/arch/sh3/include/userret.h:1.15 Fri Nov 29 18:27:32 2019 +++ src/sys/arch/sh3/include/userret.h Sat Nov 30 15:53:36 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.15 2019/11/29 18:27:32 ad Exp $ */ +/* $NetBSD: userret.h,v 1.16 2019/11/30 15:53:36 ad Exp $ */ /* * Copyright (c) 1988 University of Utah. @@ -52,16 +52,7 @@ userret(struct lwp *l) { /* Invoke MI userret code */ - do { - //curcpu()->ci_data.cpu_nast++; - l->l_md.md_astpending = 0; - mi_userret(l); - } while (l->l_md.md_astpending); - - if (l->l_pflag & LP_OWEUPC) { - l->l_pflag &= ~LP_OWEUPC; - ADDUPROF(l); - } + mi_userret(l); #ifdef PTRACE_HOOKS /* Check if lwp is being PT_STEP'ed */ Index: src/sys/arch/sh3/sh3/exception.c diff -u src/sys/arch/sh3/sh3/exception.c:1.69 src/sys/arch/sh3/sh3/exception.c:1.70 --- src/sys/arch/sh3/sh3/exception.c:1.69 Fri Nov 29 18:27:33 2019 +++ src/sys/arch/sh3/sh3/exception.c Sat Nov 30 15:53:36 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: exception.c,v 1.69 2019/11/29 18:27:33 ad Exp $ */ +/* $NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved. @@ -79,7 +79,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.69 2019/11/29 18:27:33 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: exception.c,v 1.70 2019/11/30 15:53:36 ad Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -471,5 +471,15 @@ ast(struct lwp *l, struct trapframe *tf) KDASSERT(l != NULL); KDASSERT(l->l_md.md_regs == tf); - userret(l); + while (l->l_md.md_astpending) { + //curcpu()->ci_data.cpu_nast++; + l->l_md.md_astpending = 0; + + if (l->l_pflag & LP_OWEUPC) { + l->l_pflag &= ~LP_OWEUPC; + ADDUPROF(l); + } + + userret(l); + } }
CVS commit: src/sys/arch/sh3
Module Name:src Committed By: ad Date: Sat Nov 30 15:53:36 UTC 2019 Modified Files: src/sys/arch/sh3/include: userret.h src/sys/arch/sh3/sh3: exception.c Log Message: Revert previous. Looks like it requires a more extensive fix. To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/userret.h cvs rdiff -u -r1.69 -r1.70 src/sys/arch/sh3/sh3/exception.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: riastradh Date: Fri Nov 29 20:06:08 UTC 2019 Modified Files: src/sys/arch/sh3/include: lock.h Log Message: Nix mb_* on sh3. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/include/lock.h 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/sh3/include/lock.h diff -u src/sys/arch/sh3/include/lock.h:1.17 src/sys/arch/sh3/include/lock.h:1.18 --- src/sys/arch/sh3/include/lock.h:1.17 Sun Sep 17 00:01:08 2017 +++ src/sys/arch/sh3/include/lock.h Fri Nov 29 20:06:08 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: lock.h,v 1.17 2017/09/17 00:01:08 christos Exp $ */ +/* $NetBSD: lock.h,v 1.18 2019/11/29 20:06:08 riastradh Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -110,22 +110,4 @@ __cpu_simple_unlock(__cpu_simple_lock_t *alp = __SIMPLELOCK_UNLOCKED; } -static __inline void -mb_read(void) -{ - __asm volatile("" : : : "memory"); -} - -static __inline void -mb_write(void) -{ - __asm volatile("" : : : "memory"); -} - -static __inline void -mb_memory(void) -{ - __asm volatile("" : : : "memory"); -} - #endif /* !_SH3_LOCK_H_ */
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: riastradh Date: Fri Nov 29 20:06:08 UTC 2019 Modified Files: src/sys/arch/sh3/include: lock.h Log Message: Nix mb_* on sh3. To generate a diff of this commit: cvs rdiff -u -r1.17 -r1.18 src/sys/arch/sh3/include/lock.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: maya Date: Fri Oct 4 15:25:31 UTC 2019 Modified Files: src/sys/arch/sh3/include: ptrace.h Log Message: Provide PTRACE_ILLEGAL_ASM, using an illegal slot instruction To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/ptrace.h 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/sh3/include/ptrace.h diff -u src/sys/arch/sh3/include/ptrace.h:1.15 src/sys/arch/sh3/include/ptrace.h:1.16 --- src/sys/arch/sh3/include/ptrace.h:1.15 Tue Jun 18 21:18:13 2019 +++ src/sys/arch/sh3/include/ptrace.h Fri Oct 4 15:25:30 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: ptrace.h,v 1.15 2019/06/18 21:18:13 kamil Exp $ */ +/* $NetBSD: ptrace.h,v 1.16 2019/10/04 15:25:30 maya Exp $ */ /* * Copyright (c) 1993 Christopher G. Demetriou @@ -72,6 +72,8 @@ #define PTRACE_REG_SP(r) r->r_r15 #define PTRACE_REG_INTV(r) r->r_r0 +#define PTRACE_ILLEGAL_ASM __asm __volatile ("0: bra 0b; bra 0b" : : : "memory") + #define PTRACE_BREAKPOINT_TRAP 0xc3 #define PTRACE_BREAKPOINT ((const uint8_t[]) { 0xc3, 0xc3 }) #define PTRACE_BREAKPOINT_ASM __asm __volatile("trapa %0" :: "i"(PTRACE_BREAKPOINT_TRAP))
CVS commit: src/sys/arch/sh3/include
Module Name:src Committed By: maya Date: Fri Oct 4 15:25:31 UTC 2019 Modified Files: src/sys/arch/sh3/include: ptrace.h Log Message: Provide PTRACE_ILLEGAL_ASM, using an illegal slot instruction To generate a diff of this commit: cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sh3/include/ptrace.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: CVS commit: src/sys/arch/sh3/sh3
On Thu, May 09, 2019 at 16:48:31 +, Ryo Shimizu wrote: > Module Name: src > Committed By: ryo > Date: Thu May 9 16:48:31 UTC 2019 > > Modified Files: > src/sys/arch/sh3/sh3: db_trace.c > > Log Message: > fix backtrace. it was broken. > - use db_read_bytes() to avoid faults. > - quite a few functions do not use frame pointers, > therefore always detect stack depth without a frame pointer. > however, since the framepointer(=r14) is used as a trapframe, > the code to detect the frame pointer is still needed. > - dump the contents of trapframe during backtracing. > - KNF It's a bit unfortunate that this commit lumps together semantic changes and purely cosmetic stuff (like print() instead of (*print)()), which clutters the diff and makes the former less obvious. -uwe
Re: CVS commit: src/sys/arch/sh3/sh3
On Wed, Dec 12, 2012 at 13:34:49 +, Izumi Tsutsui wrote: Module Name: src Committed By: tsutsui Date: Wed Dec 12 13:34:49 UTC 2012 Modified Files: src/sys/arch/sh3/sh3: cache_sh4.c Log Message: Fix fallouts in rev 1.19: http://www.nerv.org/~ryo/netbsd/netbsd/?q=id:20080316T191753Z.1654448ada03ce3c4668f3fe472796d0b771e147 - revert RUN_P1 - PAD_P1_SWITCH changes where RUN_P1 is actually required (all icache CCIA ops still need RUN_P2) Why is it required? The return address is in P1, so the normal ret will jump back to P1. Or is there some inlining I missed? - sh4_dcache_wbinv_all() and sh4_dcache_wbinv_range_index() (which manipulate CCDA arrays) are no longer have RUN_P2 so we can't call them directly from sh4_icache_sync_all() and sh4_icache_sync_range_index() funcitons; use function pointers (which have appropriate addresses) instead for 7750 and 7750S To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/arch/sh3/sh3/cache_sh4.c -uwe
Re: CVS commit: src/sys/arch/sh3/sh3
uwe@ wrote: Log Message: Fix fallouts in rev 1.19: http://www.nerv.org/~ryo/netbsd/netbsd/?q=id:20080316T191753Z.1654448ada03ce3c4668f3fe472796d0b771e147 - revert RUN_P1 - PAD_P1_SWITCH changes where RUN_P1 is actually required (all icache CCIA ops still need RUN_P2) Why is it required? The return address is in P1, so the normal ret will jump back to P1. Or is there some inlining I missed? Ah, I misunderstood it since the log message didn't mention changes in icache functions (assumed returning into P1). I'll revert this first part. - sh4_dcache_wbinv_all() and sh4_dcache_wbinv_range_index() (which manipulate CCDA arrays) are no longer have RUN_P2 so we can't call them directly from sh4_icache_sync_all() and sh4_icache_sync_range_index() funcitons; use function pointers (which have appropriate addresses) instead for 7750 and 7750S --- Izumi Tsutsui
Re: CVS commit: src/sys/arch/sh3/sh3
On Wed, Dec 12, 2012 at 23:55:31 +0900, Izumi Tsutsui wrote: uwe@ wrote: Log Message: Fix fallouts in rev 1.19: http://www.nerv.org/~ryo/netbsd/netbsd/?q=id:20080316T191753Z.1654448ada03ce3c4668f3fe472796d0b771e147 - revert RUN_P1 - PAD_P1_SWITCH changes where RUN_P1 is actually required (all icache CCIA ops still need RUN_P2) Why is it required? The return address is in P1, so the normal ret will jump back to P1. Or is there some inlining I missed? Ah, I misunderstood it since the log message didn't mention changes in icache functions (assumed returning into P1). It's commented in cpu.h that was part of the changeset (which is hard to see with cvs). - sh4_dcache_wbinv_all() and sh4_dcache_wbinv_range_index() (which manipulate CCDA arrays) are no longer have RUN_P2 so we can't call them directly from sh4_icache_sync_all() and sh4_icache_sync_range_index() funcitons; use function pointers (which have appropriate addresses) instead for 7750 and 7750S Hmm looking at /* RUN_P2; */ /* called via P2 address if necessary */ comments there, I guess the above was intended but somehow lost. Thanks for catching it! -uwe
Re: CVS commit: src/sys/arch/sh3/sh3
On Sep 27, 3:34am, u...@stderr.spb.ru (Valeriy E. Ushakov) wrote: -- Subject: Re: CVS commit: src/sys/arch/sh3/sh3 | On Mon, Sep 26, 2011 at 18:43:08 -0400, Christos Zoulas wrote: | | Module Name:src | Committed By: christos | Date: Mon Sep 26 22:43:07 UTC 2011 | | Modified Files: | src/sys/arch/sh3/sh3: cpu_in_cksum.S | | Log Message: | compute the entry size correctly. | | | To generate a diff of this commit: | cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sh3/sh3/cpu_in_cksum.S | | It was correct. cksum128mod is a local subroutine. No, the name was wrong then. I will fix it. christos
Re: CVS commit: src/sys/arch/sh3/sh3
On Mon, Sep 26, 2011 at 20:33:19 -0400, Christos Zoulas wrote: On Sep 27, 3:34am, u...@stderr.spb.ru (Valeriy E. Ushakov) wrote: -- Subject: Re: CVS commit: src/sys/arch/sh3/sh3 | On Mon, Sep 26, 2011 at 18:43:08 -0400, Christos Zoulas wrote: | | Module Name: src | Committed By: christos | Date: Mon Sep 26 22:43:07 UTC 2011 | | Modified Files: |src/sys/arch/sh3/sh3: cpu_in_cksum.S | | Log Message: | compute the entry size correctly. | | | To generate a diff of this commit: | cvs rdiff -u -r1.2 -r1.3 src/sys/arch/sh3/sh3/cpu_in_cksum.S | | It was correct. cksum128mod is a local subroutine. No, the name was wrong then. I will fix it. Ah, I guess it was missed in the in_cksum - cpu_in_cksum rename. Thanks! -uwe
Re: CVS commit: src/sys/arch/sh3
On Wed, Jul 20, 2011 at 21:30:13 +, David Young wrote: Modified Files: src/sys/arch/sh3/include: bus_funcs.h src/sys/arch/sh3/sh3: sh3_machdep.c Log Message: Remove redundant, static inline bus_space(9) declarations from sh3/bus_funcs.h and move the non-inline definitions to sh3/sh3_machdep.c. Did you even test compile it? All sh3 ports fail to compile now; e.g. http://releng.netbsd.org/builds/HEAD/201107211820Z/ -uwe