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

2023-03-25 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Sat Mar 25 20:14:26 UTC 2023

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: console.c libstubs.h
libstubs.s version

Log Message:
Fix NetBSD/amiga bootblocks for Kickstart 3.2 - from Karoly Balogh

Kickstart 3.2 changed to not initialize console.device before
bootstrap, so the previous NetBSD bootblocks would crash when they
tried to initialise console output.

With this change if the call to the OpenDevice() stub fails, the
code now calls FindResident() and InitResident() before retrying
the OpenDevice().

Many thanks to Karoly Balogh for tracking this down (and also for
knowing just who to poke to get insight into the 3.2 changes :)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amiga/stand/bootblock/boot/console.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/stand/bootblock/boot/libstubs.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amiga/stand/bootblock/boot/libstubs.s
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amiga/stand/bootblock/boot/version

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/console.c
diff -u src/sys/arch/amiga/stand/bootblock/boot/console.c:1.15 src/sys/arch/amiga/stand/bootblock/boot/console.c:1.16
--- src/sys/arch/amiga/stand/bootblock/boot/console.c:1.15	Sun Dec 18 12:02:37 2016
+++ src/sys/arch/amiga/stand/bootblock/boot/console.c	Sat Mar 25 20:14:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: console.c,v 1.15 2016/12/18 12:02:37 mlelstv Exp $ */
+/* $NetBSD: console.c,v 1.16 2023/03/25 20:14:26 abs Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -138,8 +138,20 @@ consinit(void *consptr) {
 		goto err;
 
 	mc->cnior->buf = (void *)mc->w;
-	if (OpenDevice("console.device", 0, mc->cnior, 0))
-		goto err;
+	mc->cnior->length = 136; /* sizeof(struct Window) */
+	if (OpenDevice("console.device", 0, mc->cnior, 0)) {
+		/* Kickstart 3.2 decided not to initialize console.device
+before bootstrap, so we have to do it ourselves. */
+		void *res = FindResident("console.device");
+		if (!res)
+			goto err;
+
+		if (!InitResident(res, 0))
+			goto err;
+
+		if (OpenDevice("console.device", 0, mc->cnior, 0))
+			goto err;
+	}
 
 	mc->tmior = (struct TimerIO *)CreateIORequest(mc->cnmp, sizeof(struct TimerIO));
 	if (!mc->tmior)

Index: src/sys/arch/amiga/stand/bootblock/boot/libstubs.h
diff -u src/sys/arch/amiga/stand/bootblock/boot/libstubs.h:1.7 src/sys/arch/amiga/stand/bootblock/boot/libstubs.h:1.8
--- src/sys/arch/amiga/stand/bootblock/boot/libstubs.h:1.7	Sat Oct 17 11:18:18 2009
+++ src/sys/arch/amiga/stand/bootblock/boot/libstubs.h	Sat Mar 25 20:14:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: libstubs.h,v 1.7 2009/10/17 11:18:18 mlelstv Exp $ */
+/* $NetBSD: libstubs.h,v 1.8 2023/03/25 20:14:26 abs Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -65,6 +65,7 @@ void CloseDevice(struct AmigaIO *);
 #endif
 
 void *FindResident(const char *);
+void *InitResident(const char *, u_int32_t);
 void *OpenResource(const char *);
 
 u_int32_t CachePreDMA(u_int32_t, u_int32_t *, int);

Index: src/sys/arch/amiga/stand/bootblock/boot/libstubs.s
diff -u src/sys/arch/amiga/stand/bootblock/boot/libstubs.s:1.10 src/sys/arch/amiga/stand/bootblock/boot/libstubs.s:1.11
--- src/sys/arch/amiga/stand/bootblock/boot/libstubs.s:1.10	Sat Oct 17 11:18:18 2009
+++ src/sys/arch/amiga/stand/bootblock/boot/libstubs.s	Sat Mar 25 20:14:26 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: libstubs.s,v 1.10 2009/10/17 11:18:18 mlelstv Exp $ */
+/* $NetBSD: libstubs.s,v 1.11 2023/03/25 20:14:26 abs Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -208,6 +208,16 @@ ENTRY_NOPROFILE(FindResident)
 	movl	%d0,%a0			| Comply with ELF ABI
 	rts
 
+ENTRY_NOPROFILE(InitResident)
+	movl	%a6,%sp@-
+	movl	%pc@(_C_LABEL(SysBase):w),%a6
+	movl	%sp@(8),%a1
+	movl	%sp@(12),%d1
+	jsr	%a6@(-0x66)
+	movl	%sp@+,%a6
+	movl	%d0,%a0			| Comply with ELF ABI
+	rts
+
 ENTRY_NOPROFILE(OpenResource)
 	movl	%a6,%sp@-
 	movl	%pc@(_C_LABEL(SysBase):w),%a6

Index: src/sys/arch/amiga/stand/bootblock/boot/version
diff -u src/sys/arch/amiga/stand/bootblock/boot/version:1.2 src/sys/arch/amiga/stand/bootblock/boot/version:1.3
--- src/sys/arch/amiga/stand/bootblock/boot/version:1.2	Thu Feb 25 03:42:14 2021
+++ src/sys/arch/amiga/stand/bootblock/boot/version	Sat Mar 25 20:14:26 2023
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.2 2021/02/25 03:42:14 rin Exp $
+$NetBSD: version,v 1.3 2023/03/25 20:14:26 abs Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE BOOTBLOCKS HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -12,3 +12,4 @@ is taken as the current.
 2.4:	Moved default command into fixed location for easy patching
 3.0:	Initial 2 stage amiga bootblocks
 3.1:	Add support for FFSv2
+3.2:	Fix booting with some "modern" Kickstart versions



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

2023-03-25 Thread David Brownlee
Module Name:src
Committed By:   abs
Date:   Sat Mar 25 20:14:26 UTC 2023

Modified Files:
src/sys/arch/amiga/stand/bootblock/boot: console.c libstubs.h
libstubs.s version

Log Message:
Fix NetBSD/amiga bootblocks for Kickstart 3.2 - from Karoly Balogh

Kickstart 3.2 changed to not initialize console.device before
bootstrap, so the previous NetBSD bootblocks would crash when they
tried to initialise console output.

With this change if the call to the OpenDevice() stub fails, the
code now calls FindResident() and InitResident() before retrying
the OpenDevice().

Many thanks to Karoly Balogh for tracking this down (and also for
knowing just who to poke to get insight into the 3.2 changes :)


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/amiga/stand/bootblock/boot/console.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/stand/bootblock/boot/libstubs.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/amiga/stand/bootblock/boot/libstubs.s
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/amiga/stand/bootblock/boot/version

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/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/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/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");



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.



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:39:30 UTC 2022

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

Log Message:
Wrap looong lines, and misc style/cosmetic fixes.

No binary changes.


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

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.25 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.26
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.25	Mon Apr 25 14:36:47 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Mon Apr 25 14:39:30 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.25 2022/04/25 14:36:47 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.26 2022/04/25 14:39:30 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@ char *progname;
 int bbsize = BBSIZE;
 uint8_t *buffer;
 uint32_t *relbuf;
-	/* can't have more relocs than that*/
+	/* can't have more relocs than that */
 
 static int
 intcmp(const void *i, const void *j)
@@ -85,7 +85,7 @@ intcmp(const void *i, const void *j)
 
 	r = (*(uint32_t *)i) < (*(uint32_t *)j);
 	
-	return 2*r-1;
+	return 2 * r - 1;
 }
 
 int
@@ -146,7 +146,8 @@ main(int argc, char *argv[])
 
 	eh = (Elf32_Ehdr *)image; /* XXX endianness */
 
-	dprintf(("%04x sections, offset %08x\n", be16toh(eh->e_shnum), be32toh(eh->e_shoff)));
+	dprintf(("%04x sections, offset %08x\n", be16toh(eh->e_shnum),
+	be32toh(eh->e_shoff)));
 	if (be16toh(eh->e_type) != ET_REL)
 		errx(1, "%s isn't a relocatable file, type=%d",
 		argv[0], be16toh(eh->e_type));
@@ -157,22 +158,27 @@ main(int argc, char *argv[])
 	/* Calculate sizes from section headers. */
 	tsz = dsz = bsz = trsz = 0;
 	sh = (Elf32_Shdr *)(image + be32toh(eh->e_shoff));
-	shstrtab = (char *)(image + be32toh(sh[be16toh(eh->e_shstrndx)].sh_offset));
-	symtab = NULL;	/*XXX*/
-	strtab = NULL;	/*XXX*/
-	dprintf(("name  type flagsaddr offset   size align\n"));
+	shstrtab = (char *)(image +
+	be32toh(sh[be16toh(eh->e_shstrndx)].sh_offset));
+	symtab = NULL;	/* XXX */
+	strtab = NULL;	/* XXX */
+	dprintf(("name  type flags"
+		 "addr offset   size align\n"));
 	for (i = 0; i < be16toh(eh->e_shnum); ++i) {
 		uint32_t sh_size;
 
-		dprintf( ("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i,
+		dprintf(("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i,
 		be32toh(sh[i].sh_name), shstrtab + be32toh(sh[i].sh_name),
-		be32toh(sh[i].sh_type),
-		be32toh(sh[i].sh_flags), be32toh(sh[i].sh_addr),
-		be32toh(sh[i].sh_offset), be32toh(sh[i].sh_size),
-		be32toh(sh[i].sh_addralign)));
-		sh_size = (be32toh(sh[i].sh_size) + be32toh(sh[i].sh_addralign) - 1) &
-		- be32toh(sh[i].sh_addralign);
-		/* If section allocates memory, add to text, data, or bss size. */
+		be32toh(sh[i].sh_type), be32toh(sh[i].sh_flags),
+		be32toh(sh[i].sh_addr), be32toh(sh[i].sh_offset),
+		be32toh(sh[i].sh_size), be32toh(sh[i].sh_addralign)));
+		sh_size = (be32toh(sh[i].sh_size) +
+		be32toh(sh[i].sh_addralign) - 1) &
+		(- be32toh(sh[i].sh_addralign));
+		/*
+		 * If section allocates memory, add to text, data,
+		 * or bss size.
+		 */
 		if (be32toh(sh[i].sh_flags) & SHF_ALLOC) {
 			if (be32toh(sh[i].sh_type) == SHT_PROGBITS) {
 if (be32toh(sh[i].sh_flags) & SHF_WRITE)
@@ -188,8 +194,10 @@ main(int argc, char 

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:39:30 UTC 2022

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

Log Message:
Wrap looong lines, and misc style/cosmetic fixes.

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c
cvs rdiff -u -r1.25 -r1.26 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:36:47 UTC 2022

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

Log Message:
Do not cast return value from malloc(3).

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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.24 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.25
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.24	Mon Apr 25 14:10:15 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Mon Apr 25 14:36:47 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.24 2022/04/25 14:10:15 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.25 2022/04/25 14:36:47 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -243,7 +243,7 @@ retry:
 	memset(buffer, 0, bbsize);
 
 	/* Allocate and load loadable sections */
-	sect_offset = (uint32_t *)malloc(be16toh(eh->e_shnum) * sizeof(uint32_t));
+	sect_offset = malloc(be16toh(eh->e_shnum) * sizeof(uint32_t));
 	for (i = 0, l = 0; i < be16toh(eh->e_shnum); ++i) {
 		if (be32toh(sh[i].sh_flags) & SHF_ALLOC) {
 			dprintf(("vaddr 0x%04x size 0x%04x offset 0x%04x section %s\n",



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:36:47 UTC 2022

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

Log Message:
Do not cast return value from malloc(3).

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 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:10:15 UTC 2022

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

Log Message:
- static-ify usage(), intcmp(), and eval()
- remove prototype declaration for main()

NFCI; no binary changes observed for amd64 with -O0.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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.23 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.24
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.23	Mon Apr 25 14:03:15 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Mon Apr 25 14:10:15 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.23 2022/04/25 14:03:15 rin Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.24 2022/04/25 14:10:15 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -59,9 +59,9 @@
 #include "elf2bb.h"
 #include "chksum.h"
 
-void usage(void);
-int intcmp(const void *, const void *);
-int main(int argc, char *argv[]);
+static void usage(void);
+static int intcmp(const void *, const void *);
+static int eval(Elf32_Sym *, uint32_t *);
 
 #ifdef DEBUG
 #define dprintf(x) if (debug) printf x
@@ -78,7 +78,7 @@ uint8_t *buffer;
 uint32_t *relbuf;
 	/* can't have more relocs than that*/
 
-int
+static int
 intcmp(const void *i, const void *j)
 {
 	int r;
@@ -98,7 +98,6 @@ main(int argc, char *argv[])
 	char *shstrtab;
 	Elf32_Sym *symtab;
 	char *strtab;
-	int eval(Elf32_Sym *, uint32_t *);
 	uint32_t *lptr;
 	int i, l, delta;
 	uint8_t *rpo;



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:10:15 UTC 2022

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

Log Message:
- static-ify usage(), intcmp(), and eval()
- remove prototype declaration for main()

NFCI; no binary changes observed for amd64 with -O0.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 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: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.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c
cvs rdiff -u -r1.22 -r1.23 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/chksum.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.6 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.7
--- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.6	Mon Apr 25 13:43:50 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c	Mon Apr 25 14:03:15 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: chksum.c,v 1.6 2022/04/25 13:43:50 rin Exp $ */
+/* $NetBSD: chksum.c,v 1.7 2022/04/25 14:03:15 rin Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -49,7 +49,7 @@ chksum(uint32_t *block, int size)
 
 	for (i=0; ie_shnum), htobe32(eh->e_shoff)));
-	if (htobe16(eh->e_type) != ET_REL)
+	dprintf(("%04x sections, offset %08x\n", be16toh(eh->e_shnum), be32toh(eh->e_shoff)));
+	if (be16toh(eh->e_type) != ET_REL)
 		errx(1, "%s isn't a relocatable file, type=%d",
-		argv[0], htobe16(eh->e_type));
-	if (htobe16(eh->e_machine) != EM_68K)
+		argv[0], be16toh(eh->e_type));
+	if (be16toh(eh->e_machine) != EM_68K)
 		errx(1, "%s isn't M68K, machine=%d", argv[0],
-		htobe16(eh->e_machine));
+		be16toh(eh->e_machine));
 
 	/* Calculate sizes from section headers. */
 	tsz = dsz = bsz = trsz = 0;
-	sh = (Elf32_Shdr *)(image + htobe32(eh->e_shoff));
-	shstrtab = (char *)(image + htobe32(sh[htobe16(eh->e_shstrndx)].sh_offset));
+	sh = (Elf32_Shdr *)(image + be32toh(eh->e_shoff));
+	shstrtab = (char *)(image + be32toh(sh[be16toh(eh->e_shstrndx)].sh_offset));
 	symtab = NULL;	/*XXX*/
 	strtab = NULL;	/*XXX*/
 	dprintf(("name  type flagsaddr offset   size align\n"));
-	for (i = 0; i < htobe16(eh->e_shnum); ++i) {
+	for (i = 0; i < be16toh(eh->e_shnum); ++i) {
 		uint32_t sh_size;
 
 		dprintf( ("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i,
-		htobe32(sh[i].sh_name), shstrtab + htobe32(sh[i].sh_name),
-		htobe32(sh[i].sh_type),
-		htobe32(sh[i].sh_flags), htobe32(sh[i].sh_addr),
-		htobe32(sh[i].sh_offset), htobe32(sh[i].sh_size),
-		htobe32(sh[i].sh_addralign)));
-		sh_size = (htobe32(sh[i].sh_size) + htobe32(sh[i].sh_addralign) - 1) &
-		-htobe32(sh[i].sh_addralign);
+		be32toh(sh[i].sh_name), shstrtab + be32toh(sh[i].sh_name),
+		be32toh(sh[i].sh_type),
+		be32toh(sh[i].sh_flags), be32toh(sh[i].sh_addr),
+		be32toh(sh[i].sh_offset), be32toh(sh[i].sh_size),
+		be32toh(sh[i].sh_addralign)));
+		sh_size = (be32toh(sh[i].sh_size) + be32toh(sh[i].sh_addralign) - 1) &
+		- be32toh(sh[i].sh_addralign);
 		/* If section allocates memory, add to text, data, or bss size. */
-		if (htobe32(sh[i].sh_flags) & SHF_ALLOC) {
-			if (htobe32(sh[i].sh_type) == SHT_PROGBITS) {
-if (htobe32(sh[i].sh_flags) & SHF_WRITE)
+		if (be32toh(sh[i].sh_flags) & SHF_ALLOC) {
+			if (be32toh(sh[i].sh_type) == SHT_PROGBITS) {
+if (be32toh(sh[i].sh_flags) & SHF_WRITE)
 	dsz += sh_size;
 else
 	tsz += sh_size;
 			} else
 bsz += sh_size;
 		/* If it's relocations, add to relocation count */
-		} else if (htobe32(sh[i].sh_type) == SHT_RELA) {
-			trsz += htobe32(sh[i].sh_size);
+		} else if (be32toh(sh[i].sh_type) == SHT_RELA) {
+			trsz += be32toh(sh[i].sh_size);
 		}
 		/* Check for SHT_REL? */
 		/* Get symbol table location. */
-		else if (htobe32(sh[i].sh_type) == SHT_SYMTAB) {
-			symtab = (Elf32_Sym *)(image + htobe32(sh[i].sh_offset));
-		} else if (strcmp(".strtab", shstrtab + htobe32(sh[i].sh_name)) == 0) {
-			strtab = image + htobe32(sh[i].sh_offset);
+		else if (be32toh(sh[i].sh_type) == SHT_SYMTAB) {
+			symtab = (Elf32_Sym *)(image + be32toh(sh[i].sh_offset));
+		} else if (strcmp(".strtab", shstrtab + be32toh(sh[i].sh_name)) == 0) {
+			strtab = image + be32toh(sh[i].sh_offset);
 		}
 	}
 	dprintf(("tsz = 0x%x, dsz = 0x%x, bsz = 0x%x, total 0x%x\n",
@@ -244,18 +244,18 @@ retry:
 	memset(buffer, 0, bbsize);
 
 	/* Allocate and load loadable sections */
-	sect_offset = (uint32_t *)malloc(htobe16(eh->e_shnum) * sizeof(uint32_t));
-	for (i = 0, l = 0; i < htobe16(eh->e_shnum); ++i) {
-		if (htobe32(sh[i].sh_flags) & SHF_ALLOC) {
+	sect_offset = (uint32_t *)malloc(be16toh(eh->e_shnum) * sizeof(uint32_t));
+	for (i = 0, l = 0; i < be16toh(eh->e_shnum); ++i) {
+		if (be32toh(sh[i].sh_flags) & SHF_ALLOC) {
 			dprintf(("vaddr 0x%04x size 0x%04x offset 0x%04x section %s\n",
-			l, htobe32(sh[i].sh_size), 

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: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.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c
cvs rdiff -u -r1.22 -r1.23 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 13:43:50 UTC 2022

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

Log Message:
u_intN_t --> uintN_t

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h
cvs rdiff -u -r1.21 -r1.22 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/chksum.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.5 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.6
--- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c:1.5	Sat Mar 14 15:36:01 2009
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c	Mon Apr 25 13:43:50 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: chksum.c,v 1.5 2009/03/14 15:36:01 dsl Exp $ */
+/* $NetBSD: chksum.c,v 1.6 2022/04/25 13:43:50 rin Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -39,10 +39,10 @@
 
 #include "chksum.h"
 
-u_int32_t
-chksum(u_int32_t *block, int size)
+uint32_t
+chksum(uint32_t *block, int size)
 {
-	u_int32_t sum, lastsum;
+	uint32_t sum, lastsum;
 	int i;
 
 	sum = 0;
@@ -58,17 +58,17 @@ chksum(u_int32_t *block, int size)
 }
 
 #ifdef TESTSUM
-u_int32_t myblock[8192];
+uint32_t myblock[8192];
 
 int
 main(int argc, char *argb[]) {
 	int bbsize;
-	u_int32_t cks, cks1;
+	uint32_t cks, cks1;
 
 	bbsize=atol(argb[1]);
-	bbsize *= (512 / sizeof (u_int32_t));
+	bbsize *= (512 / sizeof (uint32_t));
 
-	if (4*bbsize != read(0, myblock, sizeof(u_int32_t)*bbsize)) {
+	if (4*bbsize != read(0, myblock, sizeof(uint32_t)*bbsize)) {
 		fprintf(stderr, "short read\n");
 		exit(1);
 	}

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h:1.3 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h:1.4
--- src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h:1.3	Mon Apr 28 20:23:13 2008
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h	Mon Apr 25 13:43:50 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: chksum.h,v 1.3 2008/04/28 20:23:13 martin Exp $ */
+/* $NetBSD: chksum.h,v 1.4 2022/04/25 13:43:50 rin Exp $ */
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -31,5 +31,5 @@
 
 #define CHKSUMOFFS 1
 
-u_int32_t chksum(u_int32_t *, int);
+uint32_t chksum(uint32_t *, int);
 

Index: src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c
diff -u src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.21 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.22
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.21	Fri Feb 18 06:42:59 2022
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Mon Apr 25 13:43:50 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.21 2022/02/18 06:42:59 mlelstv Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.22 2022/04/25 13:43:50 rin Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -74,8 +74,8 @@ int debug;
 
 char *progname;
 int bbsize = BBSIZE;
-u_int8_t *buffer;
-u_int32_t *relbuf;
+uint8_t *buffer;
+uint32_t *relbuf;
 	/* can't have more relocs than that*/
 
 int
@@ -83,7 +83,7 @@ intcmp(const void *i, const void *j)
 {
 	int r;
 
-	r = (*(u_int32_t *)i) < (*(u_int32_t *)j);
+	r = (*(uint32_t *)i) < (*(uint32_t *)j);
 	
 	return 2*r-1;
 }
@@ -98,16 +98,16 @@ main(int argc, char *argv[])
 	char *shstrtab;
 	Elf32_Sym *symtab;
 	char *strtab;
-	int eval(Elf32_Sym *, u_int32_t *);
-	u_int32_t *lptr;
+	int eval(Elf32_Sym *, uint32_t *);
+	uint32_t *lptr;
 	int i, l, delta;
-	u_int8_t *rpo;
-	u_int32_t oldaddr, addrdiff;
-	u_int32_t tsz, dsz, bsz, trsz, relver;
-	u_int32_t pcrelsz, r32sz;
+	uint8_t *rpo;
+	uint32_t oldaddr, addrdiff;
+	uint32_t tsz, dsz, bsz, trsz, relver;
+	uint32_t pcrelsz, r32sz;
 	int sumsize = 16;
 	int c;
-	u_int32_t *sect_offset;
+	uint32_t *sect_offset;
 	int undefsyms;
 	uint32_t tmp32;
 	uint16_t tmp16;
@@ -163,7 +163,7 @@ main(int argc, char *argv[])
 	strtab = NULL;	/*XXX*/
 	dprintf(("name  type flagsaddr offset   size align\n"));
 	for (i = 0; i < htobe16(eh->e_shnum); ++i) {
-		u_int32_t sh_size;
+		uint32_t sh_size;
 
 		dprintf( ("%2d: %08x %-16s %08x %08x %08x %08x %08x %08x\n", i,
 		htobe32(sh[i].sh_name), shstrtab + htobe32(sh[i].sh_name),
@@ -244,7 +244,7 @@ retry:
 	memset(buffer, 0, bbsize);
 
 	/* Allocate and load loadable sections */
-	sect_offset = (u_int32_t *)malloc(htobe16(eh->e_shnum) * sizeof(u_int32_t));
+	sect_offset = (uint32_t *)malloc(htobe16(eh->e_shnum) * sizeof(uint32_t));
 	for (i = 0, l = 0; i < htobe16(eh->e_shnum); ++i) {
 		if (htobe32(sh[i].sh_flags) & SHF_ALLOC) {
 			dprintf(("vaddr 0x%04x size 0x%04x offset 0x%04x section %s\n",
@@ -264,7 +264,7 @@ retry:
 	 * relocator version. For now, check that the relocator at
 	 * the image 

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 13:43:50 UTC 2022

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

Log Message:
u_intN_t --> uintN_t

No binary changes.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amiga/stand/bootblock/elf2bb/chksum.h
cvs rdiff -u -r1.21 -r1.22 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-02-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb 18 06:43:00 UTC 2022

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

Log Message:
Don't crash when reporting an undefined symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.20 src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.21
--- src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c:1.20	Tue May 18 20:34:20 2021
+++ src/sys/arch/amiga/stand/bootblock/elf2bb/elf2bb.c	Fri Feb 18 06:42:59 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: elf2bb.c,v 1.20 2021/05/18 20:34:20 dholland Exp $	*/
+/*	$NetBSD: elf2bb.c,v 1.21 2022/02/18 06:42:59 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996,2006 The NetBSD Foundation, Inc.
@@ -325,7 +325,7 @@ retry:
 			s = [ELF32_R_SYM(htobe32(ra->r_info))];
 			if (s->st_shndx == ELF_SYM_UNDEFINED) {
 fprintf(stderr, "Undefined symbol: %s\n",
-strtab + s->st_name);
+strtab + htobe32(s->st_name));
 ++undefsyms;
 			}
 			value = htobe32(ra->r_addend) + eval(s, sect_offset);



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

2022-02-17 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Fri Feb 18 06:43:00 UTC 2022

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

Log Message:
Don't crash when reporting an undefined symbol.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 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.