CVS commit: src/sys/dev/pci

2022-05-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 14 04:04:55 UTC 2022

Modified Files:
src/sys/dev/pci: ahcisata_pci.c

Log Message:
Apply extra-delay quirk to "Intel 9 Series SATA Controller (AHCI)";
without the quirk, the controller fails to probe some HDD models,
at least "Seagate ST2000DM008".

Info and patch provided by Tiago Seco, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/ahcisata_pci.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/dev/pci/ahcisata_pci.c
diff -u src/sys/dev/pci/ahcisata_pci.c:1.61 src/sys/dev/pci/ahcisata_pci.c:1.62
--- src/sys/dev/pci/ahcisata_pci.c:1.61	Fri Nov 19 23:46:55 2021
+++ src/sys/dev/pci/ahcisata_pci.c	Sat May 14 04:04:55 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_pci.c,v 1.61 2021/11/19 23:46:55 rin Exp $	*/
+/*	$NetBSD: ahcisata_pci.c,v 1.62 2022/05/14 04:04:55 rin Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.61 2021/11/19 23:46:55 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ahcisata_pci.c,v 1.62 2022/05/14 04:04:55 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_ahcisata_pci.h"
@@ -206,6 +206,8 @@ static const struct ahci_pci_quirk ahci_
 	AHCI_QUIRK_BADPMP },
 	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_C600_AHCI,
 	AHCI_QUIRK_EXTRA_DELAY },
+	{ PCI_VENDOR_INTEL, PCI_PRODUCT_INTEL_9SERIES_SATA_AHCI,
+	AHCI_QUIRK_EXTRA_DELAY },
 #if 0
 	/*
 	 * XXX Non-reproducible failures reported. May need extra-delay quirk.



CVS commit: src/sys/dev/pci

2022-05-13 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May 14 04:04:55 UTC 2022

Modified Files:
src/sys/dev/pci: ahcisata_pci.c

Log Message:
Apply extra-delay quirk to "Intel 9 Series SATA Controller (AHCI)";
without the quirk, the controller fails to probe some HDD models,
at least "Seagate ST2000DM008".

Info and patch provided by Tiago Seco, thanks!


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/pci/ahcisata_pci.c

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



CVS commit: src/distrib/atari/floppies/install

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:47:10 UTC 2022

Modified Files:
src/distrib/atari/floppies/install: Makefile

Log Message:
Drop IEEE 802.11 support from ifconfig(8).

Reduce ~9KB, and atari builds again for me.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/atari/floppies/install/Makefile

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



CVS commit: src/distrib/atari/floppies/install

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:47:10 UTC 2022

Modified Files:
src/distrib/atari/floppies/install: Makefile

Log Message:
Drop IEEE 802.11 support from ifconfig(8).

Reduce ~9KB, and atari builds again for me.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/distrib/atari/floppies/install/Makefile

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

Modified files:

Index: src/distrib/atari/floppies/install/Makefile
diff -u src/distrib/atari/floppies/install/Makefile:1.7 src/distrib/atari/floppies/install/Makefile:1.8
--- src/distrib/atari/floppies/install/Makefile:1.7	Sun Jul 28 10:28:49 2019
+++ src/distrib/atari/floppies/install/Makefile	Wed May 11 10:47:10 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.7 2019/07/28 10:28:49 martin Exp $
+#	$NetBSD: Makefile,v 1.8 2022/05/11 10:47:10 rin Exp $
 
 IMAGE=		sysinst.fs
 IMAGESIZE?=	1440k
@@ -7,4 +7,5 @@ USE_SYSINST=	yes
 IMGMAKEFSOPTIONS= -o bsize=4096,fsize=512,density=4096
 
 HACK_CURSES=yes
+NOIEEE80211=1
 .include "../common/Makefile.images"



CVS commit: src/distrib

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:45:48 UTC 2022

Modified Files:
src/distrib/common: Makefile.crunch
src/distrib/utils/x_ifconfig: Makefile

Log Message:
Introduce NOIEEE80211 option, by which IEEE 802.11 support is dropped from
ifconfig(8) in crunched binaries. This saves ~9KB for, e.g., m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/distrib/common/Makefile.crunch
cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/x_ifconfig/Makefile

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

Modified files:

Index: src/distrib/common/Makefile.crunch
diff -u src/distrib/common/Makefile.crunch:1.26 src/distrib/common/Makefile.crunch:1.27
--- src/distrib/common/Makefile.crunch:1.26	Sun Dec 29 18:26:16 2019
+++ src/distrib/common/Makefile.crunch	Wed May 11 10:45:48 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.crunch,v 1.26 2019/12/29 18:26:16 christos Exp $
+#	$NetBSD: Makefile.crunch,v 1.27 2022/05/11 10:45:48 rin Exp $
 #
 # Makefile snippet to build a crunchgen(1)ed binary from the provided lists
 #
@@ -41,11 +41,15 @@ CRUNCHENV+=		AWK=${TOOL_AWK:Q}
 
 SMALLPROG?=		1
 SMALLPROG_INET6?=	0
+NOIEEE80211?=		0
 .if ${SMALLPROG}# {
 CRUNCHENV+=		SMALLPROG=1
 .if ${SMALLPROG_INET6} && (${USE_INET6} != "no")
 CRUNCHENV+=		SMALLPROG_INET6=1
 .endif
+.if ${NOIEEE80211}
+CRUNCHENV+=		NOIEEE80211=1
+.endif
 .endif		# }
 
 .include "${DISTRIBDIR}/common/Makefile.parselist"

Index: src/distrib/utils/x_ifconfig/Makefile
diff -u src/distrib/utils/x_ifconfig/Makefile:1.39 src/distrib/utils/x_ifconfig/Makefile:1.40
--- src/distrib/utils/x_ifconfig/Makefile:1.39	Tue May  2 20:12:10 2017
+++ src/distrib/utils/x_ifconfig/Makefile	Wed May 11 10:45:48 2022
@@ -1,6 +1,9 @@
-# $NetBSD: Makefile,v 1.39 2017/05/02 20:12:10 christos Exp $
+# $NetBSD: Makefile,v 1.40 2022/05/11 10:45:48 rin Exp $
 # Build a smaller ifconfig (i.e. for boot media)
 
+# You can drop IEEE 802.11 support by setting NOIEEE80211=1 in
+# parent Makefile's. This saves ~9KB for, e.g., m68k.
+
 NOMAN=		# defined
 SMALLPROG=1
 



CVS commit: src/distrib

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:45:48 UTC 2022

Modified Files:
src/distrib/common: Makefile.crunch
src/distrib/utils/x_ifconfig: Makefile

Log Message:
Introduce NOIEEE80211 option, by which IEEE 802.11 support is dropped from
ifconfig(8) in crunched binaries. This saves ~9KB for, e.g., m68k.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/distrib/common/Makefile.crunch
cvs rdiff -u -r1.39 -r1.40 src/distrib/utils/x_ifconfig/Makefile

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



CVS commit: src

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:36:53 UTC 2022

Modified Files:
src/distrib/atari/floppies/install: list
src/sys/arch/atari/stand/installboot: Makefile

Log Message:
For atari install disk:

- Drop FD support from installboot(8). Reduce ~0.5KB.
- Drop primary boot loaders for FD (2 files, 0.5KB each).

Note that we continue to support these features in base.

OK tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/distrib/atari/floppies/install/list
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/atari/stand/installboot/Makefile

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

Modified files:

Index: src/distrib/atari/floppies/install/list
diff -u src/distrib/atari/floppies/install/list:1.23 src/distrib/atari/floppies/install/list:1.24
--- src/distrib/atari/floppies/install/list:1.23	Thu Jun 18 18:14:06 2020
+++ src/distrib/atari/floppies/install/list	Wed May 11 10:36:52 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: list,v 1.23 2020/06/18 18:14:06 tsutsui Exp $
+#	$NetBSD: list,v 1.24 2022/05/11 10:36:52 rin Exp $
 
 PROG	bin/cat
 PROG	bin/chmod
@@ -67,7 +67,6 @@ MTREE	./usr/mdec/milan	type=dir uname=ro
 
 COPY	${DESTDIR}/usr/mdec/std/bootxx		usr/mdec/std/bootxx
 COPY	${DESTDIR}/usr/mdec/std/boot.atari	usr/mdec/std/boot.atari	
-COPY	${DESTDIR}/usr/mdec/std/fdboot		usr/mdec/std/fdboot		
 COPY	${DESTDIR}/usr/mdec/std/sdboot		usr/mdec/std/sdboot		
 COPY	${DESTDIR}/usr/mdec/std/wdboot		usr/mdec/std/wdboot		
 COPY	${DESTDIR}/usr/mdec/std/sdb00t.ahdi	usr/mdec/std/sdb00t.ahdi	
@@ -75,8 +74,12 @@ COPY	${DESTDIR}/usr/mdec/std/wdb00t.ahdi
 COPY	${DESTDIR}/usr/mdec/std/xxboot.ahdi	usr/mdec/std/xxboot.ahdi	
 COPY	${DESTDIR}/usr/mdec/milan/bootxx	usr/mdec/milan/bootxx		
 COPY	${DESTDIR}/usr/mdec/milan/boot.atari	usr/mdec/milan/boot.atari	
-COPY	${DESTDIR}/usr/mdec/milan/fdboot	usr/mdec/milan/fdboot		
 COPY	${DESTDIR}/usr/mdec/milan/sdboot	usr/mdec/milan/sdboot		
 LINK	usr/mdec/milan/sdboot			usr/mdec/milan/wdboot
 COPY	${DESTDIR}/usr/mdec/milan/sdb00t.ahdi	usr/mdec/milan/sdb00t.ahdi	
 COPY	${DESTDIR}/usr/mdec/milan/xxboot.ahdi	usr/mdec/milan/xxboot.ahdi	
+
+# If you want to revive FD support, enable -DSUPPORT_FD for SMALLPROG in
+# sys/arch/stand/atari/installboot/Makefile.
+#COPY	${DESTDIR}/usr/mdec/std/fdboot		usr/mdec/std/fdboot
+#COPY	${DESTDIR}/usr/mdec/milan/fdboot	usr/mdec/milan/fdboot

Index: src/sys/arch/atari/stand/installboot/Makefile
diff -u src/sys/arch/atari/stand/installboot/Makefile:1.9 src/sys/arch/atari/stand/installboot/Makefile:1.10
--- src/sys/arch/atari/stand/installboot/Makefile:1.9	Wed Aug 12 17:59:51 2015
+++ src/sys/arch/atari/stand/installboot/Makefile	Wed May 11 10:36:52 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2015/08/12 17:59:51 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.10 2022/05/11 10:36:52 rin Exp $
 
 WARNS=	4
 PROG=	installboot
@@ -6,7 +6,7 @@ NOMAN=	# defined
 SRCS=	installboot.c disklabel.c
 BINDIR=	/usr/mdec
 .ifndef SMALLPROG
-CPPFLAGS+=	-DCHECK_OS_BOOTVERSION -DNO_USAGE
+CPPFLAGS+=	-DCHECK_OS_BOOTVERSION -DNO_USAGE -DSUPPORT_FD
 LDADD=	-lkvm
 .endif
 



CVS commit: src

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:36:53 UTC 2022

Modified Files:
src/distrib/atari/floppies/install: list
src/sys/arch/atari/stand/installboot: Makefile

Log Message:
For atari install disk:

- Drop FD support from installboot(8). Reduce ~0.5KB.
- Drop primary boot loaders for FD (2 files, 0.5KB each).

Note that we continue to support these features in base.

OK tsutsui@


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/distrib/atari/floppies/install/list
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/atari/stand/installboot/Makefile

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



CVS commit: src/sys/arch/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:31:12 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Make FD support optional (intended for install media).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/atari/stand/installboot/installboot.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/atari/stand/installboot/installboot.c
diff -u src/sys/arch/atari/stand/installboot/installboot.c:1.37 src/sys/arch/atari/stand/installboot/installboot.c:1.38
--- src/sys/arch/atari/stand/installboot/installboot.c:1.37	Wed May 11 10:27:45 2022
+++ src/sys/arch/atari/stand/installboot/installboot.c	Wed May 11 10:31:12 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.37 2022/05/11 10:27:45 rin Exp $	*/
+/*	$NetBSD: installboot.c,v 1.38 2022/05/11 10:31:12 rin Exp $	*/
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -65,7 +65,9 @@ static void	mkahdiboot(struct ahdi_root 
 		char *, u_int32_t);
 static void	mkbootblock(struct bootblock *, char *,
 char *, struct disklabel *, u_int);
+#ifdef SUPPORT_FD
 static void	install_fd(char *, struct disklabel *);
+#endif
 static void	install_hd(char *, struct disklabel *, bool);
 
 static struct bootblock	bootarea;
@@ -165,9 +167,11 @@ main(int argc, char *argv[])
 		++devchr;
 
 	switch (*devchr) {
+#ifdef SUPPORT_FD
 		case 'f': /* fd */
 			install_fd(dn, );
 			break;
+#endif
 		case 'w': /* wd */
 			use_wd = true;
 			/* FALLTHROUGH */
@@ -218,6 +222,7 @@ oscheck(void)
 }
 #endif
 
+#ifdef SUPPORT_FD
 static void
 install_fd(char *devnm, struct disklabel *label)
 {
@@ -272,6 +277,7 @@ install_fd(char *devnm, struct disklabel
 			printf("Boot block installed on %s\n", devnm);
 	}
 }
+#endif /* SUPPORT_FD */
 
 static void
 install_hd(char *devnm, struct disklabel *label, bool use_wd)



CVS commit: src/sys/arch/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:31:12 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Make FD support optional (intended for install media).


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/atari/stand/installboot/installboot.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/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:27:45 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Refactor install_[sw]d() into install_hd().

Shave off ~0.5KB from install floppy, and dedup codes a lot.

Thanks tsutsui@ for kind review!


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/atari/stand/installboot/installboot.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/atari/stand/installboot/installboot.c
diff -u src/sys/arch/atari/stand/installboot/installboot.c:1.36 src/sys/arch/atari/stand/installboot/installboot.c:1.37
--- src/sys/arch/atari/stand/installboot/installboot.c:1.36	Wed Jan 11 18:32:48 2017
+++ src/sys/arch/atari/stand/installboot/installboot.c	Wed May 11 10:27:45 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: installboot.c,v 1.36 2017/01/11 18:32:48 christos Exp $	*/
+/*	$NetBSD: installboot.c,v 1.37 2022/05/11 10:27:45 rin Exp $	*/
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -66,8 +66,7 @@ static void	mkahdiboot(struct ahdi_root 
 static void	mkbootblock(struct bootblock *, char *,
 char *, struct disklabel *, u_int);
 static void	install_fd(char *, struct disklabel *);
-static void	install_sd(char *, struct disklabel *);
-static void	install_wd(char *, struct disklabel *);
+static void	install_hd(char *, struct disklabel *, bool);
 
 static struct bootblock	bootarea;
 static struct ahdi_root ahdiboot;
@@ -104,6 +103,7 @@ main(int argc, char *argv[])
 	char		 *dn;
 	char		 *devchr;
 	int		 fd, c;
+	bool		 use_wd = false;
 
 #ifdef CHECK_OS_BOOTVERSION
 	/* check OS bootversion */
@@ -169,11 +169,10 @@ main(int argc, char *argv[])
 			install_fd(dn, );
 			break;
 		case 'w': /* wd */
-			install_wd(dn, );
-			setNVpref();
-			break;
+			use_wd = true;
+			/* FALLTHROUGH */
 		case 's': /* sd */
-			install_sd(dn, );
+			install_hd(dn, , use_wd);
 			setNVpref();
 			break;
 		default:
@@ -275,13 +274,19 @@ install_fd(char *devnm, struct disklabel
 }
 
 static void
-install_sd(char *devnm, struct disklabel *label)
+install_hd(char *devnm, struct disklabel *label, bool use_wd)
 {
 	const char	 *machpath;
 	char		 *xxb00t, *xxboot, *bootxx;
 	struct disklabel rawlabel;
 	u_int32_t	 bbsec;
 	u_int		 magic;
+	char		 disktype;
+
+	if (use_wd)
+		disktype = 'w';
+	else
+		disktype = 's';
 
 	if (label->d_partitions[0].p_size == 0)
 		errx(EXIT_FAILURE, "%s: No root-filesystem.", devnm);
@@ -302,7 +307,7 @@ install_sd(char *devnm, struct disklabel
 	if (bbsec) {
 		size_t xxb00tlen = strlen(mdecpath) + strlen(machpath) + 14;
 		xxb00t = alloca(xxb00tlen);
-		snprintf(xxb00t, xxb00tlen, "%s%ssdb00t.ahdi", mdecpath, machpath);
+		snprintf(xxb00t, xxb00tlen, "%s%s%cdb00t.ahdi", mdecpath, machpath, disktype);
 		xxboot = alloca(xxb00tlen);
 		snprintf(xxboot, xxb00tlen, "%s%sxxboot.ahdi", mdecpath, machpath);
 		magic = AHDIMAGIC;
@@ -310,14 +315,15 @@ install_sd(char *devnm, struct disklabel
 		size_t xxbootlen = strlen(mdecpath) + strlen(machpath) + 8;
 		xxb00t = NULL;
 		xxboot = alloca(xxbootlen);
-		snprintf(xxboot, xxbootlen, "%s%ssdboot", mdecpath, machpath);
+		snprintf(xxboot, xxbootlen, "%s%s%cdboot", mdecpath, machpath, disktype);
 		magic = NBDAMAGIC;
 	}
 	size_t bootxxlen = strlen(mdecpath) + strlen(machpath) + 8;
 	bootxx = alloca(bootxxlen);
 	snprintf(bootxx, bootxxlen, "%s%sbootxx", mdecpath, machpath);
 
-	trackpercyl = secpertrack = 0;
+	if (!use_wd)
+		trackpercyl = secpertrack = 0;
 	if (xxb00t)
 		mkahdiboot(, xxb00t, devnm, bbsec);
 	mkbootblock(, xxboot, bootxx, label, magic);
@@ -351,82 +357,6 @@ install_sd(char *devnm, struct disklabel
 }
 
 static void
-install_wd(char *devnm, struct disklabel *label)
-{
-	const char	 *machpath;
-	char		 *xxb00t, *xxboot, *bootxx;
-	struct disklabel rawlabel;
-	u_int32_t	 bbsec;
-	u_int		 magic;
-
-	if (label->d_partitions[0].p_size == 0)
-		errx(EXIT_FAILURE, "%s: No root-filesystem.", devnm);
-	if (label->d_partitions[0].p_fstype != FS_BSDFFS)
-		errx(EXIT_FAILURE, "%s: %s: Illegal root-filesystem type.",
-		 devnm, fstypenames[label->d_partitions[0].p_fstype]);
-
-	bbsec = readdisklabel(devnm, );
-	if (bbsec == NO_BOOT_BLOCK)
-		errx(EXIT_FAILURE, "%s: No NetBSD boot block.", devnm);
-	if (memcmp(label, , sizeof(*label)))
-		errx(EXIT_FAILURE, "%s: Invalid NetBSD boot block.", devnm);
-
-	if (milan)
-		machpath = milanpath;
-	else
-		machpath = stdpath;
-	if (bbsec) {
-		size_t xxb00tlen = strlen(mdecpath) + strlen(machpath) + 14;
-		xxb00t = alloca(xxb00tlen);
-		snprintf(xxb00t, xxb00tlen, "%s%swdb00t.ahdi", mdecpath, machpath);
-		xxboot = alloca(xxb00tlen);
-		snprintf(xxboot, xxb00tlen, "%s%sxxboot.ahdi", mdecpath, machpath);
-		magic = AHDIMAGIC;
-	} else {
-		size_t xxbootlen = strlen(mdecpath) + strlen(machpath) + 8;
-		xxb00t = NULL;
-		xxboot = alloca(xxbootlen);
-		snprintf(xxboot, xxbootlen, "%s%swdboot", mdecpath, 

CVS commit: src/sys/arch/atari/stand/installboot

2022-05-11 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed May 11 10:27:45 UTC 2022

Modified Files:
src/sys/arch/atari/stand/installboot: installboot.c

Log Message:
Refactor install_[sw]d() into install_hd().

Shave off ~0.5KB from install floppy, and dedup codes a lot.

Thanks tsutsui@ for kind review!


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/atari/stand/installboot/installboot.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/powerpc/oea

2022-05-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  9 11:39:44 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/oea/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/powerpc/oea/pmap.c
diff -u src/sys/arch/powerpc/oea/pmap.c:1.113 src/sys/arch/powerpc/oea/pmap.c:1.114
--- src/sys/arch/powerpc/oea/pmap.c:1.113	Sat Apr  9 23:38:32 2022
+++ src/sys/arch/powerpc/oea/pmap.c	Mon May  9 11:39:44 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $	*/
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -63,7 +63,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.113 2022/04/09 23:38:32 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.114 2022/05/09 11:39:44 rin Exp $");
 
 #define	PMAP_NOOPNAMES
 
@@ -674,7 +674,7 @@ static inline void
 pmap_pp_attr_clear(struct pmap_page *pp, int ptebit)
 {
 
-	pp->pp_attrs &= ptebit;
+	pp->pp_attrs &= ~ptebit;
 }
 
 static inline void



CVS commit: src/sys/arch/powerpc/oea

2022-05-09 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon May  9 11:39:44 UTC 2022

Modified Files:
src/sys/arch/powerpc/oea: pmap.c

Log Message:
PR port-powerpc/56818

Fix inverted logic introduced in rev. 1.108, by which modified/referenced
bits of pages were never cleared appropriately.

Now, full ATF runs on macppc and sandpoint, with no regression observed.


To generate a diff of this commit:
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/powerpc/oea/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/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:03:02 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Oops, correct misleading #endif comment.

It seems I need a cup of coffee...


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/pmap_pvt.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/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.14 src/sys/uvm/pmap/pmap_pvt.c:1.15
--- src/sys/uvm/pmap/pmap_pvt.c:1.14	Sun May  8 22:00:06 2022
+++ src/sys/uvm/pmap/pmap_pvt.c	Sun May  8 22:03:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.15 2022/05/08 22:03:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.15 2022/05/08 22:03:02 rin Exp $");
 
 #include 
 #include 
@@ -219,4 +219,4 @@ pmap_pv_untrack(paddr_t start, psize_t s
 }
 #endif /* notdef */
 
-#endif /* !PMAP_PV_TRACK_ONLY_STUBS */
+#endif /* PMAP_PV_TRACK_ONLY_STUBS */



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:03:02 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Oops, correct misleading #endif comment.

It seems I need a cup of coffee...


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/uvm/pmap/pmap_pvt.c

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



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:00:06 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Improve wording a bit in a comment for the previous.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/pmap_pvt.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/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.13 src/sys/uvm/pmap/pmap_pvt.c:1.14
--- src/sys/uvm/pmap/pmap_pvt.c:1.13	Sun May  8 21:55:34 2022
+++ src/sys/uvm/pmap/pmap_pvt.c	Sun May  8 22:00:06 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.14 2022/05/08 22:00:06 rin Exp $");
 
 #include 
 #include 
@@ -201,8 +201,8 @@ pmap_pv_tracked(paddr_t pa)
  * pmap_pv_{,un}track() are intentionally commented out. If modules
  * call these functions, the result should be an inconsistent state.
  *
- * Such modules require real PV-tracking support. Let us make two
- * symbols undefined, and prevent these modules from loaded.
+ * Such modules require real PV-tracking support. Let us make the
+ * two symbols undefined, and prevent these modules from loaded.
  */
 void
 pmap_pv_track(paddr_t start, psize_t size)



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 22:00:06 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
Improve wording a bit in a comment for the previous.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/uvm/pmap/pmap_pvt.c

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



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 21:55:35 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
For PMAP_PV_TRACK_ONLY_STUBS, comment out pmap_pv_{,un}track().

If modules call these functions, the result should be an
inconsistent state.

Such modules require real PV-tracking support, anyway.

The best we can do should be to make two symbols undefined, and
prevent these modules from loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/pmap_pvt.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/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.12 src/sys/uvm/pmap/pmap_pvt.c:1.13
--- src/sys/uvm/pmap/pmap_pvt.c:1.12	Sat May  7 06:53:16 2022
+++ src/sys/uvm/pmap/pmap_pvt.c	Sun May  8 21:55:34 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.13 2022/05/08 21:55:34 rin Exp $");
 
 #include 
 #include 
@@ -189,22 +189,34 @@ pmap_pv_init(void)
 
 }
 
-void
-pmap_pv_track(paddr_t start, psize_t size)
+struct pmap_page *
+pmap_pv_tracked(paddr_t pa)
 {
 
+	return NULL;
 }
 
+#if notdef
+/*
+ * pmap_pv_{,un}track() are intentionally commented out. If modules
+ * call these functions, the result should be an inconsistent state.
+ *
+ * Such modules require real PV-tracking support. Let us make two
+ * symbols undefined, and prevent these modules from loaded.
+ */
 void
-pmap_pv_untrack(paddr_t start, psize_t size)
+pmap_pv_track(paddr_t start, psize_t size)
 {
 
+	panic("PV-tracking not supported");
 }
 
-struct pmap_page *
-pmap_pv_tracked(paddr_t pa)
+void
+pmap_pv_untrack(paddr_t start, psize_t size)
 {
 
-	return NULL;
+	panic("PV-tracking not supported");
 }
-#endif
+#endif /* notdef */
+
+#endif /* !PMAP_PV_TRACK_ONLY_STUBS */



CVS commit: src/sys/uvm/pmap

2022-05-08 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sun May  8 21:55:35 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap_pvt.c

Log Message:
For PMAP_PV_TRACK_ONLY_STUBS, comment out pmap_pv_{,un}track().

If modules call these functions, the result should be an
inconsistent state.

Such modules require real PV-tracking support, anyway.

The best we can do should be to make two symbols undefined, and
prevent these modules from loaded.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/uvm/pmap/pmap_pvt.c

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



CVS commit: src/tests/lib/libc/gen

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 13:14:16 UTC 2022

Modified Files:
src/tests/lib/libc/gen: t_siginfo.c

Log Message:
Skip sigfpe_int also for sh3; integer division by zero is not trapped.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/tests/lib/libc/gen/t_siginfo.c

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

Modified files:

Index: src/tests/lib/libc/gen/t_siginfo.c
diff -u src/tests/lib/libc/gen/t_siginfo.c:1.46 src/tests/lib/libc/gen/t_siginfo.c:1.47
--- src/tests/lib/libc/gen/t_siginfo.c:1.46	Fri Dec 10 20:36:05 2021
+++ src/tests/lib/libc/gen/t_siginfo.c	Sat May  7 13:14:16 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: t_siginfo.c,v 1.46 2021/12/10 20:36:05 andvar Exp $ */
+/* $NetBSD: t_siginfo.c,v 1.47 2022/05/07 13:14:16 rin Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -367,7 +367,7 @@ ATF_TC_BODY(sigfpe_int, tc)
 	struct sigaction sa;
 	long l = strtol("0", NULL, 10);
 
-#if defined(__powerpc__) || defined(__aarch64__)
+#if defined(__aarch64__) || defined(__powerpc__) || defined(__sh3__)
 	atf_tc_skip("Integer division by zero doesn't trap");
 #endif
 	if (sigsetjmp(sigfpe_int_env, 0) == 0) {



CVS commit: src/tests/lib/libc/gen

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 13:14:16 UTC 2022

Modified Files:
src/tests/lib/libc/gen: t_siginfo.c

Log Message:
Skip sigfpe_int also for sh3; integer division by zero is not trapped.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/tests/lib/libc/gen/t_siginfo.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/powerpc/include

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 09:02:19 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
Remove SPR_CCR0 from ; we already have it in
, together with other 4xx-specific SPRs.

Thanks uwe@ for pointing out.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/include/spr.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/powerpc/include

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 09:02:19 UTC 2022

Modified Files:
src/sys/arch/powerpc/include: spr.h

Log Message:
Remove SPR_CCR0 from ; we already have it in
, together with other 4xx-specific SPRs.

Thanks uwe@ for pointing out.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/powerpc/include/spr.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/powerpc/include/spr.h
diff -u src/sys/arch/powerpc/include/spr.h:1.55 src/sys/arch/powerpc/include/spr.h:1.56
--- src/sys/arch/powerpc/include/spr.h:1.55	Sat May  7 04:12:54 2022
+++ src/sys/arch/powerpc/include/spr.h	Sat May  7 09:02:19 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.55 2022/05/07 04:12:54 rin Exp $	*/
+/*	$NetBSD: spr.h,v 1.56 2022/05/07 09:02:19 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, The NetBSD Foundation, Inc.
@@ -144,7 +144,6 @@ mfspr(int reg)
 #define	SPR_TBL			0x11c	/* E468 Time Base Lower */
 #define	SPR_TBU			0x11d	/* E468 Time Base Upper */
 #define	SPR_PVR			0x11f	/* E468 Processor Version Register */
-#define	SPR_CCR0		0x3b3	/* .4.. Core Configuration Register */
 
 /* Time Base Register declarations */
 #define	TBR_TBL			0x10c	/* E468 Time Base Lower */



Re: CVS commit: src/sys/arch

2022-05-07 Thread Rin Okuyama

Oops, I missed it. I will fix soon.

Thanks again,
rin

On 2022/05/07 17:24, Valery Ushakov wrote:

On Sat, May 07, 2022 at 04:12:55 +, Rin Okuyama wrote:


Module Name:src
Committed By:   rin
Date:   Sat May  7 04:12:55 UTC 2022

Modified Files:
src/sys/arch/evbppc/dht: locore.S
src/sys/arch/powerpc/include: spr.h

Log Message:
Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
 and use it.

Idea from uwe@, thanks!
(and sorry for delayed response!)


Note that we already have it defined (along with bunch of others) in
sys/arch/powerpc/include/ibm4xx/spr.h:74


-uwe



CVS commit: src/sys/arch/powerpc

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 07:10:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/conf: files.powerpc
src/sys/arch/powerpc/include: pmap.h
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Try to fix PV tracking support.

* For oea (with real PV tracking support):

  Define __HAVE_PMAP_PV_TRACK. Otherwise, pmap_pv_init() is not called by
  uvm_init().

* For booke and ibm4xx (without PV tracking support):

  For MODULAR kernel and modules, define __HAVE_PMAP_PV_TRACK together with
  PMAP_PV_TRACK_ONLY_STUBS, so that modules can be shared with oea.

Note that PMAP_PV_TRACK_ONLY_STUBS can be used even for oea,
as a compile-time option to strip real PV tracking support.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/include/pmap.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/include/oea/pmap.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/powerpc/conf/files.powerpc
diff -u src/sys/arch/powerpc/conf/files.powerpc:1.100 src/sys/arch/powerpc/conf/files.powerpc:1.101
--- src/sys/arch/powerpc/conf/files.powerpc:1.100	Thu Feb 17 16:09:00 2022
+++ src/sys/arch/powerpc/conf/files.powerpc	Sat May  7 07:10:46 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files.powerpc,v 1.100 2022/02/17 16:09:00 macallan Exp $
+#	$NetBSD: files.powerpc,v 1.101 2022/05/07 07:10:46 rin Exp $
 
 defflag	opt_altivec.h	ALTIVEC K_ALTIVEC PPC_HAVE_SPE
 defflag	opt_openpic.h	OPENPIC_DISTRIBUTE
@@ -32,6 +32,8 @@ file	arch/powerpc/powerpc/db_trace.c			d
 file	arch/powerpc/powerpc/fpu.c
 file	arch/powerpc/powerpc/intr_stubs.c		ppc_booke
 
+file	uvm/pmap/pmap_pvt.cmodular | (ppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601)
+
 # IBM 4xx Family files (40x)
 file	arch/powerpc/ibm4xx/pmap.c			ppc_ibm4xx
 file	arch/powerpc/ibm4xx/trap.c			ppc_ibm4xx
@@ -51,7 +53,6 @@ file	arch/powerpc/oea/pmap64.c			ppc_oea
 file	arch/powerpc/oea/pmap64_bridge.c		ppc_oea64_bridge
 file	arch/powerpc/oea/pmap_kernel.c			ppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601
 file	arch/powerpc/powerpc/trap.c			ppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601
-file	uvm/pmap/pmap_pvt.cppc_oea | ppc_oea64 | ppc_oea64_bridge | ppc_oea601
 
 # PPC BookE (MPC85xx) Family files
 file	arch/powerpc/booke/booke_machdep.c		ppc_booke

Index: src/sys/arch/powerpc/include/pmap.h
diff -u src/sys/arch/powerpc/include/pmap.h:1.41 src/sys/arch/powerpc/include/pmap.h:1.42
--- src/sys/arch/powerpc/include/pmap.h:1.41	Wed Feb 16 23:31:13 2022
+++ src/sys/arch/powerpc/include/pmap.h	Sat May  7 07:10:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.41 2022/02/16 23:31:13 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.42 2022/05/07 07:10:46 rin Exp $	*/
 
 #ifndef _POWERPC_PMAP_H_
 #define _POWERPC_PMAP_H_
@@ -22,8 +22,6 @@
 
 #endif /* !_MODULE */
 
-#include 
-
 #if !defined(_LOCORE) && (defined(MODULAR) || defined(_MODULE))
 /*
  * Both BOOKE and OEA use __HAVE_VM_PAGE_MD but IBM4XX doesn't so define
@@ -41,6 +39,15 @@ struct vm_page_md {
 
 __CTASSERT(sizeof(struct vm_page_md) == sizeof(uintptr_t)*5);
 
+#ifndef __HAVE_PMAP_PV_TRACK
+/*
+ * We need empty stubs for modules shared with all sub-archs.
+ */
+#define	__HAVE_PMAP_PV_TRACK
+#define	PMAP_PV_TRACK_ONLY_STUBS
+#include 
+#endif /* !__HAVE_PMAP_PV_TRACK */
+
 #endif /* !LOCORE && (MODULAR || _MODULE) */
 
 #endif /* !_POWERPC_PMAP_H_ */

Index: src/sys/arch/powerpc/include/oea/pmap.h
diff -u src/sys/arch/powerpc/include/oea/pmap.h:1.36 src/sys/arch/powerpc/include/oea/pmap.h:1.37
--- src/sys/arch/powerpc/include/oea/pmap.h:1.36	Wed Feb 16 23:31:13 2022
+++ src/sys/arch/powerpc/include/oea/pmap.h	Sat May  7 07:10:46 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.36 2022/02/16 23:31:13 riastradh Exp $	*/
+/*	$NetBSD: pmap.h,v 1.37 2022/05/07 07:10:46 rin Exp $	*/
 
 /*-
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -48,6 +48,9 @@
 #endif
 #include 
 
+#define	__HAVE_PMAP_PV_TRACK
+#include 
+
 /*
  * Pmap stuff
  */



CVS commit: src/sys/arch/powerpc

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 07:10:47 UTC 2022

Modified Files:
src/sys/arch/powerpc/conf: files.powerpc
src/sys/arch/powerpc/include: pmap.h
src/sys/arch/powerpc/include/oea: pmap.h

Log Message:
Try to fix PV tracking support.

* For oea (with real PV tracking support):

  Define __HAVE_PMAP_PV_TRACK. Otherwise, pmap_pv_init() is not called by
  uvm_init().

* For booke and ibm4xx (without PV tracking support):

  For MODULAR kernel and modules, define __HAVE_PMAP_PV_TRACK together with
  PMAP_PV_TRACK_ONLY_STUBS, so that modules can be shared with oea.

Note that PMAP_PV_TRACK_ONLY_STUBS can be used even for oea,
as a compile-time option to strip real PV tracking support.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/conf/files.powerpc
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/powerpc/include/pmap.h
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/powerpc/include/oea/pmap.h

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



CVS commit: src/sys/uvm/pmap

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 06:53:16 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h pmap_pvt.c

Log Message:
Introduce PMAP_PV_TRACK_ONLY_STUBS option, by which only empty stubs for
global functions in pmap_pvt.h are provided, instead of real support for
PV tracking.

Necessary for powerpc: Only one sub-arch (oea) has PV tracking support.
Others (booke/ibm4xx) do not at the moment (probably never for ibm4xx),
but __HAVE_PMAP_PV_TRACK is necessary, so that modules can be shared by
all of sub-archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.20 -r1.21 src/sys/uvm/pmap/pmap.h
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/pmap_pvt.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/uvm/pmap/pmap.c
diff -u src/sys/uvm/pmap/pmap.c:1.64 src/sys/uvm/pmap/pmap.c:1.65
--- src/sys/uvm/pmap/pmap.c:1.64	Sat Apr  9 23:38:33 2022
+++ src/sys/uvm/pmap/pmap.c	Sat May  7 06:53:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.64 2022/04/09 23:38:33 riastradh Exp $	*/
+/*	$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc.
@@ -67,7 +67,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.64 2022/04/09 23:38:33 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.65 2022/05/07 06:53:16 rin Exp $");
 
 /*
  *	Manages physical address maps.
@@ -120,6 +120,10 @@ __KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.6
  PMAP_NO_PV_UNCACHED to be defined
 #endif
 
+#if defined(PMAP_PV_TRACK_ONLY_STUBS)
+#undef	__HAVE_PMAP_PV_TRACK
+#endif
+
 PMAP_COUNTER(remove_kernel_calls, "remove kernel calls");
 PMAP_COUNTER(remove_kernel_pages, "kernel pages unmapped");
 PMAP_COUNTER(remove_user_calls, "remove user calls");

Index: src/sys/uvm/pmap/pmap.h
diff -u src/sys/uvm/pmap/pmap.h:1.20 src/sys/uvm/pmap/pmap.h:1.21
--- src/sys/uvm/pmap/pmap.h:1.20	Fri Mar 19 07:51:33 2021
+++ src/sys/uvm/pmap/pmap.h	Sat May  7 06:53:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.h,v 1.20 2021/03/19 07:51:33 skrll Exp $	*/
+/*	$NetBSD: pmap.h,v 1.21 2022/05/07 06:53:16 rin Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -203,7 +203,7 @@ void	pmap_pvlist_lock_init(size_t);
 void	pmap_page_cache(struct vm_page_md *, bool);
 #endif
 
-#ifdef __HAVE_PMAP_PV_TRACK
+#if defined(__HAVE_PMAP_PV_TRACK) && !defined(PMAP_PV_TRACK_ONLY_STUBS)
 void	pmap_pv_protect(paddr_t, vm_prot_t);
 #endif
 

Index: src/sys/uvm/pmap/pmap_pvt.c
diff -u src/sys/uvm/pmap/pmap_pvt.c:1.11 src/sys/uvm/pmap/pmap_pvt.c:1.12
--- src/sys/uvm/pmap/pmap_pvt.c:1.11	Wed Jul 21 06:35:45 2021
+++ src/sys/uvm/pmap/pmap_pvt.c	Sat May  7 06:53:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_pvt.c,v 1.11 2021/07/21 06:35:45 skrll Exp $	*/
+/*	$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $	*/
 
 /*-
  * Copyright (c) 2014, 2020 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: pmap_pvt.c,v 1.11 2021/07/21 06:35:45 skrll Exp $");
+__RCSID("$NetBSD: pmap_pvt.c,v 1.12 2022/05/07 06:53:16 rin Exp $");
 
 #include 
 #include 
@@ -40,6 +40,7 @@ __RCSID("$NetBSD: pmap_pvt.c,v 1.11 2021
 #include 
 #include 
 
+#if !defined(PMAP_PV_TRACK_ONLY_STUBS)
 /*
  * unmanaged pv-tracked ranges
  *
@@ -177,3 +178,33 @@ pmap_pv_tracked(paddr_t pa)
 	return >pvt_pages[pgno];
 }
 
+#else /* PMAP_PV_TRACK_ONLY_STUBS */
+/*
+ * Provide empty stubs just for MODULAR kernels.
+ */
+
+void
+pmap_pv_init(void)
+{
+
+}
+
+void
+pmap_pv_track(paddr_t start, psize_t size)
+{
+
+}
+
+void
+pmap_pv_untrack(paddr_t start, psize_t size)
+{
+
+}
+
+struct pmap_page *
+pmap_pv_tracked(paddr_t pa)
+{
+
+	return NULL;
+}
+#endif



CVS commit: src/sys/uvm/pmap

2022-05-07 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 06:53:16 UTC 2022

Modified Files:
src/sys/uvm/pmap: pmap.c pmap.h pmap_pvt.c

Log Message:
Introduce PMAP_PV_TRACK_ONLY_STUBS option, by which only empty stubs for
global functions in pmap_pvt.h are provided, instead of real support for
PV tracking.

Necessary for powerpc: Only one sub-arch (oea) has PV tracking support.
Others (booke/ibm4xx) do not at the moment (probably never for ibm4xx),
but __HAVE_PMAP_PV_TRACK is necessary, so that modules can be shared by
all of sub-archs.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/uvm/pmap/pmap.c
cvs rdiff -u -r1.20 -r1.21 src/sys/uvm/pmap/pmap.h
cvs rdiff -u -r1.11 -r1.12 src/sys/uvm/pmap/pmap_pvt.c

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



CVS commit: src/tests/usr.bin/c++

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:14:10 UTC 2022

Modified Files:
src/tests/usr.bin/c++: t_call_once2.sh

Log Message:
Bump timeout.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/c++/t_call_once2.sh

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

Modified files:

Index: src/tests/usr.bin/c++/t_call_once2.sh
diff -u src/tests/usr.bin/c++/t_call_once2.sh:1.3 src/tests/usr.bin/c++/t_call_once2.sh:1.4
--- src/tests/usr.bin/c++/t_call_once2.sh:1.3	Sat Sep  4 05:47:31 2021
+++ src/tests/usr.bin/c++/t_call_once2.sh	Sat May  7 05:14:09 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: t_call_once2.sh,v 1.3 2021/09/04 05:47:31 rin Exp $
+#	$NetBSD: t_call_once2.sh,v 1.4 2022/05/07 05:14:09 rin Exp $
 #
 # Copyright (c) 2018 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -29,60 +29,70 @@ atf_test_case call_once2
 call_once2_head() {
 	atf_set "descr" "compile and run std::call_once"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_profile
 call_once2_profile_head() {
 	atf_set "descr" "compile and run std::call_once with profiling option"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_pic
 call_once2_pic_head() {
 	atf_set "descr" "compile and run PIC std::call_once"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_pic_32
 call_once2_pic_32_head() {
 	atf_set "descr" "compile and run 32-bit PIC std::call_once"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_pic_profile
 call_once2_pic_profile_head() {
 	atf_set "descr" "compile and run PIC std::call_once with profiling flag"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_pic_profile_32
 call_once2_pic_profile_32_head() {
 	atf_set "descr" "compile and run 32-bit PIC std::call_once with profiling flag"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_profile_32
 call_once2_profile_32_head() {
 	atf_set "descr" "compile and run 32-bit std::call_once with profiling flag"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_pie
 call_once2_pie_head() {
 	atf_set "descr" "compile and run position independent (PIE) std::call_once"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_32
 call_once2_32_head() {
 	atf_set "descr" "compile and run std::call_once for/in netbsd32 emulation"
 	atf_set "require.progs" "c++ file diff cat"
+	atf_set "timeout" "600"
 }
 
 atf_test_case call_once2_static
 call_once2_static_head() {
 	atf_set "descr" "compile and run std::call_once with static flag"
 	atf_set "require.progs" "c++"
+	atf_set "timeout" "600"
 }
 
 call_once2_body() {



CVS commit: src/tests/usr.bin/c++

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:14:10 UTC 2022

Modified Files:
src/tests/usr.bin/c++: t_call_once2.sh

Log Message:
Bump timeout.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/tests/usr.bin/c++/t_call_once2.sh

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



CVS commit: src/tests/lib/libpthread

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:13:17 UTC 2022

Modified Files:
src/tests/lib/libpthread: t_mutex.c

Log Message:
Bump timeout for slow machines.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/lib/libpthread/t_mutex.c

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

Modified files:

Index: src/tests/lib/libpthread/t_mutex.c
diff -u src/tests/lib/libpthread/t_mutex.c:1.19 src/tests/lib/libpthread/t_mutex.c:1.20
--- src/tests/lib/libpthread/t_mutex.c:1.19	Fri Dec  1 13:25:29 2017
+++ src/tests/lib/libpthread/t_mutex.c	Sat May  7 05:13:17 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mutex.c,v 1.19 2017/12/01 13:25:29 kre Exp $ */
+/* $NetBSD: t_mutex.c,v 1.20 2022/05/07 05:13:17 rin Exp $ */
 
 /*
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
 #include 
 __COPYRIGHT("@(#) Copyright (c) 2008\
  The NetBSD Foundation, inc. All rights reserved.");
-__RCSID("$NetBSD: t_mutex.c,v 1.19 2017/12/01 13:25:29 kre Exp $");
+__RCSID("$NetBSD: t_mutex.c,v 1.20 2022/05/07 05:13:17 rin Exp $");
 
 #include  /* For timespecadd */
 #include  /* For UINT16_MAX */
@@ -148,6 +148,7 @@ ATF_TC(mutex2);
 ATF_TC_HEAD(mutex2, tc)
 {
 	atf_tc_set_md_var(tc, "descr", "Checks mutexes");
+	atf_tc_set_md_var(tc, "timeout", "600");
 }
 ATF_TC_BODY(mutex2, tc)
 {
@@ -204,6 +205,7 @@ ATF_TC_HEAD(mutex3, tc)
 {
 	atf_tc_set_md_var(tc, "descr", "Checks mutexes using a static "
 	"initializer");
+	atf_tc_set_md_var(tc, "timeout", "600");
 }
 ATF_TC_BODY(mutex3, tc)
 {



CVS commit: src/tests/lib/libpthread

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:13:17 UTC 2022

Modified Files:
src/tests/lib/libpthread: t_mutex.c

Log Message:
Bump timeout for slow machines.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/tests/lib/libpthread/t_mutex.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/powerpc/booke/pci

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:08:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.

These locks are typically used during autoconf(9), not from
interrupt context.

Found by LOCKDEBUG.

XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/pci/pq3pci.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/powerpc/booke/pci

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:08:16 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/pci: pq3pci.c

Log Message:
Downgrade pq3pci_intrsources_lock and pq3pci_msigroups_lock from
spin to adaptive mutexes.

These locks are typically used during autoconf(9), not from
interrupt context.

Found by LOCKDEBUG.

XXX
I'm not sure whether these locks are really necessary...
Similar codes, e.g. in powerpc/pic/intr.c, do not use any locks.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/powerpc/booke/pci/pq3pci.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/powerpc/booke/pci/pq3pci.c
diff -u src/sys/arch/powerpc/booke/pci/pq3pci.c:1.30 src/sys/arch/powerpc/booke/pci/pq3pci.c:1.31
--- src/sys/arch/powerpc/booke/pci/pq3pci.c:1.30	Tue Jan 11 22:45:56 2022
+++ src/sys/arch/powerpc/booke/pci/pq3pci.c	Sat May  7 05:08:16 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $	*/
+/*	$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -39,7 +39,7 @@
 #define	__INTR_PRIVATE
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.30 2022/01/11 22:45:56 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3pci.c,v 1.31 2022/05/07 05:08:16 rin Exp $");
 
 #include "locators.h"
 
@@ -727,8 +727,11 @@ static int
 pq3pci_once_init(void)
 {
 
-	mutex_init(_intrsources_lock, MUTEX_DEFAULT, IPL_VM);
-	mutex_init(_msigroups_lock, MUTEX_DEFAULT, IPL_VM);
+	/*
+	 * XXX necessary??
+	 */
+	mutex_init(_intrsources_lock, MUTEX_DEFAULT, IPL_NONE);
+	mutex_init(_msigroups_lock, MUTEX_DEFAULT, IPL_NONE);
 
 	return 0;
 }
@@ -1209,7 +1212,7 @@ pq3pci_msi_alloc_one(int ipl)
 	uint32_t bitmap[maplen];
 	pci_intr_handle_t handle;
 
-	mutex_spin_enter(_msigroups_lock);
+	mutex_enter(_msigroups_lock);
 	for (u_int i = 0; i < maplen; i++) {
 		struct pq3pci_msigroup * const msig = pq3pci_msigroups[i];
 		if (msig == NULL) {
@@ -1237,20 +1240,20 @@ pq3pci_msi_alloc_one(int ipl)
 			struct pq3pci_msihand * const msih __diagused =
 			pq3pci_msi_claim(handle);
 			KASSERT(msih != NULL);
-			mutex_spin_exit(_msigroups_lock);
+			mutex_exit(_msigroups_lock);
 			return handle;
 		}
 	}
 
 	if (freegroup-- == 0) {
-		mutex_spin_exit(_msigroups_lock);
+		mutex_exit(_msigroups_lock);
 		return 0;
 	}
 
 	struct pq3pci_msigroup * const msig =
 	kmem_zalloc(sizeof(*msig), KM_NOSLEEP);
 	if (msig == NULL) {
-		mutex_spin_exit(_msigroups_lock);
+		mutex_exit(_msigroups_lock);
 		return 0;
 	}
 	pq3pci_msi_group_setup(msig, freegroup, ipl);
@@ -1259,7 +1262,7 @@ pq3pci_msi_alloc_one(int ipl)
 	struct pq3pci_msihand * const msih __diagused =
 	pq3pci_msi_claim(handle);
 	KASSERT(msih != NULL);
-	mutex_spin_exit(_msigroups_lock);
+	mutex_exit(_msigroups_lock);
 	return handle;
 }
 
@@ -1327,17 +1330,17 @@ static struct pq3pci_intrsource *
 pq3pci_intr_source_lookup(struct pq3pci_softc *sc, pci_intr_handle_t handle)
 {
 	struct pq3pci_intrsource *pis;
-	mutex_spin_enter(_intrsources_lock);
+	mutex_enter(_intrsources_lock);
 	SIMPLEQ_FOREACH(pis, _intrsources, pis_link) {
 		if (pis->pis_handle == handle) {
-			mutex_spin_exit(_intrsources_lock);
+			mutex_exit(_intrsources_lock);
 			return pis;
 		}
 	}
 	pis = kmem_zalloc(sizeof(*pis), KM_NOSLEEP);
 	if (pis != NULL)
 		pq3pci_intr_source_setup(sc, pis, handle);
-	mutex_spin_exit(_intrsources_lock);
+	mutex_exit(_intrsources_lock);
 	return pis;
 }
 



CVS commit: src/sys/arch/powerpc/booke/dev

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:01:29 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
Obsolete mdio_lock for pq3mdio_mii_{read,write}reg().

Callers (mii(4) layer and atphy(4) driver) acquire mii_lock() for
this purpose.

Found by LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/booke/dev/pq3etsec.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/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.56 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.57
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.56	Sat Aug  7 16:19:02 2021
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Sat May  7 05:01:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.56 2021/08/07 16:19:02 thorpej Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.57 2022/05/07 05:01:29 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.56 2021/08/07 16:19:02 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.57 2022/05/07 05:01:29 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -251,8 +251,6 @@ struct pq3etsec_softc {
 struct pq3mdio_softc {
 	device_t mdio_dev;
 
-	kmutex_t *mdio_lock;
-
 	bus_space_tag_t mdio_bst;
 	bus_space_handle_t mdio_bsh;
 };
@@ -380,7 +378,6 @@ pq3mdio_attach(device_t parent, device_t
 	struct cpunode_locators * const cnl = >cna_locs;
 
 	mdio->mdio_dev = self;
-	mdio->mdio_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_SOFTNET);
 
 	if (device_is_a(parent, "cpunode")) {
 		struct cpunode_softc * const psc = device_private(parent);
@@ -416,8 +413,6 @@ pq3mdio_mii_readreg(device_t self, int p
 	struct pq3mdio_softc * const mdio = device_private(self);
 	uint32_t miimcom = etsec_mdio_read(mdio, MIIMCOM);
 
-	mutex_enter(mdio->mdio_lock);
-
 	etsec_mdio_write(mdio, MIIMADD,
 	__SHIFTIN(phy, MIIMADD_PHY) | __SHIFTIN(reg, MIIMADD_REG));
 
@@ -436,7 +431,6 @@ pq3mdio_mii_readreg(device_t self, int p
 	aprint_normal_dev(mdio->mdio_dev, "%s: phy %d reg %d: %#x\n",
 	__func__, phy, reg, data);
 #endif
-	mutex_exit(mdio->mdio_lock);
 	return 0;
 }
 
@@ -451,8 +445,6 @@ pq3mdio_mii_writereg(device_t self, int 
 	__func__, phy, reg, data);
 #endif
 
-	mutex_enter(mdio->mdio_lock);
-
 	etsec_mdio_write(mdio, MIIMADD,
 	__SHIFTIN(phy, MIIMADD_PHY) | __SHIFTIN(reg, MIIMADD_REG));
 	etsec_mdio_write(mdio, MIIMCOM, 0);	/* clear any past bits */
@@ -466,8 +458,6 @@ pq3mdio_mii_writereg(device_t self, int 
 	if (miimcom == MIIMCOM_SCAN)
 		etsec_mdio_write(mdio, MIIMCOM, miimcom);
 
-	mutex_exit(mdio->mdio_lock);
-
 	return 0;
 }
 



CVS commit: src/sys/arch/powerpc/booke/dev

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 05:01:29 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
Obsolete mdio_lock for pq3mdio_mii_{read,write}reg().

Callers (mii(4) layer and atphy(4) driver) acquire mii_lock() for
this purpose.

Found by LOCKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/powerpc/booke/dev/pq3etsec.c

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



CVS commit: src/share/man/man4

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:35:20 UTC 2022

Modified Files:
src/share/man/man4: options.4

Log Message:
Document MODULAR_DEFAULT_VERBOSE. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.521 -r1.522 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.521 src/share/man/man4/options.4:1.522
--- src/share/man/man4/options.4:1.521	Tue Nov 16 05:16:47 2021
+++ src/share/man/man4/options.4	Sat May  7 04:35:20 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.521 2021/11/16 05:16:47 msaitoh Exp $
+.\"	$NetBSD: options.4,v 1.522 2022/05/07 04:35:20 rin Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -30,7 +30,7 @@
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
 .\"
-.Dd November 16, 2021
+.Dd May 7, 2022
 .Dt OPTIONS 4
 .Os
 .Sh NAME
@@ -1291,6 +1291,12 @@ This sets the default value of the
 .Em kern.module.autoload
 .Xr sysctl 3
 variable which may be changed at run time.
+.It Cd options MODULAR_DEFAULT_VERBOSE
+Enables verbose debug messages of kernel modules by default.
+This sets the default value of the
+.Em kern.module.verbose
+.Xr sysctl 3
+variable which may be changed at run time.
 .It Cd options VND_COMPRESSION
 Enables the
 .Xr vnd 4



CVS commit: src/share/man/man4

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:35:20 UTC 2022

Modified Files:
src/share/man/man4: options.4

Log Message:
Document MODULAR_DEFAULT_VERBOSE. Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.521 -r1.522 src/share/man/man4/options.4

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



CVS commit: src/sys/arch/amd64/conf

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:32:29 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
Add MODULAR_DEFAULT_VERBOSE.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/amd64/conf/ALL

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



CVS commit: src/sys/arch/amd64/conf

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:32:29 UTC 2022

Modified Files:
src/sys/arch/amd64/conf: ALL

Log Message:
Add MODULAR_DEFAULT_VERBOSE.


To generate a diff of this commit:
cvs rdiff -u -r1.169 -r1.170 src/sys/arch/amd64/conf/ALL

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/amd64/conf/ALL
diff -u src/sys/arch/amd64/conf/ALL:1.169 src/sys/arch/amd64/conf/ALL:1.170
--- src/sys/arch/amd64/conf/ALL:1.169	Thu Dec 23 17:13:13 2021
+++ src/sys/arch/amd64/conf/ALL	Sat May  7 04:32:29 2022
@@ -1,4 +1,4 @@
-# $NetBSD: ALL,v 1.169 2021/12/23 17:13:13 hannken Exp $
+# $NetBSD: ALL,v 1.170 2022/05/07 04:32:29 rin Exp $
 # From NetBSD: GENERIC,v 1.787 2006/10/01 18:37:54 bouyer Exp
 #
 # ALL machine description file
@@ -17,7 +17,7 @@ include 	"arch/amd64/conf/std.amd64"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"ALL-$Revision: 1.169 $"
+#ident		"ALL-$Revision: 1.170 $"
 
 maxusers	64		# estimated number of users
 
@@ -97,6 +97,7 @@ options 	SYSVSHM		# System V-like memory
 
 options 	MODULAR		# new style module(7) framework
 options 	MODULAR_DEFAULT_AUTOLOAD
+options 	MODULAR_DEFAULT_VERBOSE
 
 options 	USERCONF	# userconf(4) support
 options 	PIPE_SOCKETPAIR	# smaller, but slower pipe(2)



CVS commit: src/sys

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:30:41 UTC 2022

Modified Files:
src/sys/conf: files
src/sys/kern: kern_module.c

Log Message:
Add MODULAR_DEFAULT_VERBOSE option.


To generate a diff of this commit:
cvs rdiff -u -r1.1296 -r1.1297 src/sys/conf/files
cvs rdiff -u -r1.153 -r1.154 src/sys/kern/kern_module.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/conf/files
diff -u src/sys/conf/files:1.1296 src/sys/conf/files:1.1297
--- src/sys/conf/files:1.1296	Thu Mar 24 02:24:24 2022
+++ src/sys/conf/files	Sat May  7 04:30:41 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.1296 2022/03/24 02:24:24 manu Exp $
+#	$NetBSD: files,v 1.1297 2022/05/07 04:30:41 rin Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20171118
@@ -26,6 +26,7 @@ defflag	opt_ptrace.h		PTRACE PTRACE_HOOK
 defflagCOREDUMP
 defflag	opt_modular.h		MODULAR
 defflag	opt_modular.h		MODULAR_DEFAULT_AUTOLOAD
+defflag	opt_modular.h		MODULAR_DEFAULT_VERBOSE
 defflagKEYLOCK
 defparam opt_syslimits.h	CHILD_MAX OPEN_MAX
 defflagGPROF

Index: src/sys/kern/kern_module.c
diff -u src/sys/kern/kern_module.c:1.153 src/sys/kern/kern_module.c:1.154
--- src/sys/kern/kern_module.c:1.153	Thu Sep 16 21:29:42 2021
+++ src/sys/kern/kern_module.c	Sat May  7 04:30:41 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_module.c,v 1.153 2021/09/16 21:29:42 andvar Exp $	*/
+/*	$NetBSD: kern_module.c,v 1.154 2022/05/07 04:30:41 rin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.153 2021/09/16 21:29:42 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module.c,v 1.154 2022/05/07 04:30:41 rin Exp $");
 
 #define _MODULE_INTERNAL
 
@@ -84,7 +84,11 @@ static const modinfo_t module_netbsd_mod
 };
 
 static module_t	*module_active;
-bool		module_verbose_on;
+#ifdef MODULAR_DEFAULT_VERBOSE
+bool		module_verbose_on = true;
+#else
+bool		module_verbose_on = false;
+#endif
 #ifdef MODULAR_DEFAULT_AUTOLOAD
 bool		module_autoload_on = true;
 #else



CVS commit: src/sys

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:30:41 UTC 2022

Modified Files:
src/sys/conf: files
src/sys/kern: kern_module.c

Log Message:
Add MODULAR_DEFAULT_VERBOSE option.


To generate a diff of this commit:
cvs rdiff -u -r1.1296 -r1.1297 src/sys/conf/files
cvs rdiff -u -r1.153 -r1.154 src/sys/kern/kern_module.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/powerpc/booke

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:19:22 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke: trap_subr.S

Log Message:
Make this assemble correctly with clang.

At the moment, clang wrongly handles m[ft]sprgN (N >= 4);
use m[ft]spr for SPR_SPRGN instead.

Now, clang-compiled kernel seems working just fine on my RB800!


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/booke/trap_subr.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/powerpc/booke/trap_subr.S
diff -u src/sys/arch/powerpc/booke/trap_subr.S:1.13 src/sys/arch/powerpc/booke/trap_subr.S:1.14
--- src/sys/arch/powerpc/booke/trap_subr.S:1.13	Mon Jul  6 10:16:12 2020
+++ src/sys/arch/powerpc/booke/trap_subr.S	Sat May  7 04:19:22 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap_subr.S,v 1.13 2020/07/06 10:16:12 rin Exp $	*/
+/*	$NetBSD: trap_subr.S,v 1.14 2022/05/07 04:19:22 rin Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-RCSID("$NetBSD: trap_subr.S,v 1.13 2020/07/06 10:16:12 rin Exp $")
+RCSID("$NetBSD: trap_subr.S,v 1.14 2022/05/07 04:19:22 rin Exp $")
 
 #ifdef _KERNEL_OPT
 #include "opt_altivec.h"
@@ -68,15 +68,20 @@ RCSID("$NetBSD: trap_subr.S,v 1.13 2020/
 	 * needed, saves sprg3, and then refers to the save using a
 	 * displacement of -amount.
 	 */
+	/*
+	 * XXXclang
+	 * At the moment, clang cannot correctly assemble m[ft]sprgN
+	 * (N >= 4); use m[ft]spr for SPR_SPRGN instead.
+	 */
 #define	FRAME_EXC_PROLOGUE(start, sprg, srr)\
-	mt##sprg %r2;			/* save r2 */			\
+	mtspr	sprg,%r2;		/* save r2 */			\
 	mfsprg3	%r2;			/* get save_area pointer */	\
 	addi	%r2,%r2,4*(32-start);	\
 	/* allocate save area */	\
 	mtsprg3	%r2;			/* save updated pointer */	\
 	stmw	%r##start,-4*(32-start)(%r2);\
 	/* free r24-r31 for use */	\
-	mf##sprg %r26;			/* get saved r2 */		\
+	mfspr	%r26,sprg;		/* get saved r2 */		\
 	mfcr	%r27;			/* get Condition Register */	\
 	mfxer	%r28;			/* get XER */			\
 	mfspr	%r30, SPR_##srr##0;	/* get SRR0 */			\
@@ -103,41 +108,41 @@ RCSID("$NetBSD: trap_subr.S,v 1.13 2020/
 mtsrr1	r
 
 #define	FRAME_PROLOGUE		\
-	FRAME_EXC_PROLOGUE(26, sprg1, SRR)
+	FRAME_EXC_PROLOGUE(26, SPR_SPRG1, SRR)
 
 #define	FRAME_PROLOGUE_DEAR_ESR	\
-	FRAME_EXC_PROLOGUE(24, sprg1, SRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG1, SRR); \
 	PROLOGUE_GET_ESR; \
 	PROLOGUE_GET_DEAR
 
 #define	FRAME_PROLOGUE_ESR	\
-	FRAME_EXC_PROLOGUE(25, sprg1, SRR); \
+	FRAME_EXC_PROLOGUE(25, SPR_SPRG1, SRR); \
 	PROLOGUE_GET_ESR
 
 #define	FRAME_TLBPROLOGUE	\
-	FRAME_EXC_PROLOGUE(20, sprg1, SRR); \
+	FRAME_EXC_PROLOGUE(20, SPR_SPRG1, SRR); \
 	PROLOGUE_GET_ESR; \
 	PROLOGUE_GET_DEAR
 
 #define	FRAME_INTR_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(26, sprg1, SRR)
+	FRAME_EXC_PROLOGUE(26, SPR_SPRG1, SRR)
 
 /*
  * These need to save SRR0/SRR1 as well their SRR0/SRR1 in case normal
  * exceptions happened during their execution.
  */
 #define	FRAME_CRIT_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(24, sprg4, CSRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG4, CSRR); \
 	PROLOGUE_GET_SPRG1; \
 	PROLOGUE_GET_SRRS
 
 #define	FRAME_MCHK_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(24, sprg5, MCSRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG5, MCSRR); \
 	PROLOGUE_GET_SPRG1; \
 	PROLOGUE_GET_SRRS
 
 #define	FRAME_DEBUG_PROLOGUE	\
-	FRAME_EXC_PROLOGUE(24, sprg4, CSRR); \
+	FRAME_EXC_PROLOGUE(24, SPR_SPRG4, CSRR); \
 	PROLOGUE_GET_SPRG1; \
 	PROLOGUE_GET_SRRS
 



CVS commit: src/sys/arch/powerpc/booke

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:19:22 UTC 2022

Modified Files:
src/sys/arch/powerpc/booke: trap_subr.S

Log Message:
Make this assemble correctly with clang.

At the moment, clang wrongly handles m[ft]sprgN (N >= 4);
use m[ft]spr for SPR_SPRGN instead.

Now, clang-compiled kernel seems working just fine on my RB800!


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/booke/trap_subr.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

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:12:55 UTC 2022

Modified Files:
src/sys/arch/evbppc/dht: locore.S
src/sys/arch/powerpc/include: spr.h

Log Message:
Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
 and use it.

Idea from uwe@, thanks!
(and sorry for delayed response!)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/dht/locore.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/include/spr.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/evbppc/dht/locore.S
diff -u src/sys/arch/evbppc/dht/locore.S:1.2 src/sys/arch/evbppc/dht/locore.S:1.3
--- src/sys/arch/evbppc/dht/locore.S:1.2	Sun Feb 20 18:56:01 2022
+++ src/sys/arch/evbppc/dht/locore.S	Sat May  7 04:12:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.2 2022/02/20 18:56:01 christos Exp $	*/
+/*	$NetBSD: locore.S,v 1.3 2022/05/07 04:12:54 rin Exp $	*/
 
 /*
  * Taken from src/sys/arch/powerpc/ibm4xx/openbios/locore.s:
@@ -120,9 +120,9 @@ __start:
 	 * Note:Meaning of bits we need to set is undocumented.
 	 */
 	sync
-	mfspr   %r0,947 	/* mfccr0  %r0 */
+	mfspr   %r0,SPR_CCR0	/* XXXclang: mfccr0 %r0 */
 	oris%r0,%r0,0x5000@h
-	mtspr   947,%r0		/* mtccr0  %r0 */
+	mtspr   SPR_CCR0,%r0	/* XXXclang: mtccr0 %r0 */
 	isync
 
 	/* PPC405GP errata, item #58.

Index: src/sys/arch/powerpc/include/spr.h
diff -u src/sys/arch/powerpc/include/spr.h:1.54 src/sys/arch/powerpc/include/spr.h:1.55
--- src/sys/arch/powerpc/include/spr.h:1.54	Tue Nov  2 11:21:24 2021
+++ src/sys/arch/powerpc/include/spr.h	Sat May  7 04:12:54 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: spr.h,v 1.54 2021/11/02 11:21:24 ryo Exp $	*/
+/*	$NetBSD: spr.h,v 1.55 2022/05/07 04:12:54 rin Exp $	*/
 
 /*
  * Copyright (c) 2001, The NetBSD Foundation, Inc.
@@ -144,6 +144,7 @@ mfspr(int reg)
 #define	SPR_TBL			0x11c	/* E468 Time Base Lower */
 #define	SPR_TBU			0x11d	/* E468 Time Base Upper */
 #define	SPR_PVR			0x11f	/* E468 Processor Version Register */
+#define	SPR_CCR0		0x3b3	/* .4.. Core Configuration Register */
 
 /* Time Base Register declarations */
 #define	TBR_TBL			0x10c	/* E468 Time Base Lower */



CVS commit: src/sys/arch

2022-05-06 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat May  7 04:12:55 UTC 2022

Modified Files:
src/sys/arch/evbppc/dht: locore.S
src/sys/arch/powerpc/include: spr.h

Log Message:
Instead of hard-coding SPR# for CCR0, define SPR_CCR0 in
 and use it.

Idea from uwe@, thanks!
(and sorry for delayed response!)


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbppc/dht/locore.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/powerpc/include/spr.h

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



CVS commit: src/lib/libc/gmon

2022-05-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri May  6 04:49:13 UTC 2022

Modified Files:
src/lib/libc/gmon: gmon.c

Log Message:
PR lib/56395
PR toolchain/56771

Fix profiling on CPUs that do not support unaligned memory access;
Allocate objects (referenced from struct gmonparam) with proper
alignments.

For monstartup(), objects are allocated on heap. Break is not
guaranteed to be aligned at all, unlike stack pointer.

For _m_gmon_alloc(), objects are allocated on anonymous memory.
p->tos is not aligned properly in general.

This fixes quasi-random crashes for *_profile tests, at least on
SH-4 and PowerPC 403 [1]. Also, no regression is observed for
others as far as I can see.

This change does not cause any ABI breakage, as long as application
uses proper pointers; use p->tos instead of evil pointer arithmetic
like (struct tostruct *)((char *)p->froms + p->fromssize) [2].

[1] Timeout should be increased for some tests. "pic" variants
still fail as expected. Dynamically-linked binaries also crash in
rtld for SH-4, but this seems different problem...

[2] This example did not work even before, since the order of
froms[] and tos[] is reversed depending on which of monstartup() or
_m_gmon_alloc() is used for allocation.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/gmon/gmon.c

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



CVS commit: src/lib/libc/gmon

2022-05-05 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri May  6 04:49:13 UTC 2022

Modified Files:
src/lib/libc/gmon: gmon.c

Log Message:
PR lib/56395
PR toolchain/56771

Fix profiling on CPUs that do not support unaligned memory access;
Allocate objects (referenced from struct gmonparam) with proper
alignments.

For monstartup(), objects are allocated on heap. Break is not
guaranteed to be aligned at all, unlike stack pointer.

For _m_gmon_alloc(), objects are allocated on anonymous memory.
p->tos is not aligned properly in general.

This fixes quasi-random crashes for *_profile tests, at least on
SH-4 and PowerPC 403 [1]. Also, no regression is observed for
others as far as I can see.

This change does not cause any ABI breakage, as long as application
uses proper pointers; use p->tos instead of evil pointer arithmetic
like (struct tostruct *)((char *)p->froms + p->fromssize) [2].

[1] Timeout should be increased for some tests. "pic" variants
still fail as expected. Dynamically-linked binaries also crash in
rtld for SH-4, but this seems different problem...

[2] This example did not work even before, since the order of
froms[] and tos[] is reversed depending on which of monstartup() or
_m_gmon_alloc() is used for allocation.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/lib/libc/gmon/gmon.c

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

Modified files:

Index: src/lib/libc/gmon/gmon.c
diff -u src/lib/libc/gmon/gmon.c:1.36 src/lib/libc/gmon/gmon.c:1.37
--- src/lib/libc/gmon/gmon.c:1.36	Sat Jul  3 14:08:55 2021
+++ src/lib/libc/gmon/gmon.c	Fri May  6 04:49:13 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: gmon.c,v 1.36 2021/07/03 14:08:55 christos Exp $	*/
+/*	$NetBSD: gmon.c,v 1.37 2022/05/06 04:49:13 rin Exp $	*/
 
 /*
  * Copyright (c) 2003, 2004 Wasabi Systems, Inc.
@@ -69,7 +69,7 @@
 #if 0
 static char sccsid[] = "@(#)gmon.c	8.1 (Berkeley) 6/4/93";
 #else
-__RCSID("$NetBSD: gmon.c,v 1.36 2021/07/03 14:08:55 christos Exp $");
+__RCSID("$NetBSD: gmon.c,v 1.37 2022/05/06 04:49:13 rin Exp $");
 #endif
 #endif
 
@@ -141,21 +141,25 @@ monstartup(u_long lowpc, u_long highpc)
 		p->tolimit = MAXARCS;
 	p->tossize = p->tolimit * sizeof(struct tostruct);
 
-	cp = sbrk((intptr_t)(p->kcountsize + p->fromssize + p->tossize));
-	if (cp == (char *)-1) {
+	cp = sbrk((intptr_t)0);
+
+#define	GMON_ALLOC(buf, ptr, size)	\
+do {\
+	(buf) = (void *)roundup((uintptr_t)(buf), __alignof(*(ptr)));	\
+	(ptr) = (void *)(buf);		\
+	(buf) += (size);		\
+} while (0)
+
+	GMON_ALLOC(cp, p->kcount, p->kcountsize);
+	GMON_ALLOC(cp, p->froms, p->fromssize);
+	GMON_ALLOC(cp, p->tos, p->tossize);
+
+	if (brk(cp)) {
 		warnx("%s: out of memory", __func__);
 		return;
 	}
-#ifdef notdef
-	(void)memset(cp, 0, p->kcountsize + p->fromssize + p->tossize);
-#endif
-	p->tos = (struct tostruct *)(void *)cp;
-	cp += (size_t)p->tossize;
-	p->kcount = (u_short *)(void *)cp;
-	cp += (size_t)p->kcountsize;
-	p->froms = (u_short *)(void *)cp;
+	__minbrk = cp;
 
-	__minbrk = sbrk((intptr_t)0);
 	p->tos[0].link = 0;
 
 	o = p->highpc - p->lowpc;
@@ -226,17 +230,22 @@ _m_gmon_alloc(void)
 	} else {
 		mutex_unlock(&_gmonlock);
 		cp = mmap(NULL,
-		(size_t)(sizeof (struct gmonparam) + 
-			_gmonparam.fromssize + _gmonparam.tossize),
+		(size_t)(__alignof(*p) + sizeof(*p) +
+			__alignof(*_gmonparam.froms) + _gmonparam.fromssize +
+			__alignof(*_gmonparam.tos) + _gmonparam.tossize),
 		PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, (off_t)0);
-		p = (void *)cp;
+
+		GMON_ALLOC(cp, p, sizeof(*p));
 		*p = _gmonparam;
 		p->state = GMON_PROF_ON;
 		p->kcount = NULL;
-		cp += sizeof (struct gmonparam);
-		memset(cp, 0, (size_t)(p->fromssize + p->tossize));
-		p->froms = (u_short *)(void *)cp;
-		p->tos = (struct tostruct *)(void *)(cp + p->fromssize);
+
+		GMON_ALLOC(cp, p->froms, p->fromssize);
+		memset(p->froms, 0, p->fromssize);
+
+		GMON_ALLOC(cp, p->tos, p->tossize);
+		memset(p->tos, 0, p->tossize);
+
 		mutex_lock(&_gmonlock);
 		p->kcount = (u_short *)(void *)_gmoninuse;
 		_gmoninuse = p;



CVS commit: src/sys/lib/libsa

2022-04-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 09:24:05 UTC 2022

Modified Files:
src/sys/lib/libsa: stand.h

Log Message:
Now, NULL is always defined correctly, as we include  above.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/lib/libsa/stand.h

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



CVS commit: src/sys/lib/libsa

2022-04-30 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 09:24:05 UTC 2022

Modified Files:
src/sys/lib/libsa: stand.h

Log Message:
Now, NULL is always defined correctly, as we include  above.


To generate a diff of this commit:
cvs rdiff -u -r1.86 -r1.87 src/sys/lib/libsa/stand.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/lib/libsa/stand.h
diff -u src/sys/lib/libsa/stand.h:1.86 src/sys/lib/libsa/stand.h:1.87
--- src/sys/lib/libsa/stand.h:1.86	Fri Apr 29 07:42:07 2022
+++ src/sys/lib/libsa/stand.h	Sat Apr 30 09:24:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stand.h,v 1.86 2022/04/29 07:42:07 rin Exp $	*/
+/*	$NetBSD: stand.h,v 1.87 2022/04/30 09:24:05 rin Exp $	*/
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -72,10 +72,6 @@
 #include "saioctl.h"
 #include "saerrno.h"
 
-#ifndef NULL
-#define	NULL	0
-#endif
-
 #ifdef LIBSA_RENAME_PRINTF
 #define getchar		libsa_getchar
 #define kgets		libsa_kgets



CVS commit: src/sys/arch/rs6000/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:59:15 UTC 2022

Modified Files:
src/sys/arch/rs6000/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/rs6000/stand/boot/devopen.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/rs6000/stand/boot/devopen.c
diff -u src/sys/arch/rs6000/stand/boot/devopen.c:1.2 src/sys/arch/rs6000/stand/boot/devopen.c:1.3
--- src/sys/arch/rs6000/stand/boot/devopen.c:1.2	Sun Aug 10 07:40:49 2014
+++ src/sys/arch/rs6000/stand/boot/devopen.c	Sat Apr 30 03:59:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.2 2014/08/10 07:40:49 isaki Exp $	*/
+/*	$NetBSD: devopen.c,v 1.3 2022/04/30 03:59:15 rin Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -73,7 +73,7 @@ devparse(const char *fname, int *dev, in
 
 	if (*s == '(') {
 		/* lookup device and get index */
-		*s = NULL;
+		*s = '\0';
 		if ((*dev = devlookup(nametmp)) < 0)
 		goto baddev;
 
@@ -86,13 +86,13 @@ devparse(const char *fname, int *dev, in
 }
 			} else {
 if (flag) {
-	*s = NULL;
+	*s = '\0';
 	flag = 0;
 }
 			}
 		}
 		if (*s == ')')
-			*s = NULL;
+			*s = '\0';
 
 		switch (argc) {
 		case 3:



CVS commit: src/sys/arch/rs6000/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:59:15 UTC 2022

Modified Files:
src/sys/arch/rs6000/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/rs6000/stand/boot/devopen.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/sandpoint/stand/altboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:52:41 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Do not use NULL for integer 0.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/dsk.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/sandpoint/stand/altboot/dsk.c
diff -u src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18 src/sys/arch/sandpoint/stand/altboot/dsk.c:1.19
--- src/sys/arch/sandpoint/stand/altboot/dsk.c:1.18	Tue Sep 29 15:12:52 2015
+++ src/sys/arch/sandpoint/stand/altboot/dsk.c	Sat Apr 30 03:52:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: dsk.c,v 1.18 2015/09/29 15:12:52 phx Exp $ */
+/* $NetBSD: dsk.c,v 1.19 2022/04/30 03:52:41 rin Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -473,7 +473,7 @@ dlabel_valid(int unit)
 
 	dsk = lookup_disk(unit);
 	if (dsk == NULL)
-		return NULL;
+		return 0;
 	return dsk->dlabel != NULL;
 }
 



CVS commit: src/sys/arch/sandpoint/stand/altboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:52:41 UTC 2022

Modified Files:
src/sys/arch/sandpoint/stand/altboot: dsk.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Do not use NULL for integer 0.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/sandpoint/stand/altboot/dsk.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/prep/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:41:05 UTC 2022

Modified Files:
src/sys/arch/prep/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/prep/stand/boot/devopen.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/prep/stand/boot/devopen.c
diff -u src/sys/arch/prep/stand/boot/devopen.c:1.5 src/sys/arch/prep/stand/boot/devopen.c:1.6
--- src/sys/arch/prep/stand/boot/devopen.c:1.5	Sun Aug 10 07:40:49 2014
+++ src/sys/arch/prep/stand/boot/devopen.c	Sat Apr 30 03:41:05 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: devopen.c,v 1.5 2014/08/10 07:40:49 isaki Exp $	*/
+/*	$NetBSD: devopen.c,v 1.6 2022/04/30 03:41:05 rin Exp $	*/
 
 /*-
  *  Copyright (c) 1993 John Brezak
@@ -73,7 +73,7 @@ devparse(const char *fname, int *dev, in
 
 	if (*s == '(') {
 		/* lookup device and get index */
-		*s = NULL;
+		*s = '\0';
 		if ((*dev = devlookup(nametmp)) < 0)
 		goto baddev;
 
@@ -86,13 +86,13 @@ devparse(const char *fname, int *dev, in
 }
 			} else {
 if (flag) {
-	*s = NULL;
+	*s = '\0';
 	flag = 0;
 }
 			}
 		}
 		if (*s == ')')
-			*s = NULL;
+			*s = '\0';
 
 		switch (argc) {
 		case 3:



CVS commit: src/sys/arch/prep/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:41:05 UTC 2022

Modified Files:
src/sys/arch/prep/stand/boot: devopen.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/prep/stand/boot/devopen.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/landisk/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:37:09 UTC 2022

Modified Files:
src/sys/arch/landisk/stand/boot: boot2.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/stand/boot/boot2.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/landisk/stand/boot/boot2.c
diff -u src/sys/arch/landisk/stand/boot/boot2.c:1.6 src/sys/arch/landisk/stand/boot/boot2.c:1.7
--- src/sys/arch/landisk/stand/boot/boot2.c:1.6	Sat Jun 11 06:31:49 2016
+++ src/sys/arch/landisk/stand/boot/boot2.c	Sat Apr 30 03:37:09 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot2.c,v 1.6 2016/06/11 06:31:49 dholland Exp $	*/
+/*	$NetBSD: boot2.c,v 1.7 2022/04/30 03:37:09 rin Exp $	*/
 
 /*
  * Copyright (c) 2003
@@ -479,7 +479,7 @@ parseboot(char *arg, char **filename, in
 	*howto = 0;
 
 	/* if there were no arguments */
-	if (*arg == NULL)
+	if (*arg == '\0')
 		return (1);
 
 	/* format is... */
@@ -493,7 +493,7 @@ parseboot(char *arg, char **filename, in
 		*filename = arg;
 
 		opts = gettrailer(arg);
-		if (*opts == NULL) {
+		if (*opts == '\0') {
 			opts = NULL;
 		} else if (*opts != '-') {
 			printf("invalid arguments\n");



CVS commit: src/sys/arch/landisk/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Apr 30 03:37:09 UTC 2022

Modified Files:
src/sys/arch/landisk/stand/boot: boot2.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/landisk/stand/boot/boot2.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

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:39:51 UTC 2022

Modified Files:
src/sys/arch/cobalt/stand/boot: tgets.c
src/sys/arch/mmeye/stand/boot: tgets.c
src/sys/arch/prep/stand/boot: tgets.c
src/sys/arch/rs6000/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.

XXX
Too many copies for tgets.c...


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/cobalt/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mmeye/stand/boot/tgets.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/prep/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/rs6000/stand/boot/tgets.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/cobalt/stand/boot/tgets.c
diff -u src/sys/arch/cobalt/stand/boot/tgets.c:1.4 src/sys/arch/cobalt/stand/boot/tgets.c:1.5
--- src/sys/arch/cobalt/stand/boot/tgets.c:1.4	Wed Oct 17 19:54:09 2007
+++ src/sys/arch/cobalt/stand/boot/tgets.c	Fri Apr 29 21:39:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.4 2007/10/17 19:54:09 garbled Exp $	*/
+/*	$NetBSD: tgets.c,v 1.5 2022/04/29 21:39:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -45,12 +45,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT / 32); /* XXX */
+		delay(SCANDELAY / 32); /* XXX */
 	}
 	return -1;
 next:

Index: src/sys/arch/mmeye/stand/boot/tgets.c
diff -u src/sys/arch/mmeye/stand/boot/tgets.c:1.1 src/sys/arch/mmeye/stand/boot/tgets.c:1.2
--- src/sys/arch/mmeye/stand/boot/tgets.c:1.1	Thu Mar  3 05:59:37 2011
+++ src/sys/arch/mmeye/stand/boot/tgets.c	Fri Apr 29 21:39:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.1 2011/03/03 05:59:37 kiyohara Exp $	*/
+/*	$NetBSD: tgets.c,v 1.2 2022/04/29 21:39:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -45,12 +45,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return -1;
 next:

Index: src/sys/arch/prep/stand/boot/tgets.c
diff -u src/sys/arch/prep/stand/boot/tgets.c:1.4 src/sys/arch/prep/stand/boot/tgets.c:1.5
--- src/sys/arch/prep/stand/boot/tgets.c:1.4	Mon Apr 10 18:40:06 2006
+++ src/sys/arch/prep/stand/boot/tgets.c	Fri Apr 29 21:39:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.4 2006/04/10 18:40:06 garbled Exp $	*/
+/*	$NetBSD: tgets.c,v 1.5 2022/04/29 21:39:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -43,12 +43,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return (-1);
 next:

Index: src/sys/arch/rs6000/stand/boot/tgets.c
diff -u src/sys/arch/rs6000/stand/boot/tgets.c:1.1 src/sys/arch/rs6000/stand/boot/tgets.c:1.2
--- src/sys/arch/rs6000/stand/boot/tgets.c:1.1	Mon Dec 17 19:09:55 2007
+++ src/sys/arch/rs6000/stand/boot/tgets.c	Fri Apr 29 21:39:51 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.1 2007/12/17 19:09:55 garbled Exp $	*/
+/*	$NetBSD: tgets.c,v 1.2 2022/04/29 21:39:51 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -43,12 +43,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return (-1);
 next:



CVS commit: src/sys/arch

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:39:51 UTC 2022

Modified Files:
src/sys/arch/cobalt/stand/boot: tgets.c
src/sys/arch/mmeye/stand/boot: tgets.c
src/sys/arch/prep/stand/boot: tgets.c
src/sys/arch/rs6000/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.

XXX
Too many copies for tgets.c...


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/cobalt/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mmeye/stand/boot/tgets.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/prep/stand/boot/tgets.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/rs6000/stand/boot/tgets.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/acorn32/stand/boot32

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:03:08 UTC 2022

Modified Files:
src/sys/arch/acorn32/stand/boot32: boot32.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/acorn32/stand/boot32/boot32.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/acorn32/stand/boot32/boot32.c
diff -u src/sys/arch/acorn32/stand/boot32/boot32.c:1.48 src/sys/arch/acorn32/stand/boot32/boot32.c:1.49
--- src/sys/arch/acorn32/stand/boot32/boot32.c:1.48	Wed Nov 10 15:33:26 2021
+++ src/sys/arch/acorn32/stand/boot32/boot32.c	Fri Apr 29 21:03:08 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot32.c,v 1.48 2021/11/10 15:33:26 msaitoh Exp $	*/
+/*	$NetBSD: boot32.c,v 1.49 2022/04/29 21:03:08 rin Exp $	*/
 
 /*-
  * Copyright (c) 2002 Reinoud Zandijk
@@ -1070,7 +1070,7 @@ process_args(int argc, char **argv, int 
 	static char filename[80];
 
 	*howto = 0;
-	*file = NULL; *start_args = 1;
+	*file = '\0'; *start_args = 1;
 	for (i = 1; i < argc; i++) {
 		if (argv[i][0] == '-')
 			for (j = 1; argv[i][j]; j++)
@@ -1085,7 +1085,7 @@ process_args(int argc, char **argv, int 
 			break;
 		}
 	}
-	if (*file == NULL) {
+	if (*file == '\0') {
 		if (*howto & RB_ASKNAME) {
 			printf("boot: ");
 			kgets(filename, sizeof(filename));



CVS commit: src/sys/arch/acorn32/stand/boot32

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 21:03:08 UTC 2022

Modified Files:
src/sys/arch/acorn32/stand/boot32: boot32.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

Use '\0' instead of NULL for NUL-character.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/acorn32/stand/boot32/boot32.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/bebox/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:48:27 UTC 2022

Modified Files:
src/sys/arch/bebox/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/bebox/stand/boot/tgets.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/bebox/stand/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:48:27 UTC 2022

Modified Files:
src/sys/arch/bebox/stand/boot: tgets.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

SCANWAIT and PWAIT are renamed to SCANDELAY and SCANWAIT, respectively,
in order not to redefine PWAIT.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/bebox/stand/boot/tgets.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/bebox/stand/boot/tgets.c
diff -u src/sys/arch/bebox/stand/boot/tgets.c:1.8 src/sys/arch/bebox/stand/boot/tgets.c:1.9
--- src/sys/arch/bebox/stand/boot/tgets.c:1.8	Fri Feb 25 10:12:44 2011
+++ src/sys/arch/bebox/stand/boot/tgets.c	Fri Apr 29 20:48:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: tgets.c,v 1.8 2011/02/25 10:12:44 kiyohara Exp $	*/
+/*	$NetBSD: tgets.c,v 1.9 2022/04/29 20:48:26 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -43,12 +43,12 @@ tgets(char *buf)
 #ifdef	USE_SCAN
 	int i;
 
-#define	SCANWAIT	1
-#define	PWAIT		500
-	for (i = 0; i < PWAIT; i++) {
+#define	SCANDELAY	1
+#define	SCANWAIT	500
+	for (i = 0; i < SCANWAIT; i++) {
 		if ((c = cnscan()) != -1)
 			goto next;
-		delay(SCANWAIT);
+		delay(SCANDELAY);
 	}
 	return -1;
 next:



CVS commit: src/sys/arch/sparc/stand/ofwboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:24:02 UTC 2022

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

- Stop redefining roundup2().
- Compare kvamap->start (uint64_t) with 0 instead of NULL.
- Include  explicitly.

Thanks gson@ for notification.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.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/sparc/stand/ofwboot/loadfile_machdep.c
diff -u src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.16 src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.17
--- src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c:1.16	Fri Nov  4 20:04:11 2016
+++ src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.c	Fri Apr 29 20:24:02 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: loadfile_machdep.c,v 1.16 2016/11/04 20:04:11 macallan Exp $	*/
+/*	$NetBSD: loadfile_machdep.c,v 1.17 2022/04/29 20:24:02 rin Exp $	*/
 
 /*-
  * Copyright (c) 2005 The NetBSD Foundation, Inc.
@@ -29,6 +29,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include 
+
 #include 
 #include 
 
@@ -47,8 +49,6 @@
 #define hi(val)		((uint32_t)(((val) >> 32) & (uint32_t)-1))
 #define lo(val)		((uint32_t)((val) & (uint32_t)-1))
 
-#define roundup2(x, y)	(((x)+((y)-1))&(~((y)-1)))
-
 
 typedef int phandle_t;
 
@@ -133,7 +133,7 @@ kvamap_extract(vaddr_t va, vsize_t len, 
 
 	*new_va  = va;
 	for (i = 0; (len > 0) && (i < MAXSEGNUM); i++) {
-		if (kvamap[i].start == NULL)
+		if (kvamap[i].start == 0)
 			break;
 		if ((kvamap[i].start <= va) && (va < kvamap[i].end)) {
 			uint64_t va_len = kvamap[i].end - va;
@@ -155,7 +155,7 @@ kvamap_enter(uint64_t va, uint64_t len)
 
 	DPRINTF(("kvamap_enter: %d@%p\n", (int)len, (void*)(u_long)va));
 	for (i = 0; (len > 0) && (i < MAXSEGNUM); i++) {
-		if (kvamap[i].start == NULL) {
+		if (kvamap[i].start == 0) {
 			kvamap[i].start = va;
 			kvamap[i].end = va + len;
 			break;



CVS commit: src/sys/arch/sparc/stand/ofwboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 20:24:02 UTC 2022

Modified Files:
src/sys/arch/sparc/stand/ofwboot: loadfile_machdep.c

Log Message:
Fix fallout from libsa change; stand.h includes  now.

- Stop redefining roundup2().
- Compare kvamap->start (uint64_t) with 0 instead of NULL.
- Include  explicitly.

Thanks gson@ for notification.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 \
src/sys/arch/sparc/stand/ofwboot/loadfile_machdep.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/amiga/stand/bootblock

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:45:20 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/bootxx_ffs: Makefile

Log Message:
Enable SA_HARDCODED_SECSIZE to shrink loaders slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.27 -r1.28 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile

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



CVS commit: src/sys/arch/amiga/stand/bootblock

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:45:20 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile
src/sys/arch/amiga/stand/bootblock/bootxx_ffs: Makefile

Log Message:
Enable SA_HARDCODED_SECSIZE to shrink loaders slightly.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/amiga/stand/bootblock/boot/Makefile
cvs rdiff -u -r1.27 -r1.28 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile

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/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.61 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.62
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.61	Fri Apr 29 06:56:56 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Fri Apr 29 07:45:20 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.61 2022/04/29 06:56:56 rin Exp $
+#	$NetBSD: Makefile,v 1.62 2022/04/29 07:45:20 rin Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -50,7 +50,7 @@ SOBJS += libstubs.o
 OBJS+=	$(SOBJS) $(COBJS)
 
 #XX#DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
-DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER 
+DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE
 DEFS += -D__INTERNAL_LIBSA_CREAD
 DEFS += -DSERCONSOLE
 SOBJS += cread.o

Index: src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile:1.27 src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile:1.28
--- src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile:1.27	Fri Apr 29 07:18:17 2022
+++ src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile	Fri Apr 29 07:45:20 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.27 2022/04/29 07:18:17 rin Exp $
+#	$NetBSD: Makefile,v 1.28 2022/04/29 07:45:20 rin Exp $
 
 .include 
 .include 
@@ -46,7 +46,8 @@ SOBJS += libstubs.o memcmp.o memmove.o m
 
 OBJS+=	$(SOBJS) $(COBJS)
 
-DEFS+= -D_STANDALONE -DSA_EXEC_ANYOWNER -D_PRIMARY_BOOT -DSERCONSOLE
+DEFS+=	-D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE \
+	-D_PRIMARY_BOOT -DSERCONSOLE
 
 .NOPATH: ${OBJS} x.out f.out libboot.a xxstart.o
 



CVS commit: src/sys/lib/libsa

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:42:07 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libsa/ext2fs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.85 -r1.86 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.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/lib/libsa/ext2fs.c
diff -u src/sys/lib/libsa/ext2fs.c:1.33 src/sys/lib/libsa/ext2fs.c:1.34
--- src/sys/lib/libsa/ext2fs.c:1.33	Wed Apr 27 14:48:50 2022
+++ src/sys/lib/libsa/ext2fs.c	Fri Apr 29 07:42:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs.c,v 1.33 2022/04/27 14:48:50 rin Exp $	*/
+/*	$NetBSD: ext2fs.c,v 1.34 2022/04/29 07:42:07 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -415,15 +415,9 @@ read_sblock(struct open_file *f, struct 
 	struct ext2fs ext2fs;
 	size_t buf_size;
 	int rc;
-	u_int secsize;
-
-	secsize = 0;
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
 
 	rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-	SBOFF / secsize, SBSIZE, sbbuf, _size);
+	SBOFF / GETSECSIZE(f), SBSIZE, sbbuf, _size);
 	if (rc)
 		return rc;
 

Index: src/sys/lib/libsa/minixfs3.c
diff -u src/sys/lib/libsa/minixfs3.c:1.12 src/sys/lib/libsa/minixfs3.c:1.13
--- src/sys/lib/libsa/minixfs3.c:1.12	Wed Apr 27 14:48:50 2022
+++ src/sys/lib/libsa/minixfs3.c	Fri Apr 29 07:42:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: minixfs3.c,v 1.12 2022/04/27 14:48:50 rin Exp $	*/
+/*	$NetBSD: minixfs3.c,v 1.13 2022/04/29 07:42:07 rin Exp $	*/
 
 /*-
  * Copyright (c) 2012
@@ -449,7 +449,6 @@ read_sblock(struct open_file *f, struct 
 	static uint8_t sbbuf[MINBSIZE];
 	size_t buf_size;
 	int rc;
-	u_int secsize;
 
 	/* We must read amount multiple of sector size, hence we can't
 	 * read SBSIZE and read MINBSIZE.
@@ -457,13 +456,8 @@ read_sblock(struct open_file *f, struct 
 	if (SBSIZE > MINBSIZE)
 		return EINVAL;
 
-	secsize = 0;
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
-
 	rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-	SUPER_BLOCK_OFF / secsize, MINBSIZE, sbbuf, _size);
+	SUPER_BLOCK_OFF / GETSECSIZE(f), MINBSIZE, sbbuf, _size);
 	if (rc)
 		return rc;
 

Index: src/sys/lib/libsa/stand.h
diff -u src/sys/lib/libsa/stand.h:1.85 src/sys/lib/libsa/stand.h:1.86
--- src/sys/lib/libsa/stand.h:1.85	Wed Apr 27 14:48:50 2022
+++ src/sys/lib/libsa/stand.h	Fri Apr 29 07:42:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stand.h,v 1.85 2022/04/27 14:48:50 rin Exp $	*/
+/*	$NetBSD: stand.h,v 1.86 2022/04/29 07:42:07 rin Exp $	*/
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -64,6 +64,7 @@
 #ifndef _LIBSA_STAND_H_
 #define	_LIBSA_STAND_H_
 
+#include 
 #include 
 #include 
 #include 
@@ -320,4 +321,26 @@ void	bzero(void *, size_t);
 
 int	atoi(const char *);
 
+#if !defined(SA_HARDCODED_SECSIZE)
+#define	GETSECSIZE(f)	getsecsize(f)
+static inline u_int
+getsecsize(struct open_file *f)
+{
+	int rc;
+	u_int secsize = 0;
+
+	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
+	if (rc != 0 || secsize == 0)
+		secsize = DEV_BSIZE;
+
+	return secsize;
+}
+#else
+/*
+ * For some archs, divdi3 and friends are required to support variable
+ * sector sizes. Shave them off by making secsize compile-time constant.
+ */
+#define	GETSECSIZE(f)	DEV_BSIZE
+#endif
+
 #endif /* _LIBSA_STAND_H_ */
Index: src/sys/lib/libsa/ufs.c
diff -u src/sys/lib/libsa/ufs.c:1.85 src/sys/lib/libsa/ufs.c:1.86
--- src/sys/lib/libsa/ufs.c:1.85	Wed Apr 27 14:48:50 2022
+++ src/sys/lib/libsa/ufs.c	Fri Apr 29 07:42:07 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs.c,v 1.85 2022/04/27 14:48:50 rin Exp $	*/
+/*	$NetBSD: ufs.c,v 1.86 2022/04/29 07:42:07 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -594,21 +594,15 @@ ffs_find_superblock(struct open_file *f,
 	struct file *fp = (struct file *)f->f_fsdata;
 	int rc;
 	size_t buf_size;
-	u_int secsize;
 #ifdef LIBSA_FFSv2
 	static daddr_t sblock_try[] = SBLOCKSEARCH;
 	int i;
 #endif
 
-	secsize = 0;
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
-
 #ifdef LIBSA_FFSv2
 	for (i = 0; sblock_try[i] != -1; i++) {
 		rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-		sblock_try[i] / secsize, SBLOCKSIZE, fs, _size);
+		sblock_try[i] / GETSECSIZE(f), SBLOCKSIZE, fs, _size);
 		if (rc)
 			return rc;
 		if (buf_size != SBLOCKSIZE)
@@ -623,7 +617,7 @@ ffs_find_superblock(struct 

CVS commit: src/sys/lib/libsa

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:42:07 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Re-introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize for some archs.

Should be useful for ancient archs, for which secsize is fixed.

Thanks christos@ for comment.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/lib/libsa/ext2fs.c
cvs rdiff -u -r1.12 -r1.13 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.85 -r1.86 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c

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



Re: CVS commit: src/sys/lib/libsa

2022-04-29 Thread Rin Okuyama

On 2022/04/28 3:29, Christos Zoulas wrote:

In article <20220427144850.61383f...@cvs.netbsd.org>,
Rin Okuyama  wrote:

-=-=-=-=-=-

Module Name:src
Committed By:   rin
Date:   Wed Apr 27 14:48:50 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...


But that was a nice change :-)


Thanks! Actually, it should be useful for ancient archs.

Now, amiga/boot(8) is fixed. I will enable this again.

rin


CVS commit: src/sys/arch/amiga/stand/bootblock/installboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:19:33 UTC 2022

Removed Files:
src/sys/arch/amiga/stand/bootblock/installboot: Makefile installboot.c

Log Message:
Remove unused; switched to usr.sbin/installboot/arch/amiga.c long ago.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r0 \
src/sys/arch/amiga/stand/bootblock/installboot/Makefile
cvs rdiff -u -r1.6 -r0 \
src/sys/arch/amiga/stand/bootblock/installboot/installboot.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/amiga/stand/bootblock/installboot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:19:33 UTC 2022

Removed Files:
src/sys/arch/amiga/stand/bootblock/installboot: Makefile installboot.c

Log Message:
Remove unused; switched to usr.sbin/installboot/arch/amiga.c long ago.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r0 \
src/sys/arch/amiga/stand/bootblock/installboot/Makefile
cvs rdiff -u -r1.6 -r0 \
src/sys/arch/amiga/stand/bootblock/installboot/installboot.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/amiga/stand/bootblock/bootxx_ffs

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:18:17 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/bootxx_ffs: Makefile main.c

Log Message:
Stop twiddling when loading boot.amiga; it is small enough.

Slightly reduce insn's for primary loaders, and stop them to output garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
cvs rdiff -u -r1.9 -r1.10 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.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/amiga/stand/bootblock/bootxx_ffs/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile:1.26 src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile:1.27
--- src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile:1.26	Thu Feb 25 03:42:14 2021
+++ src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile	Fri Apr 29 07:18:17 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.26 2021/02/25 03:42:14 rin Exp $
+#	$NetBSD: Makefile,v 1.27 2022/04/29 07:18:17 rin Exp $
 
 .include 
 .include 
@@ -36,7 +36,7 @@ DEFS+=		-DBOOTXX_FFS_VERSION=1
 
 BINDIR=/usr/mdec
 
-COBJS = main.o console.o xd.o twiddle.o bzero.o gets.o
+COBJS = main.o console.o xd.o bzero.o gets.o
 COBJS+=  lseek.o open.o vers.o read.o close.o dev.o errno.o
 COBJS+=  ${FSOBJS} panic.o files.o
 

Index: src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.c
diff -u src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.c:1.9 src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.c:1.10
--- src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.c:1.9	Sun Nov 15 20:38:36 2009
+++ src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.c	Fri Apr 29 07:18:17 2022
@@ -1,5 +1,5 @@
 /*
- * $NetBSD: main.c,v 1.9 2009/11/15 20:38:36 snj Exp $
+ * $NetBSD: main.c,v 1.10 2022/04/29 07:18:17 rin Exp $
  *
  *
  * Copyright (c) 1996,1999 Ignatios Souvatzis
@@ -139,3 +139,10 @@ err:
 	consclose();
 	return 1;
 }
+
+void
+twiddle(void)
+{
+
+	/* Keep silence; boot.amiga should be small enough. */
+}



CVS commit: src/sys/arch/amiga/stand/bootblock/bootxx_ffs

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:18:17 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/bootxx_ffs: Makefile main.c

Log Message:
Stop twiddling when loading boot.amiga; it is small enough.

Slightly reduce insn's for primary loaders, and stop them to output garbage.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/Makefile
cvs rdiff -u -r1.9 -r1.10 \
src/sys/arch/amiga/stand/bootblock/bootxx_ffs/main.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/amiga/stand/bootblock

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:12:42 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: bbstart.s
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
Simplify relocation rules.

Now, both single- and triple-byte encodings in relocation table
represent addrdiff (instead of absolute file offset for the latter).

Shave off one insn for boot.amiga. Also, for elf2bb(1), relocation
overflow is mitigated and detectable at least even if inevitable
(it seems unlikely to happen although).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amiga/stand/bootblock/boot/bbstart.s
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/boot/bbstart.s
diff -u src/sys/arch/amiga/stand/bootblock/boot/bbstart.s:1.14 src/sys/arch/amiga/stand/bootblock/boot/bbstart.s:1.15
--- src/sys/arch/amiga/stand/bootblock/boot/bbstart.s:1.14	Fri Apr 29 06:42:58 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/bbstart.s	Fri Apr 29 07:12:41 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: bbstart.s,v 1.14 2022/04/29 06:42:58 rin Exp $ */
+/* $NetBSD: bbstart.s,v 1.15 2022/04/29 07:12:41 rin Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -159,7 +159,6 @@ Lrelocate:
 	
 Loopw:
 	clrw	%a2@+
-	movl	%d1,%a0	| for a variant with relative words, erase this line
 Loopb:
 	addl	%d0,%a0
 	addl	%d1,%a0@

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.29 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.30
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.29	Fri Apr 29 06:59:29 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Fri Apr 29 07:12:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.29 2022/04/29 06:59:29 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.30 2022/04/29 07:12:42 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -394,15 +394,16 @@ main(int argc, char *argv[])
 			"oldaddr = 0x%08x, abort.\n", relbuf[i], oldaddr);
 		} else if (addrdiff > 0xff) {
 			*rpo = 0;
+			tmp16 = htobe16(addrdiff);
 			if (delta > 0) {
 ++rpo;
-*rpo++ = (relbuf[i] >> 8) & 0xff;
-*rpo++ = relbuf[i] & 0xff;
+memcpy(rpo, , sizeof(tmp16));
+rpo += sizeof(tmp16);
 dprintf(("%02x%02x%02x\n",
 rpo[-3], rpo[-2], rpo[-1]));
 			} else {
-*--rpo = relbuf[i] & 0xff;
-*--rpo = (relbuf[i] >> 8) & 0xff;
+rpo -= sizeof(tmp16);
+memcpy(rpo, , sizeof(tmp16));
 --rpo;
 dprintf(("%02x%02x%02x\n",
 rpo[0], rpo[1], rpo[2]));



CVS commit: src/sys/arch/amiga/stand/bootblock

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 07:12:42 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: bbstart.s
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
Simplify relocation rules.

Now, both single- and triple-byte encodings in relocation table
represent addrdiff (instead of absolute file offset for the latter).

Shave off one insn for boot.amiga. Also, for elf2bb(1), relocation
overflow is mitigated and detectable at least even if inevitable
(it seems unlikely to happen although).


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amiga/stand/bootblock/boot/bbstart.s
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/elf2bb

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:59:29 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
Comment that (buffer + 14) stands for reltab in bbstart.s.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.28 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.29
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.28	Mon Apr 25 15:48:57 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Fri Apr 29 06:59:29 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.28 2022/04/25 15:48:57 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.29 2022/04/29 06:59:29 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -288,7 +288,7 @@ main(int argc, char *argv[])
 	case RELVER_RELATIVE_BYTES_FORWARD:
 		rpo = buffer + tsz + dsz;
 		delta = +1;
-		*(uint16_t *)(buffer + 14) = htobe16(tsz + dsz);
+		*(uint16_t *)(buffer + 14) /* reltab */ = htobe16(tsz + dsz);
 		break;
 	}
 



CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:59:29 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
Comment that (buffer + 14) stands for reltab in bbstart.s.


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:56:56 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Now, cread.c can be built with -Os.

It was not a compiler bug actually; object code generated with
"-Os -Wa,-l" contains R_68K_16, which is not supported by elf2bb(1).

We should have fixed elf2bb(1), but the problem is gone at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:56:56 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Now, cread.c can be built with -Os.

It was not a compiler bug actually; object code generated with
"-Os -Wa,-l" contains R_68K_16, which is not supported by elf2bb(1).

We should have fixed elf2bb(1), but the problem is gone at the moment.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.60 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.61
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.60	Fri Apr 29 06:48:22 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Fri Apr 29 06:56:56 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.60 2022/04/29 06:48:22 rin Exp $
+#	$NetBSD: Makefile,v 1.61 2022/04/29 06:56:56 rin Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -93,9 +93,6 @@ CFLAGS= -ffreestanding ${COPTIM} ${INCPA
 CFLAGS+= -Werror
 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith
 
-# XXX work around a gcc 4.5 bug
-COPTS.cread.c = -O1
-
 .c.o:
 	${_MKTARGET_COMPILE}
 	${CC} ${CFLAGS} ${COPTS.${.IMPSRC:T}} -S $< -o $*.s



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:48:22 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Compile boot.amiga without -l option for gas(1).

Fix build failure due to relocation overflows for R_68K_PC16.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.59 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.60
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.59	Wed Apr 27 14:50:35 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Fri Apr 29 06:48:22 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.59 2022/04/27 14:50:35 rin Exp $
+#	$NetBSD: Makefile,v 1.60 2022/04/29 06:48:22 rin Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -84,11 +84,11 @@ INCPATH += -I${.CURDIR}
 INCPATH += -I${.CURDIR}/../../.. -I${.OBJDIR}
 INCPATH += -I${.CURDIR}/../elf2bb
 
-AFLAGS += -march=68030 -mcpu=68030 -l
-CAFLAGS += -Wa,-l -Wa,-march=68030 -Wa,-mcpu=68030 ${INCPATH}
+AFLAGS += -march=68030 -mcpu=68030
+CAFLAGS += -Wa,-march=68030 -Wa,-mcpu=68030 ${INCPATH}
 
 COPTIM= -Os -fomit-frame-pointer -fcse-follow-jumps -fcse-skip-blocks
-COPTIM+= -Wa,-l -m68060 -Wa,-march=68030 -Wa,-mcpu=68030 -fno-unwind-tables
+COPTIM+= -m68060 -Wa,-march=68030 -Wa,-mcpu=68030 -fno-unwind-tables
 CFLAGS= -ffreestanding ${COPTIM} ${INCPATH} ${DEFS}
 CFLAGS+= -Werror
 CFLAGS+= -Wall -Wmissing-prototypes -Wstrict-prototypes -Wpointer-arith



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:48:22 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Compile boot.amiga without -l option for gas(1).

Fix build failure due to relocation overflows for R_68K_PC16.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:42:58 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: bbstart.s

Log Message:
Fix boot.amiga when relocation table is located beyond 0x8000.

In this case, we cannot load reltab directly into %a2 by movw:

For m68k, movw is actually synonym for different instructions when
its destination is data or address register, respectively.

(1) For data register, it is for move.w, which loads source into lower
half word with upper wharf word being kept untouched.

(2) For address register, it is movea.w, which loads source with
*sign extension*.

XXX
We should really stop using movw, and use move.w or movea.w explicitly.
However, this will end up with BIG diff...

Thanks ryo@ and isaki@ for comments offlist.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amiga/stand/bootblock/boot/bbstart.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/amiga/stand/bootblock/boot/bbstart.s
diff -u src/sys/arch/amiga/stand/bootblock/boot/bbstart.s:1.13 src/sys/arch/amiga/stand/bootblock/boot/bbstart.s:1.14
--- src/sys/arch/amiga/stand/bootblock/boot/bbstart.s:1.13	Tue Jul  6 05:59:57 2010
+++ src/sys/arch/amiga/stand/bootblock/boot/bbstart.s	Fri Apr 29 06:42:58 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: bbstart.s,v 1.13 2010/07/06 05:59:57 mrg Exp $ */
+/* $NetBSD: bbstart.s,v 1.14 2022/04/29 06:42:58 rin Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -143,7 +143,17 @@ Lioerr:
 Lrelocate:
 	lea	%pc@(Lzero),%a0
 	movl	%a0,%d1
-	movw	%pc@(Lreltab),%a2
+
+	/*
+	 * Here, we cannot use
+	 *	movw	%pc@(Lreltab),%a2
+	 * "movw" against An is synonym for "movea.w", which carries out
+	 * sign extension. This breaks things when reltab >= 0x8000.
+	 */
+	movq	#0,%d0
+	movw	%pc@(Lreltab),%d0
+	movl	%d0,%a2
+
 	addl	%d1,%a2
 	jra	Loopend
 	



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-29 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Fri Apr 29 06:42:58 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: bbstart.s

Log Message:
Fix boot.amiga when relocation table is located beyond 0x8000.

In this case, we cannot load reltab directly into %a2 by movw:

For m68k, movw is actually synonym for different instructions when
its destination is data or address register, respectively.

(1) For data register, it is for move.w, which loads source into lower
half word with upper wharf word being kept untouched.

(2) For address register, it is movea.w, which loads source with
*sign extension*.

XXX
We should really stop using movw, and use move.w or movea.w explicitly.
However, this will end up with BIG diff...

Thanks ryo@ and isaki@ for comments offlist.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/amiga/stand/bootblock/boot/bbstart.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/amiga/stand/bootblock/boot

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 14:50:35 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Revert previous.

On 2022/04/27 21:10, Rin Okuyama wrote:
> Module Name:  src
> Committed By: rin
> Date: Wed Apr 27 12:10:47 UTC 2022
>
> Modified Files:
>   src/sys/arch/amiga/stand/bootblock/boot: Makefile
>
> Log Message:
> Sprinkle SA_HARDCODED_SECSIZE; now everything fits into
> +/-32KB range visible for PC relative addressing mode.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amiga/stand/bootblock/boot/Makefile
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.58 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.59
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.58	Wed Apr 27 12:10:47 2022
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Wed Apr 27 14:50:35 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.58 2022/04/27 12:10:47 rin Exp $
+#	$NetBSD: Makefile,v 1.59 2022/04/27 14:50:35 rin Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -50,7 +50,7 @@ SOBJS += libstubs.o
 OBJS+=	$(SOBJS) $(COBJS)
 
 #XX#DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
-DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE
+DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER 
 DEFS += -D__INTERNAL_LIBSA_CREAD
 DEFS += -DSERCONSOLE
 SOBJS += cread.o



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 14:50:35 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Revert previous.

On 2022/04/27 21:10, Rin Okuyama wrote:
> Module Name:  src
> Committed By: rin
> Date: Wed Apr 27 12:10:47 UTC 2022
>
> Modified Files:
>   src/sys/arch/amiga/stand/bootblock/boot: Makefile
>
> Log Message:
> Sprinkle SA_HARDCODED_SECSIZE; now everything fits into
> +/-32KB range visible for PC relative addressing mode.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amiga/stand/bootblock/boot/Makefile
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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



CVS commit: src/sys/lib/libsa

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 14:48:50 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name:  src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
>   src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libsa/ext2fs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.84 -r1.85 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.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/lib/libsa/ext2fs.c
diff -u src/sys/lib/libsa/ext2fs.c:1.32 src/sys/lib/libsa/ext2fs.c:1.33
--- src/sys/lib/libsa/ext2fs.c:1.32	Wed Apr 27 11:48:26 2022
+++ src/sys/lib/libsa/ext2fs.c	Wed Apr 27 14:48:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs.c,v 1.32 2022/04/27 11:48:26 rin Exp $	*/
+/*	$NetBSD: ext2fs.c,v 1.33 2022/04/27 14:48:50 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -415,9 +415,15 @@ read_sblock(struct open_file *f, struct 
 	struct ext2fs ext2fs;
 	size_t buf_size;
 	int rc;
+	u_int secsize;
+
+	secsize = 0;
+	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
+	if (rc != 0 || secsize == 0)
+		secsize = DEV_BSIZE;
 
 	rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-	SBOFF / GETSECSIZE(f), SBSIZE, sbbuf, _size);
+	SBOFF / secsize, SBSIZE, sbbuf, _size);
 	if (rc)
 		return rc;
 

Index: src/sys/lib/libsa/minixfs3.c
diff -u src/sys/lib/libsa/minixfs3.c:1.11 src/sys/lib/libsa/minixfs3.c:1.12
--- src/sys/lib/libsa/minixfs3.c:1.11	Wed Apr 27 11:48:26 2022
+++ src/sys/lib/libsa/minixfs3.c	Wed Apr 27 14:48:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: minixfs3.c,v 1.11 2022/04/27 11:48:26 rin Exp $	*/
+/*	$NetBSD: minixfs3.c,v 1.12 2022/04/27 14:48:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 2012
@@ -449,6 +449,7 @@ read_sblock(struct open_file *f, struct 
 	static uint8_t sbbuf[MINBSIZE];
 	size_t buf_size;
 	int rc;
+	u_int secsize;
 
 	/* We must read amount multiple of sector size, hence we can't
 	 * read SBSIZE and read MINBSIZE.
@@ -456,8 +457,13 @@ read_sblock(struct open_file *f, struct 
 	if (SBSIZE > MINBSIZE)
 		return EINVAL;
 
+	secsize = 0;
+	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
+	if (rc != 0 || secsize == 0)
+		secsize = DEV_BSIZE;
+
 	rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-	SUPER_BLOCK_OFF / GETSECSIZE(f), MINBSIZE, sbbuf, _size);
+	SUPER_BLOCK_OFF / secsize, MINBSIZE, sbbuf, _size);
 	if (rc)
 		return rc;
 

Index: src/sys/lib/libsa/stand.h
diff -u src/sys/lib/libsa/stand.h:1.84 src/sys/lib/libsa/stand.h:1.85
--- src/sys/lib/libsa/stand.h:1.84	Wed Apr 27 11:48:26 2022
+++ src/sys/lib/libsa/stand.h	Wed Apr 27 14:48:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stand.h,v 1.84 2022/04/27 11:48:26 rin Exp $	*/
+/*	$NetBSD: stand.h,v 1.85 2022/04/27 14:48:50 rin Exp $	*/
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -64,7 +64,6 @@
 #ifndef _LIBSA_STAND_H_
 #define	_LIBSA_STAND_H_
 
-#include 
 #include 
 #include 
 #include 
@@ -321,22 +320,4 @@ void	bzero(void *, size_t);
 
 int	atoi(const char *);
 
-#if !defined(SA_HARDCODED_SECSIZE)
-#define	GETSECSIZE(f)	getsecsize(f)
-static inline u_int
-getsecsize(struct open_file *f)
-{
-	int rc;
-	u_int secsize = 0;
-
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
-
-	return secsize;
-}
-#else
-#define	GETSECSIZE(f)	DEV_BSIZE
-#endif
-
 #endif /* _LIBSA_STAND_H_ */
Index: src/sys/lib/libsa/ufs

CVS commit: src/sys/lib/libsa

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 14:48:50 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Revert previous at the moment.

This is wrong reasoning; 68020 and above (incl. 040 and 060) support
32-bit displacements for PC relative addressing (via "fully extension
addressing mode" with null index register).

I've still not figured out what goes wrong with amiga/boot(8) when
compiled without -l option for gas(1)...

On 2022/04/27 20:48, Rin Okuyama wrote:
> Module Name:  src
> Committed By: rin
> Date: Wed Apr 27 11:48:26 UTC 2022
>
> Modified Files:
>   src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c
>
> Log Message:
> Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
> used instead of secsize obtained by SAIOSECSIZE ioctl.
>
> This hack avoids divdi3 and friends from being linked, in order to
> support variable secsize.
>
> This is useful for amiga/boot(8); it is loaded by firmware into
> unpredictable address, and therefore all symbols should be
> addressable by PC relative mode with only 16-bit displacements.
>
> See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
> more details.
>
>
> To generate a diff of this commit:
> cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
> cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
> cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.c
>
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/lib/libsa/ext2fs.c
cvs rdiff -u -r1.11 -r1.12 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.84 -r1.85 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.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/amiga/stand/bootblock/boot

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 12:10:47 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Sprinkle SA_HARDCODED_SECSIZE; now everything fits into
+/-32KB range visible for PC relative addressing mode.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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/amiga/stand/bootblock/boot/Makefile
diff -u src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.57 src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.58
--- src/sys/arch/amiga/stand/bootblock/boot/Makefile:1.57	Thu Feb 25 03:42:14 2021
+++ src/sys/arch/amiga/stand/bootblock/boot/Makefile	Wed Apr 27 12:10:47 2022
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.57 2021/02/25 03:42:14 rin Exp $
+#	$NetBSD: Makefile,v 1.58 2022/04/27 12:10:47 rin Exp $
 
 .include 
 .include 		# for HOST_SH
@@ -50,7 +50,7 @@ SOBJS += libstubs.o
 OBJS+=	$(SOBJS) $(COBJS)
 
 #XX#DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DDYNAMIC_CRC_TABLE -DNOBYFOUR -UBYFOUR 
-DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER 
+DEFS = -D_STANDALONE -DSA_EXEC_ANYOWNER -DSA_HARDCODED_SECSIZE
 DEFS += -D__INTERNAL_LIBSA_CREAD
 DEFS += -DSERCONSOLE
 SOBJS += cread.o



CVS commit: src/sys/arch/amiga/stand/bootblock/boot

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 12:10:47 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: Makefile

Log Message:
Sprinkle SA_HARDCODED_SECSIZE; now everything fits into
+/-32KB range visible for PC relative addressing mode.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/arch/amiga/stand/bootblock/boot/Makefile

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



CVS commit: src/sys/lib/libsa

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 11:48:26 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.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/lib/libsa/ext2fs.c
diff -u src/sys/lib/libsa/ext2fs.c:1.31 src/sys/lib/libsa/ext2fs.c:1.32
--- src/sys/lib/libsa/ext2fs.c:1.31	Sun Apr 24 06:48:15 2022
+++ src/sys/lib/libsa/ext2fs.c	Wed Apr 27 11:48:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ext2fs.c,v 1.31 2022/04/24 06:48:15 mlelstv Exp $	*/
+/*	$NetBSD: ext2fs.c,v 1.32 2022/04/27 11:48:26 rin Exp $	*/
 
 /*
  * Copyright (c) 1997 Manuel Bouyer.
@@ -415,15 +415,9 @@ read_sblock(struct open_file *f, struct 
 	struct ext2fs ext2fs;
 	size_t buf_size;
 	int rc;
-	u_int secsize;
-
-	secsize = 0;
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
 
 	rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-	SBOFF / secsize, SBSIZE, sbbuf, _size);
+	SBOFF / GETSECSIZE(f), SBSIZE, sbbuf, _size);
 	if (rc)
 		return rc;
 

Index: src/sys/lib/libsa/minixfs3.c
diff -u src/sys/lib/libsa/minixfs3.c:1.10 src/sys/lib/libsa/minixfs3.c:1.11
--- src/sys/lib/libsa/minixfs3.c:1.10	Sun Apr 24 06:48:15 2022
+++ src/sys/lib/libsa/minixfs3.c	Wed Apr 27 11:48:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: minixfs3.c,v 1.10 2022/04/24 06:48:15 mlelstv Exp $	*/
+/*	$NetBSD: minixfs3.c,v 1.11 2022/04/27 11:48:26 rin Exp $	*/
 
 /*-
  * Copyright (c) 2012
@@ -449,7 +449,6 @@ read_sblock(struct open_file *f, struct 
 	static uint8_t sbbuf[MINBSIZE];
 	size_t buf_size;
 	int rc;
-	u_int secsize;
 
 	/* We must read amount multiple of sector size, hence we can't
 	 * read SBSIZE and read MINBSIZE.
@@ -457,13 +456,8 @@ read_sblock(struct open_file *f, struct 
 	if (SBSIZE > MINBSIZE)
 		return EINVAL;
 
-	secsize = 0;
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
-
 	rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-	SUPER_BLOCK_OFF / secsize, MINBSIZE, sbbuf, _size);
+	SUPER_BLOCK_OFF / GETSECSIZE(f), MINBSIZE, sbbuf, _size);
 	if (rc)
 		return rc;
 

Index: src/sys/lib/libsa/stand.h
diff -u src/sys/lib/libsa/stand.h:1.83 src/sys/lib/libsa/stand.h:1.84
--- src/sys/lib/libsa/stand.h:1.83	Mon May 17 08:50:36 2021
+++ src/sys/lib/libsa/stand.h	Wed Apr 27 11:48:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: stand.h,v 1.83 2021/05/17 08:50:36 mrg Exp $	*/
+/*	$NetBSD: stand.h,v 1.84 2022/04/27 11:48:26 rin Exp $	*/
 
 /*
  * Copyright (c) 1999 Christopher G. Demetriou.  All rights reserved.
@@ -64,6 +64,7 @@
 #ifndef _LIBSA_STAND_H_
 #define	_LIBSA_STAND_H_
 
+#include 
 #include 
 #include 
 #include 
@@ -320,4 +321,22 @@ void	bzero(void *, size_t);
 
 int	atoi(const char *);
 
+#if !defined(SA_HARDCODED_SECSIZE)
+#define	GETSECSIZE(f)	getsecsize(f)
+static inline u_int
+getsecsize(struct open_file *f)
+{
+	int rc;
+	u_int secsize = 0;
+
+	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
+	if (rc != 0 || secsize == 0)
+		secsize = DEV_BSIZE;
+
+	return secsize;
+}
+#else
+#define	GETSECSIZE(f)	DEV_BSIZE
+#endif
+
 #endif /* _LIBSA_STAND_H_ */
Index: src/sys/lib/libsa/ufs.c
diff -u src/sys/lib/libsa/ufs.c:1.83 src/sys/lib/libsa/ufs.c:1.84
--- src/sys/lib/libsa/ufs.c:1.83	Sun Apr 24 06:52:59 2022
+++ src/sys/lib/libsa/ufs.c	Wed Apr 27 11:48:26 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: ufs.c,v 1.83 2022/04/24 06:52:59 mlelstv Exp $	*/
+/*	$NetBSD: ufs.c,v 1.84 2022/04/27 11:48:26 rin Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -594,21 +594,15 @@ ffs_find_superblock(struct open_file *f,
 	struct file *fp = (struct file *)f->f_fsdata;
 	int rc;
 	size_t buf_size;
-	u_int secsize;
 #ifdef LIBSA_FFSv2
 	static daddr_t sblock_try[] = SBLOCKSEARCH;
 	int i;
 #endif
 
-	secsize = 0;
-	rc = DEV_IOCTL(f->f_dev)(f, SAIOSECSIZE, );
-	if (rc != 0 || secsize == 0)
-		secsize = DEV_BSIZE;
-
 #ifdef LIBSA_FFSv2
 	for (i = 0; sblock_try[i] != -1; i++) {
 		rc = DEV_STRATEGY(f->f_dev)(f->f_devdata, F_READ,
-		sblock_try[i] / secsize, SBLOCKSIZE, fs, _size);
+		sblock_try[i] / GETSECSIZE(f), SBLOCKSIZE, fs, _size);
 		if (rc)
 			return rc;
 		if (buf_size != SBLOCKSIZE)
@@ -623,7 +617,7 @@ 

CVS commit: src/sys/lib/libsa

2022-04-27 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Wed Apr 27 11:48:26 UTC 2022

Modified Files:
src/sys/lib/libsa: ext2fs.c minixfs3.c stand.h ufs.c

Log Message:
Introduce SA_HARDCODED_SECSIZE hack, by which hardcoded DEV_BSIZE is
used instead of secsize obtained by SAIOSECSIZE ioctl.

This hack avoids divdi3 and friends from being linked, in order to
support variable secsize.

This is useful for amiga/boot(8); it is loaded by firmware into
unpredictable address, and therefore all symbols should be
addressable by PC relative mode with only 16-bit displacements.

See sys/arch/amiga/stand/bootblock/{boot/bbstart.s,elf2bb,txlt} for
more details.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/lib/libsa/ext2fs.c
cvs rdiff -u -r1.10 -r1.11 src/sys/lib/libsa/minixfs3.c
cvs rdiff -u -r1.83 -r1.84 src/sys/lib/libsa/stand.h src/sys/lib/libsa/ufs.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/amiga/stand/bootblock/elf2bb

2022-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr 25 15:48:57 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
One more style. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.27 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.28
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.27	Mon Apr 25 14:46:38 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Mon Apr 25 15:48:57 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.27 2022/04/25 14:46:38 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.28 2022/04/25 15:48:57 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -431,9 +431,9 @@ main(int argc, char *argv[])
 	*rpo = 0; rpo += delta;
 	*rpo = 0; rpo += delta;
 
-	printf("using %td bytes, %td bytes remaining.\n", delta > 0 ?
-	rpo-buffer-tsz-dsz : buffer+bbsize-rpo, delta > 0 ?
-	buffer + bbsize - rpo : rpo - buffer - tsz - dsz);
+	printf("using %td bytes, %td bytes remaining.\n",
+	delta > 0 ? rpo - buffer - tsz - dsz : buffer + bbsize - rpo,
+	delta > 0 ? buffer + bbsize - rpo : rpo - buffer - tsz - dsz);
 	/*
 	 * RELOCs must fit into the bss area.
 	 */



CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb

2022-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr 25 15:48:57 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
One more style. No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c

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/amiga/stand/bootblock/elf2bb

2022-04-25 Thread Rin Okuyama

On 2022/04/25 23:03, Rin Okuyama wrote:

Module Name:src
Committed By:   rin
Date:   Mon Apr 25 14:03:15 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c elf2bb.c

Log Message:
Use htobe{16,32}(9) instead of be{16,32}toh(9) where appropriate.

No binary changes both for little and big endian machines.


Oops, "be{16,32}toh(3) instead of htobe{16,32}(3)", apparently...

Thanks,
rin


CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb

2022-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr 25 14:46:38 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
static-ify function bodies of usage() and eval().

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.26 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.27
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.26	Mon Apr 25 14:39:30 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Mon Apr 25 14:46:38 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.26 2022/04/25 14:39:30 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.27 2022/04/25 14:46:38 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -466,7 +466,7 @@ main(int argc, char *argv[])
 	exit(0);
 }
 
-void
+static void
 usage(void)
 {
 	fprintf(stderr, "Usage: %s [-F] bootprog bootprog.bin\n",
@@ -475,7 +475,7 @@ usage(void)
 	/* NOTREACHED */
 }
 
-int
+static int
 eval(Elf32_Sym *s, uint32_t *o)
 {
 	int value;



CVS commit: src/sys/arch/amiga/stand/bootblock/elf2bb

2022-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr 25 14:46:38 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: elf2bb.c

Log Message:
static-ify function bodies of usage() and eval().

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.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/amiga/stand/bootblock/elf2bb

2022-04-25 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Mon Apr 25 14:45:26 UTC 2022

Modified Files:
src/sys/arch/amiga/stand/bootblock/elf2bb: chksum.c

Log Message:
One more style... No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.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/amiga/stand/bootblock/elf2bb/chksum.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.8 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.9
--- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.8	Mon Apr 25 14:39:30 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c	Mon Apr 25 14:45:26 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: chksum.c,v 1.8 2022/04/25 14:39:30 rin Exp $ */
+/* $NetBSD: chksum.c,v 1.9 2022/04/25 14:45:26 rin Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@ main(int argc, char *argb[]) {
 	uint32_t cks, cks1;
 
 	bbsize = atol(argb[1]);
-	bbsize *= (512 / sizeof (uint32_t));
+	bbsize *= (512 / sizeof(uint32_t));
 
 	if (4 * bbsize != read(0, myblock, sizeof(uint32_t) * bbsize)) {
 		fprintf(stderr, "short read\n");



  1   2   3   4   5   6   7   8   9   >