CVS commit: src/sys/arch/zaurus/stand/zbsdmod

2019-10-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Oct 28 15:26:09 UTC 2019

Modified Files:
src/sys/arch/zaurus/stand/zbsdmod: compat_linux.h zbsdmod.c

Log Message:
Make sure to clear bss before jumping to a kernel copied from load buffer.

This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg72.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.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/zaurus/stand/zbsdmod

2019-10-28 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Oct 28 15:26:09 UTC 2019

Modified Files:
src/sys/arch/zaurus/stand/zbsdmod: compat_linux.h zbsdmod.c

Log Message:
Make sure to clear bss before jumping to a kernel copied from load buffer.

This will fix yet another boot failure issue
"screen white-out after loading a kernel"
 https://mail-index.netbsd.org/port-zaurus/2019/10/26/msg72.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.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/zaurus/stand/zbsdmod/compat_linux.h
diff -u src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6 src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.7
--- src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h:1.6	Sun Dec 11 14:05:39 2011
+++ src/sys/arch/zaurus/stand/zbsdmod/compat_linux.h	Mon Oct 28 15:26:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: compat_linux.h,v 1.6 2011/12/11 14:05:39 nonaka Exp $	*/
+/*	$NetBSD: compat_linux.h,v 1.7 2019/10/28 15:26:09 tsutsui Exp $	*/
 /*	$OpenBSD: compat_linux.h,v 1.5 2006/01/15 17:58:27 deraadt Exp $	*/
 
 /*
@@ -64,6 +64,7 @@ extern	int register_chrdev(unsigned int,
 extern	int unregister_chrdev(unsigned int, const char *);
 extern	void printk(const char *, ...) __printflike(1, 2);
 extern	void *memcpy(void *, const void *, size_t);
+extern	void *memset(void *, int, size_t);
 
 /* procfs support */
 struct proc_dir_entry {

Index: src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c
diff -u src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.10 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.11
--- src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.10	Sat Oct 26 09:58:40 2019
+++ src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c	Mon Oct 28 15:26:09 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zbsdmod.c,v 1.10 2019/10/26 09:58:40 tsutsui Exp $	*/
+/*	$NetBSD: zbsdmod.c,v 1.11 2019/10/28 15:26:09 tsutsui Exp $	*/
 /*	$OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $	*/
 
 /*
@@ -262,6 +262,10 @@ elf32bsdboot(void)
 (((char *)elf) + phdr[i].p_offset)[sz];
 			}
 		}
+		if (IS_BSS(phdr[i])) {
+			memset((void *)(phdr[i].p_vaddr + phdr[i].p_filesz), 0,
+			phdr[i].p_memsz - phdr[i].p_filesz);
+		}
 	}
 
 	addr = (int *)(elf->e_entry);



CVS commit: src/sys/arch/zaurus/stand/zbsdmod

2019-10-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 26 10:10:14 UTC 2019

Modified Files:
src/sys/arch/zaurus/stand/zbsdmod: Makefile

Log Message:
Misc cleanup to avoid future confusion.

- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/zaurus/stand/zbsdmod/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/zaurus/stand/zbsdmod

2019-10-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 26 10:10:14 UTC 2019

Modified Files:
src/sys/arch/zaurus/stand/zbsdmod: Makefile

Log Message:
Misc cleanup to avoid future confusion.

- Remove more unnecessary debug sections
- Use DBG instead of COPTS to specify -Os as defined in bsd.prog.mk
- Use CFLAGS and CPPFLAGS correctly
- Explicitly set -ffreestanding


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/zaurus/stand/zbsdmod/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/zaurus/stand/zbsdmod/Makefile
diff -u src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.11 src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.12
--- src/sys/arch/zaurus/stand/zbsdmod/Makefile:1.11	Mon Sep 23 13:42:37 2019
+++ src/sys/arch/zaurus/stand/zbsdmod/Makefile	Sat Oct 26 10:10:14 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2019/09/23 13:42:37 christos Exp $
+#	$NetBSD: Makefile,v 1.12 2019/10/26 10:10:14 tsutsui Exp $
 
 WARNS?=	4
 
@@ -10,8 +10,18 @@ OBJS=	zbsdmod.o
 SRCS=	zbsdmod.c
 NOMAN=	# defined
 
+OBJCOPY_FLAGS=			\
+	-R .debug_abbrev	\
+	-R .debug_aranges	\
+	-R .debug_info		\
+	-R .debug_line		\
+	-R .debug_loc		\
+	-R .debug_ranges	\
+	-R .debug_str		\
+	-R .eh_frame
+
 realall: ${OBJS}
-	${OBJCOPY} -R .eh_frame ${.OBJDIR}/zbsdmod.o
+	${OBJCOPY} ${OBJCOPY_FLAGS} ${.OBJDIR}/zbsdmod.o
 
 .include 
 .include 
@@ -21,11 +31,12 @@ afterinstall:
 		${OBJS} ${DESTDIR}/${BINDIR}
 
 CPUFLAGS=
-COPTS=		-Os
+DBG=		-Os
 CFLAGS+=	-fno-strict-aliasing
-CFLAGS+=	-DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
-CPPFLAGS+=	${ARM_APCS_FLAGS} -mcpu=xscale
-CPPFLAGS+=  -nostdinc -D_STANDALONE
+CFLAGS+=	-ffreestanding -nostdinc
+CFLAGS+=	${ARM_APCS_FLAGS} -mcpu=xscale
+CPPFLAGS+=	-DMACHINE=\"${MACHINE}\" -DUTS_RELEASE=\"2.4.20\"
+CPPFLAGS+=	-D_STANDALONE
 CPPFLAGS+=	-I${.OBJDIR} -I${S}
 
 release: check_RELEASEDIR



CVS commit: src/sys/arch/zaurus/stand/zbsdmod

2019-10-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 26 09:58:40 UTC 2019

Modified Files:
src/sys/arch/zaurus/stand/zbsdmod: zbsdmod.c

Log Message:
Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.
Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.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/zaurus/stand/zbsdmod/zbsdmod.c
diff -u src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.10
--- src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c:1.9	Mon Dec  2 18:36:11 2013
+++ src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c	Sat Oct 26 09:58:40 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: zbsdmod.c,v 1.9 2013/12/02 18:36:11 joerg Exp $	*/
+/*	$NetBSD: zbsdmod.c,v 1.10 2019/10/26 09:58:40 tsutsui Exp $	*/
 /*	$OpenBSD: zbsdmod.c,v 1.7 2005/05/02 02:45:29 uwe Exp $	*/
 
 /*
@@ -284,6 +284,13 @@ elf32bsdboot(void)
 		"mov	r1, r1;"
 		"sub	pc, pc, #4;"
 		"mov	r1, #(0x0010 | 0x0020);"
+		/*
+		 * Put the rest of instructions into the same cacheline
+		 * to make sure no I$ refill after invalidation.
+		 */
+		"b	2f;"
+		".align 5;"
+		"2:"
 		"mcr	p15, 0, r1, c1, c0, 0;" /* Write new control register */
 		"mcr	p15, 0, r1, c8, c7, 0;" /* invalidate I+D TLB */
 		"mcr	p15, 0, r1, c7, c5, 0;" /* invalidate I$ and BTB */



CVS commit: src/sys/arch/zaurus/stand/zbsdmod

2019-10-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 26 09:58:40 UTC 2019

Modified Files:
src/sys/arch/zaurus/stand/zbsdmod: zbsdmod.c

Log Message:
Fix another boot failure issue of NetBSD/zaurus 8.x and later.

It looks some cacheline alignment restriction so that zbsdmod.o in
NetBSD/zaurus 8.x release cannot jump to a loaded kernel properly.
Adding an explicit alingment pseudo op to put all instructions
between I-cache flush and jumping to the loaded kernel into the
same cacheline solves the issue.

See my post in port-zaurus@ for details:
 https://mail-index.netbsd.org/port-zaurus/2019/10/22/msg69.html

Should be pulled up to netbsd-8 and netbsd-9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/zaurus/stand/zbsdmod/zbsdmod.c

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