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/msg000069.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, #(0x00000010 | 0x00000020);"
+		/*
+		 * 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 */

Reply via email to