Subject: Re: kloader in current
To: None <uwe@ptc.spbu.ru>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-hpcmips
Date: 03/20/2004 01:33:54
In article <20040319153729.GE6158@snark.ptc.spbu.ru>
uwe@ptc.spbu.ru wrote:

> I'd like to hear if kloader in current works/doesn't work for you.  I
> remember a short period of time that it worked for me on hpcsh, but
> it's been dying with "TLB miss" for more than an year now.

I use kloader on my dreamcast and it still works fine.
I also use the attached patch since I thought -fstrict-aliasing
optimization introduced on gcc3 might cause problems,
but I have not confirmed yet if it really solves the problem.
---
Izumi Tsutsui
tsutsui@ceres.dti.ne.jp

Index: kloader.c
===================================================================
RCS file: /cvsroot/src/sys/arch/dreamcast/dreamcast/kloader.c,v
retrieving revision 1.2
diff -u -r1.2 kloader.c
--- kloader.c	15 Jul 2003 01:31:41 -0000	1.2
+++ kloader.c	19 Mar 2004 16:24:47 -0000
@@ -263,7 +263,7 @@
 
 	pg = TAILQ_PREV(kloader.cur_pg, pglist, pageq);
 	
-	((struct kloader_page_tag *)PG_VADDR(pg))->next = 0;
+	((struct kloader_page_tag *)(void *)PG_VADDR(pg))->next = 0;
 }
 
 void
@@ -340,7 +340,7 @@
 void
 kloader_boot(u_int32_t entry, struct kloader_page_tag *p)
 {
-	int tmp;
+	int tmp = 0;	/* XXX: gcc */
 
 	/* Disable interrupt. block exception. */
 	__asm__ __volatile__(
@@ -352,12 +352,12 @@
 	SH4_TLB_DISABLE;
 
 	do {
-		u_int32_t *dst =(u_int32_t *)p->dst;
-		u_int32_t *src =(u_int32_t *)p->src;
+		u_int32_t *dst =(u_int32_t *)(void *)p->dst;
+		u_int32_t *src =(u_int32_t *)(void *)p->src;
 		u_int32_t sz = p->sz / sizeof (int);
 		while (sz--)
 			*dst++ = *src++;
-	} while ((p = (struct kloader_page_tag *)p->next) != 0);
+	} while ((p = (struct kloader_page_tag *)(void *)p->next) != 0);
 
 	SH7750_CACHE_FLUSH();
 
@@ -387,7 +387,7 @@
 		}
 		op = p;
 		i++;
-	} while ((p = (struct kloader_page_tag *)(p->next)) != 0);
+	} while ((p = (struct kloader_page_tag *)(void *)(p->next)) != 0);
   
 	DPRINTF("[%d(last)] next 0x%08x src 0x%08x dst 0x%08x sz 0x%x\n",
 	    i - 1, op->next, op->src, op->dst, op->sz);