Subject: Re: spontaneous reboot only once after power-up
To: None <port-dreamcast@netbsd.org, port-sh3@netbsd.org>
From: ITOH Yasufumi <itohy@netbsd.org>
List: port-dreamcast
Date: 11/03/2002 00:30:37
[ port-sh3 added ]

I wrote (see http://mail-index.netbsd.org/port-dreamcast/2002/10/29/0000.html
for full text):

(on SH4 (Dreamcast))
> However, I have a weird problem.
> The kernel reboot at the context switching (tsleep(), kthread_create1()),
> only once after power-up.
> Load the kernel again, and it works without problems.

This is a immediate reset without panic message,
and I suspect it is a "TLB multiple hit" exception.

I happen to try following change and the problem disappear.
Here, we are clearing the TLB.  The original code clears TLB
via address array, and new code does it via data array 1.

Why this change is effective?
Is this a correct change?
Is the true problem elsewhere?

I placed the kernels
before change:
	ftp://ftp.netbsd.org/pub/NetBSD/misc/itohy/dreamcast/netbsd.397.gz
after change:
	ftp://ftp.netbsd.org/pub/NetBSD/misc/itohy/dreamcast/netbsd.398.gz
Note this is one byte change (modulo change in version numbers).

Regards,
-- 
ITOH Yasufumi

Index: mmu_sh4.c
===================================================================
RCS file: /cvsroot/syssrc/sys/arch/sh3/sh3/mmu_sh4.c,v
retrieving revision 1.5
diff -p -u -r1.5 mmu_sh4.c
--- mmu_sh4.c	2002/05/09 12:27:04	1.5
+++ mmu_sh4.c	2002/11/02 14:23:37
@@ -127,7 +127,7 @@ sh4_tlb_invalidate_all()
 
 	RUN_P2;
 	for (e = 0; e < eend; e++) {
-		a = SH4_UTLB_AA | (e << SH4_UTLB_E_SHIFT);
+		a = SH4_UTLB_DA1 | (e << SH4_UTLB_E_SHIFT);
 		_reg_write_4(a, 0);
 	}
 	__sh4_itlb_invalidate_all();