CVS commit: src/sys/arch/news68k/news68k

2021-08-05 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Aug  6 05:53:50 UTC 2021

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
Fix mm_md_physacc() to allow only accesses to a region of RAMs.

Note on NetBSD/news68k RAMs reserved by the PROM (at the end of the RAM)
are not managed.


To generate a diff of this commit:
cvs rdiff -u -r1.108 -r1.109 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.108 src/sys/arch/news68k/news68k/machdep.c:1.109
--- src/sys/arch/news68k/news68k/machdep.c:1.108	Thu Jun 11 19:20:44 2020
+++ src/sys/arch/news68k/news68k/machdep.c	Fri Aug  6 05:53:50 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.108 2020/06/11 19:20:44 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.109 2021/08/06 05:53:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.108 2020/06/11 19:20:44 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.109 2021/08/06 05:53:50 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -992,8 +992,17 @@ consinit(void)
 int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
+	paddr_t memend;
 
-	return (pa < lowram || pa >= 0xfffc) ? EFAULT : 0;
+	/*
+	 * news68k has one contiguous memory segment.
+	 */
+	memend = lowram + ctob(physmem);
+
+	if (lowram <= pa && pa < memend) 
+		return 0;
+
+	return EFAULT;
 }
 
 int



CVS commit: src/sys/arch/news68k/news68k

2021-01-23 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 23 15:00:33 UTC 2021

Modified Files:
src/sys/arch/news68k/news68k: locore.s

Log Message:
Remove leftover of #undef statements.

These should have been removed in rev 1.55 back in 2010:
 https://mail-index.netbsd.org/source-changes/2010/12/20/msg016105.html
 
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/news68k/news68k/locore.s.diff?r1=1.54=1.55


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/news68k/news68k/locore.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/news68k/news68k/locore.s
diff -u src/sys/arch/news68k/news68k/locore.s:1.66 src/sys/arch/news68k/news68k/locore.s:1.67
--- src/sys/arch/news68k/news68k/locore.s:1.66	Wed Dec 19 13:57:49 2018
+++ src/sys/arch/news68k/news68k/locore.s	Sat Jan 23 15:00:33 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.66 2018/12/19 13:57:49 maxv Exp $	*/
+/*	$NetBSD: locore.s,v 1.67 2021/01/23 15:00:33 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -808,9 +808,6 @@ ENTRY_NOPROFILE(intrhand_vectored)
 	subql	#1,_C_LABEL(idepth)
 	rte
 
-#undef INTERRUPT_SAVEREG
-#undef INTERRUPT_RESTOREREG
-
 /*
  * Emulation of VAX REI instruction.
  *



CVS commit: src/sys/arch/news68k/news68k

2020-11-21 Thread Jason R Thorpe
Module Name:src
Committed By:   thorpej
Date:   Sat Nov 21 17:55:38 UTC 2020

Modified Files:
src/sys/arch/news68k/news68k: isr.c

Log Message:
malloc(9) -> kmem(9)


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/news68k/news68k/isr.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/news68k/news68k/isr.c
diff -u src/sys/arch/news68k/news68k/isr.c:1.22 src/sys/arch/news68k/news68k/isr.c:1.23
--- src/sys/arch/news68k/news68k/isr.c:1.22	Sun Nov 10 21:16:30 2019
+++ src/sys/arch/news68k/news68k/isr.c	Sat Nov 21 17:55:38 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: isr.c,v 1.22 2019/11/10 21:16:30 chs Exp $	*/
+/*	$NetBSD: isr.c,v 1.23 2020/11/21 17:55:38 thorpej Exp $	*/
 
 /*-
  * Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -39,11 +39,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.22 2019/11/10 21:16:30 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isr.c,v 1.23 2020/11/21 17:55:38 thorpej Exp $");
 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 
@@ -82,7 +82,7 @@ isrlink_autovec(int (*func)(void *), voi
 	if ((ipl < 0) || (ipl >= NISRAUTOVEC))
 		panic("isrlink_autovec: bad ipl %d", ipl);
 
-	newisr = malloc(sizeof(struct isr_autovec), M_DEVBUF, M_WAITOK);
+	newisr = kmem_alloc(sizeof(*newisr), KM_SLEEP);
 	newisr->isr_func = func;
 	newisr->isr_arg = arg;
 	newisr->isr_ipl = ipl;



CVS commit: src/sys/arch/news68k/news68k

2020-02-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Mon Feb  3 23:09:04 UTC 2020

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
Add a missing semicolon missed in rev 1.27.

Noticed by recent pmap_update() macro change.
I wonder how I've missed this for 18 years..


To generate a diff of this commit:
cvs rdiff -u -r1.106 -r1.107 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.106 src/sys/arch/news68k/news68k/machdep.c:1.107
--- src/sys/arch/news68k/news68k/machdep.c:1.106	Tue Dec 31 13:07:11 2019
+++ src/sys/arch/news68k/news68k/machdep.c	Mon Feb  3 23:09:03 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.106 2019/12/31 13:07:11 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.107 2020/02/03 23:09:03 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.106 2019/12/31 13:07:11 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.107 2020/02/03 23:09:03 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -189,7 +189,7 @@ news68k_init(void)
 	 */
 	for (i = 0; i < btoc(MSGBUFSIZE); i++)
 		pmap_kenter_pa((vaddr_t)msgbufaddr + i * PAGE_SIZE,
-		avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, 0)
+		avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE, 0);
 	pmap_update(pmap_kernel());
 	initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE));
 }



CVS commit: src/sys/arch/news68k/news68k

2017-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 15 03:11:15 UTC 2017

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
pass the right argument


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.102 src/sys/arch/news68k/news68k/machdep.c:1.103
--- src/sys/arch/news68k/news68k/machdep.c:1.102	Thu Sep 14 23:10:07 2017
+++ src/sys/arch/news68k/news68k/machdep.c	Thu Sep 14 23:11:15 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.102 2017/09/15 03:10:07 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.103 2017/09/15 03:11:15 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102 2017/09/15 03:10:07 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.103 2017/09/15 03:11:15 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -693,12 +693,12 @@ cpu_exec_aout_makecmds(struct lwp *l, st
 	switch (midmag) {
 #ifdef COMPAT_NOMID
 	case (MID_ZERO << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
+		error = exec_aout_prep_oldzmagic(l, epp);
 		return(error);
 #endif
 #ifdef COMPAT_44
 	case (MID_HP300 << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
+		error = exec_aout_prep_oldzmagic(l, epp);
 		return error;
 #endif
 	}



CVS commit: src/sys/arch/news68k/news68k

2017-09-14 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 15 03:10:08 UTC 2017

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
make this compile


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.101 src/sys/arch/news68k/news68k/machdep.c:1.102
--- src/sys/arch/news68k/news68k/machdep.c:1.101	Mon Mar 24 15:54:28 2014
+++ src/sys/arch/news68k/news68k/machdep.c	Thu Sep 14 23:10:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.101 2014/03/24 19:54:28 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.102 2017/09/15 03:10:07 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.101 2014/03/24 19:54:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.102 2017/09/15 03:10:07 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_compat_netbsd.h"
@@ -698,7 +698,7 @@ cpu_exec_aout_makecmds(struct lwp *l, st
 #endif
 #ifdef COMPAT_44
 	case (MID_HP300 << 16) | ZMAGIC:
-		error = exec_aout_prep_oldzmagic(p, epp);
+		error = exec_aout_prep_oldzmagic(l->l_proc, epp);
 		return error;
 #endif
 	}



CVS commit: src/sys/arch/news68k/news68k

2014-09-21 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Sep 21 16:34:53 UTC 2014

Modified Files:
src/sys/arch/news68k/news68k: bus_space.c

Log Message:
this is not python (add missing braces)


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/news68k/news68k/bus_space.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/news68k/news68k/bus_space.c
diff -u src/sys/arch/news68k/news68k/bus_space.c:1.12 src/sys/arch/news68k/news68k/bus_space.c:1.13
--- src/sys/arch/news68k/news68k/bus_space.c:1.12	Mon Mar 24 15:54:28 2014
+++ src/sys/arch/news68k/news68k/bus_space.c	Sun Sep 21 12:34:53 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.12 2014/03/24 19:54:28 christos Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.13 2014/09/21 16:34:53 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.12 2014/03/24 19:54:28 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.13 2014/09/21 16:34:53 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -61,9 +61,10 @@ bus_space_map(bus_space_tag_t t, bus_add
 		return 0;
 	}
 
-	if (t == NEWS68K_BUS_SPACE_EIO)
+	if (t == NEWS68K_BUS_SPACE_EIO) {
 		*bshp = (bus_space_handle_t)bpa; /* XXX use tt0 mapping */
 		return 0;
+	}
 
 	return 1;
 }



CVS commit: src/sys/arch/news68k/news68k

2014-03-24 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Mar 24 19:54:28 UTC 2014

Modified Files:
src/sys/arch/news68k/news68k: autoconf.c bus_space.c machdep.c

Log Message:
- use cpu_{g,s}etmodel
- fix unused


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/news68k/news68k/autoconf.c
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/news68k/news68k/bus_space.c
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/autoconf.c
diff -u src/sys/arch/news68k/news68k/autoconf.c:1.22 src/sys/arch/news68k/news68k/autoconf.c:1.23
--- src/sys/arch/news68k/news68k/autoconf.c:1.22	Sat Oct 13 02:18:44 2012
+++ src/sys/arch/news68k/news68k/autoconf.c	Mon Mar 24 15:54:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.22 2012/10/13 06:18:44 tsutsui Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.23 2014/03/24 19:54:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,7 +51,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.22 2012/10/13 06:18:44 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.23 2014/03/24 19:54:28 christos Exp $);
 
 #include scsibus.h
 
@@ -124,14 +124,13 @@ void
 findroot(void)
 {
 #if NSCSIBUS  0
-	int ctlr, unit, part, type;
+	int ctlr, part, type;
 	device_t dv;
 
 	if (BOOTDEV_MAG(bootdev) != 5)	/* NEWS-OS's B_DEVMAGIC */
 		return;
 
 	ctlr = BOOTDEV_CTLR(bootdev);	/* SCSI ID */
-	unit = BOOTDEV_UNIT(bootdev);
 	part = BOOTDEV_PART(bootdev);	/* LUN */
 	type = BOOTDEV_TYPE(bootdev);
 

Index: src/sys/arch/news68k/news68k/bus_space.c
diff -u src/sys/arch/news68k/news68k/bus_space.c:1.11 src/sys/arch/news68k/news68k/bus_space.c:1.12
--- src/sys/arch/news68k/news68k/bus_space.c:1.11	Tue Nov 22 09:31:02 2011
+++ src/sys/arch/news68k/news68k/bus_space.c	Mon Mar 24 15:54:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.11 2011/11/22 14:31:02 tsutsui Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.12 2014/03/24 19:54:28 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.11 2011/11/22 14:31:02 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.12 2014/03/24 19:54:28 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -151,7 +151,7 @@ news68k_bus_space_probe(bus_space_tag_t 
 		panic(bus_space_probe: unupported data size %d, sz);
 		/* NOTREACHED */
 	}
-
+	__USE(i);
 	nofault = NULL;
 	return 1;
 }

Index: src/sys/arch/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.100 src/sys/arch/news68k/news68k/machdep.c:1.101
--- src/sys/arch/news68k/news68k/machdep.c:1.100	Fri Aug 10 08:17:51 2012
+++ src/sys/arch/news68k/news68k/machdep.c	Mon Mar 24 15:54:28 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.100 2012/08/10 12:17:51 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.101 2014/03/24 19:54:28 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.100 2012/08/10 12:17:51 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.101 2014/03/24 19:54:28 christos Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -64,6 +64,7 @@ __KERNEL_RCSID(0, $NetBSD: machdep.c,v 
 #include sys/kcore.h
 #include sys/ksyms.h
 #include sys/module.h
+#include sys/cpu.h
 
 #ifdef DDB
 #include machine/db_machdep.h
@@ -245,18 +246,13 @@ cpu_startup(void)
 	initcpu();
 }
 
-/*
- * Info for CTL_HW
- */
-char cpu_model[124];
-
 int news_machine_id;
 
 static void
 identifycpu(void)
 {
 
-	printf(SONY NET WORK STATION, Model %s, , cpu_model);
+	printf(SONY NET WORK STATION, Model %s, , cpu_getmodel());
 	printf(Machine ID #%d\n, news_machine_id);
 
 	delay_divisor = (20480 / cpuspeed + 5) / 10; /* XXX */
@@ -645,6 +641,7 @@ badaddr(void *addr, int nbytes)
 	default:
 		panic(badaddr: bad request);
 	}
+	__USE(i);
 	nofault = (int *) 0;
 	return 0;
 }
@@ -661,6 +658,7 @@ badbaddr(void *addr)
 		return 1;
 	}
 	i = *(volatile char *)addr;
+	__USE(i);
 	nofault = (int *) 0;
 	return 0;
 }
@@ -808,7 +806,7 @@ news1700_init(void)
 	if (t == NULL)
 		panic(unexpected system model.);
 
-	strcat(cpu_model, t);
+	cpu_setmodel(%s, t);
 	news_machine_id = (idrom.id_serial[0]  8) + idrom.id_serial[1];
 
 	ctrl_parity	= (uint8_t *)(0xe108);
@@ -890,7 +888,7 @@ news1200_init(void)
 	for (i = 0; i  sizeof(idrom); i++, p += 2)
 		*q++ = ((*p  0x0f)  4) | (*(p + 1)  0x0f);
 
-	strcat(cpu_model, idrom.id_model);
+	cpu_setmodel(%s, idrom.id_model);
 	news_machine_id = idrom.id_serial;
 
 	cpuspeed = 25;



CVS commit: src/sys/arch/news68k/news68k

2014-03-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 15 09:24:56 UTC 2014

Modified Files:
src/sys/arch/news68k/news68k: locore.s

Log Message:
Use common m68k/busaddrerr.s for bus error and address error handlers.

No binary changes on GENERIC, and also tested on NWS-1750.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/news68k/news68k/locore.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/news68k/news68k/locore.s
diff -u src/sys/arch/news68k/news68k/locore.s:1.64 src/sys/arch/news68k/news68k/locore.s:1.65
--- src/sys/arch/news68k/news68k/locore.s:1.64	Sun Mar  9 16:18:00 2014
+++ src/sys/arch/news68k/news68k/locore.s	Sat Mar 15 09:24:56 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.64 2014/03/09 16:18:00 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.65 2014/03/15 09:24:56 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -479,100 +479,10 @@ Lenab3:
  */
 #include m68k/m68k/trap_subr.s
 
-#if defined(M68020) || defined(M68030)
-ENTRY_NOPROFILE(busaddrerr2030)
-	clrl	%sp@-			| stack adjust count
-	moveml	#0x,%sp@-		| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	moveq	#0,%d0
-	movw	%sp@(FR_HW+10),%d0	| grab SSW for fault processing
-	btst	#12,%d0			| RB set?
-	jeq	LbeX0			| no, test RC
-	bset	#14,%d0			| yes, must set FB
-	movw	%d0,%sp@(FR_HW+10)	| for hardware too
-LbeX0:
-	btst	#13,%d0			| RC set?
-	jeq	LbeX1			| no, skip
-	bset	#15,%d0			| yes, must set FC
-	movw	%d0,%sp@(FR_HW+10)	| for hardware too
-LbeX1:
-	btst	#8,%d0			| data fault?
-	jeq	Lbe0			| no, check for hard cases
-	movl	%sp@(FR_HW+16),%d1	| fault address is as given in frame
-	jra	Lbe10			| thats it
-Lbe0:
-	btst	#4,%sp@(FR_HW+6)	| long (type B) stack frame?
-	jne	Lbe4			| yes, go handle
-	movl	%sp@(FR_HW+2),%d1	| no, can use save PC
-	btst	#14,%d0			| FB set?
-	jeq	Lbe3			| no, try FC
-	addql	#4,%d1			| yes, adjust address
-	jra	Lbe10			| done
-Lbe3:
-	btst	#15,%d0			| FC set?
-	jeq	Lbe10			| no, done
-	addql	#2,%d1			| yes, adjust address
-	jra	Lbe10			| done
-Lbe4:
-	movl	%sp@(FR_HW+36),%d1	| long format, use stage B address
-	btst	#15,%d0			| FC set?
-	jeq	Lbe10			| no, all done
-	subql	#2,%d1			| yes, adjust address
-Lbe10:
-	movl	%d1,%sp@-		| push fault VA
-	movl	%d0,%sp@-		| and padded SSW
-	movw	%sp@(FR_HW+8+6),%d0	| get frame format/vector offset
-	andw	#0x0FFF,%d0		| clear out frame format
-	cmpw	#12,%d0			| address error vector?
-	jeq	Lisaerr			| yes, go to it
-	movl	%d1,%a0			| fault address
-	movl	%sp@,%d0		| function code from ssw
-	btst	#8,%d0			| data fault?
-	jne	Lbe10a
-#if 0
-	movql	#1,%d0			| user program access FC
-#else
-	moveq	#1,%d0			| user program access FC
-#endif
-	| (we dont separate data/program)
-	btst	#5,%sp@(FR_HW+8)	| supervisor mode?
-	jeq	Lbe10a			| if no, done
-	movql	#5,%d0			| else supervisor program access
-Lbe10a:
-	ptestr	%d0,%a0@,#7		| do a table search
-	pmove	%psr,%sp@		| save result
-	movb	%sp@,%d1
-	btst	#2,%d1			| invalid (incl. limit viol. and berr)?
-	jeq	Lmightnotbemerr		| no - wp check
-	btst	#7,%d1			| is it MMU table berr?
-	jne	Lisberr1		| yes, needs not be fast.
-Lismerr:
-	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-Lmightnotbemerr:
-	btst	#3,%d1			| write protect bit set?
-	jeq	Lisberr1		| no: must be bus error
-	movl	%sp@,%d0		| ssw into low word of %d0
-	andw	#0xc0,%d0		| Write protect is set on page:
-	cmpw	#0x40,%d0		| was it read cycle?
-	jne	Lismerr			| no, was not WPE, must be MMU fault
-	jra	Lisberr1		| real bus err needs not be fast.
-Lisaerr:
-	movl	#T_ADDRERR,%sp@-	| mark address error
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-Lisberr1:
-	clrw	%sp@			| re-clear pad word
-	tstl	_C_LABEL(nofault)	| catch bus error?
-	jeq	Lisberr			| no, handle as usual
-	movl	_C_LABEL(nofault),%sp@-	| yes,
-	jbsr	_C_LABEL(longjmp)	|  longjmp(nofault)
-	/* NOTREACHED */
-#endif /* M68020 || M68030 */
-
-Lisberr:| also used by M68040/60
-	movl	#T_BUSERR,%sp@-		| mark bus error
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
+/*
+ * Use common m68k bus error and address error handlers.
+ */
+#include m68k/m68k/busaddrerr.s
 
 /*
  * FP exceptions.



CVS commit: src/sys/arch/news68k/news68k

2012-10-13 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Oct 13 06:18:44 UTC 2012

Modified Files:
src/sys/arch/news68k/news68k: autoconf.c

Log Message:
use device_xname()  (from chs@)


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/news68k/news68k/autoconf.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/news68k/news68k/autoconf.c
diff -u src/sys/arch/news68k/news68k/autoconf.c:1.21 src/sys/arch/news68k/news68k/autoconf.c:1.22
--- src/sys/arch/news68k/news68k/autoconf.c:1.21	Sun Jul 29 18:05:45 2012
+++ src/sys/arch/news68k/news68k/autoconf.c	Sat Oct 13 06:18:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.21 2012/07/29 18:05:45 mlelstv Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.22 2012/10/13 06:18:44 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,7 +51,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.21 2012/07/29 18:05:45 mlelstv Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.22 2012/10/13 06:18:44 tsutsui Exp $);
 
 #include scsibus.h
 
@@ -110,7 +110,7 @@ cpu_rootconf(void)
 	findroot();
 
 	printf(boot device: %s\n,
-	   booted_device ? booted_device-dv_xname : unknown);
+	   booted_device ? device_xname(booted_device) : unknown);
 
 	rootconf();
 }



CVS commit: src/sys/arch/news68k/news68k

2012-08-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Aug 10 12:17:51 UTC 2012

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
Appease gcc -fno-common:
 - remove initialzation of physmem since it's properly initialized
   before pmap_bootstrap() using a value passed from bootloader and
   sanity possible maximum value is not necessary
 - remove cn_tab = NULL initialization because no worth to patch it
Tested on NWS-1750.


To generate a diff of this commit:
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.99 src/sys/arch/news68k/news68k/machdep.c:1.100
--- src/sys/arch/news68k/news68k/machdep.c:1.99	Fri Jul 27 05:36:11 2012
+++ src/sys/arch/news68k/news68k/machdep.c	Fri Aug 10 12:17:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.99 2012/07/27 05:36:11 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.100 2012/08/10 12:17:51 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.99 2012/07/27 05:36:11 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.100 2012/08/10 12:17:51 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -111,7 +111,6 @@ struct cpu_info cpu_info_store;
 struct vm_map *phys_map = NULL;
 
 int	maxmem;			/* max memory per process */
-int	physmem = MAXMEM;	/* max supported memory, changes to actual */
 
 extern paddr_t avail_start, avail_end;
 extern int end, *esym;
@@ -968,7 +967,6 @@ intrhand_lev4(void)
 #define SW_FBPOP2	0x03
 #define SW_AUTOSEL	0x07
 
-struct consdev *cn_tab = NULL;
 extern struct consdev consdev_rom, consdev_zs;
 
 int tty00_is_console = 0;



CVS commit: src/sys/arch/news68k/news68k

2011-11-03 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Nov  3 14:56:39 UTC 2011

Modified Files:
src/sys/arch/news68k/news68k: locore.s

Log Message:
unifdef __ELF__


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/arch/news68k/news68k/locore.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/news68k/news68k/locore.s
diff -u src/sys/arch/news68k/news68k/locore.s:1.56 src/sys/arch/news68k/news68k/locore.s:1.57
--- src/sys/arch/news68k/news68k/locore.s:1.56	Tue Feb  8 20:20:21 2011
+++ src/sys/arch/news68k/news68k/locore.s	Thu Nov  3 14:56:39 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.56 2011/02/08 20:20:21 rmind Exp $	*/
+/*	$NetBSD: locore.s,v 1.57 2011/11/03 14:56:39 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -1056,11 +1056,7 @@ ENTRY_NOPROFILE(_delay)
 	 * operations and that the loop will run from a single cache
 	 * half-line.
 	 */
-#ifdef __ELF__
 	.align  8
-#else
-	.align	3
-#endif
 L_delay:
 	subl	%d1,%d0
 	jgt	L_delay



CVS commit: src/sys/arch/news68k/news68k

2011-05-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May 10 14:41:55 UTC 2011

Modified Files:
src/sys/arch/news68k/news68k: autoconf.c machdep.c

Log Message:
Move isrinit() call from early news68k_init() to cpu_configure(9)
since interrupt service routines would want evcnt(9).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/news68k/news68k/autoconf.c
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/autoconf.c
diff -u src/sys/arch/news68k/news68k/autoconf.c:1.19 src/sys/arch/news68k/news68k/autoconf.c:1.20
--- src/sys/arch/news68k/news68k/autoconf.c:1.19	Tue Feb  8 20:20:20 2011
+++ src/sys/arch/news68k/news68k/autoconf.c	Tue May 10 14:41:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.19 2011/02/08 20:20:20 rmind Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.20 2011/05/10 14:41:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -51,7 +51,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.19 2011/02/08 20:20:20 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: autoconf.c,v 1.20 2011/05/10 14:41:55 tsutsui Exp $);
 
 #include scsibus.h
 
@@ -68,6 +68,8 @@
 #include machine/romcall.h
 #include machine/autoconf.h
 
+#include news68k/news68k/isr.h
+
 /*
  * The following several variables are related to
  * the configuration process, and are used in initializing
@@ -91,6 +93,9 @@
 	 */
 	(void) splhigh();
 
+	/* Initialize the interrupt handlers. */
+	isrinit();
+
 	if (config_rootfound(mainbus, NULL) == NULL)
 		panic(autoconfig failed, no root);
 

Index: src/sys/arch/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.91 src/sys/arch/news68k/news68k/machdep.c:1.92
--- src/sys/arch/news68k/news68k/machdep.c:1.91	Sun Mar  6 14:54:47 2011
+++ src/sys/arch/news68k/news68k/machdep.c	Tue May 10 14:41:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.91 2011/03/06 14:54:47 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.92 2011/05/10 14:41:55 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.91 2011/03/06 14:54:47 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.92 2011/05/10 14:41:55 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -186,8 +186,6 @@
 		panic(impossible system type);
 	}
 
-	isrinit();
-
 	/*
 	 * Initialize error message buffer (at end of core).
 	 * avail_end was pre-decremented in pmap_bootstrap to compensate.



CVS commit: src/sys/arch/news68k/news68k

2011-01-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan  2 05:01:57 UTC 2011

Modified Files:
src/sys/arch/news68k/news68k: pmap_bootstrap.c

Log Message:
Pull code that maps the kernel segment table cache invalidated for 040/060,
to reduce diffs from other m68k ports.
(though news68k doesn't have 040/060 models)


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/news68k/news68k/pmap_bootstrap.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/news68k/news68k/pmap_bootstrap.c
diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.32 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.33
--- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.32	Sun Jun  6 04:50:07 2010
+++ src/sys/arch/news68k/news68k/pmap_bootstrap.c	Sun Jan  2 05:01:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.32 2010/06/06 04:50:07 mrg Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.33 2011/01/02 05:01:57 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.32 2010/06/06 04:50:07 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.33 2011/01/02 05:01:57 tsutsui Exp $);
 
 #include sys/param.h
 
@@ -343,11 +343,11 @@
 	}
 	/*
 	 * Validate PTEs for kernel data/bss, dynamic data allocated
-	 * by us so far (nextpa - firstpa bytes), and pages for lwp0
+	 * by us so far (kstpa - firstpa bytes), and pages for lwp0
 	 * u-area and page table allocated below (RW).
 	 */
 	epte = (pt_entry_t *)kptpa;
-	epte = epte[m68k_btop(nextpa - firstpa)];
+	epte = epte[m68k_btop(kstpa - firstpa)];
 	protopte = (protopte  ~PG_PROT) | PG_RW;
 	/*
 	 * Enable copy-back caching of data pages
@@ -361,6 +361,25 @@
 		protopte += PAGE_SIZE;
 	}
 	/*
+	 * map the kernel segment table cache invalidated for
+	 * these machines (for the 68040 not strictly necessary, but
+	 * recommended by Motorola; for the 68060 mandatory)
+	 */
+	epte = (pt_entry_t *)kptpa;
+	epte = epte[m68k_btop(nextpa - firstpa)];
+	protopte = (protopte  ~PG_PROT) | PG_RW;
+#ifdef M68040
+	if (RELOC(mmutype, int) == MMU_68040) {
+		protopte = ~PG_CCB;
+		protopte |= PG_CIN;
+	}
+#endif
+	while (pte  epte) {
+		*pte++ = protopte;
+		protopte += PAGE_SIZE;
+	}
+
+	/*
 	 * Finally, validate the internal IO space PTEs (RW+CI).
 	 */
 



CVS commit: src/sys/arch/news68k/news68k

2011-01-01 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Jan  2 05:09:28 UTC 2011

Modified Files:
src/sys/arch/news68k/news68k: pmap_bootstrap.c

Log Message:
Remove disabled code for VAC.  No such news68k models.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/news68k/news68k/pmap_bootstrap.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/news68k/news68k/pmap_bootstrap.c
diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.33 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.34
--- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.33	Sun Jan  2 05:01:57 2011
+++ src/sys/arch/news68k/news68k/pmap_bootstrap.c	Sun Jan  2 05:09:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.33 2011/01/02 05:01:57 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.34 2011/01/02 05:09:27 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@
 #include opt_m68k_arch.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.33 2011/01/02 05:01:57 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.34 2011/01/02 05:09:27 tsutsui Exp $);
 
 #include sys/param.h
 
@@ -58,9 +58,6 @@
 
 extern int maxmem, physmem;
 extern paddr_t avail_start, avail_end;
-#if 0
-extern int pmap_aliasmask;
-#endif
 
 void pmap_bootstrap(paddr_t, paddr_t);
 
@@ -439,16 +436,6 @@
 
 	RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;
 
-#if 0
-	/*
-	 * Determine VA aliasing distance if any
-	 *
-	 * XXX Are there any models which have VAC?
-	 */
-	if (RELOC(ectype, int) == EC_VIRT) {
-		RELOC(pmap_aliasmask, int) = 0x3fff;	/* 16k */
-	}
-#endif
 #ifdef news1700
 	if (RELOC(systype, int) == NEWS1700) {
 		RELOC(cache_ctl, uint8_t *) = 0xe130 - INTIOBASE1700 +



CVS commit: src/sys/arch/news68k/news68k

2010-10-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Oct 14 16:31:16 UTC 2010

Modified Files:
src/sys/arch/news68k/news68k: machdep.c

Log Message:
Prepare empty module_init_md() for options MODULAR.


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/arch/news68k/news68k/machdep.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/news68k/news68k/machdep.c
diff -u src/sys/arch/news68k/news68k/machdep.c:1.85 src/sys/arch/news68k/news68k/machdep.c:1.86
--- src/sys/arch/news68k/news68k/machdep.c:1.85	Mon Feb  8 19:02:30 2010
+++ src/sys/arch/news68k/news68k/machdep.c	Thu Oct 14 16:31:16 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.85 2010/02/08 19:02:30 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.86 2010/10/14 16:31:16 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1990, 1993
@@ -77,7 +77,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.85 2010/02/08 19:02:30 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.86 2010/10/14 16:31:16 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_compat_netbsd.h
@@ -101,6 +101,7 @@
 #include sys/core.h
 #include sys/kcore.h
 #include sys/ksyms.h
+#include sys/module.h
 
 #ifdef DDB
 #include machine/db_machdep.h
@@ -1081,3 +1082,13 @@
 		Debugger();
 #endif
 }
+
+#ifdef MODULAR
+/*
+ * Push any modules loaded by the bootloader etc.
+ */
+void
+module_init_md(void)
+{
+}
+#endif



CVS commit: src/sys/arch/news68k/news68k

2009-12-12 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 12 09:54:42 UTC 2009

Modified Files:
src/sys/arch/news68k/news68k: locore.s

Log Message:
Allow NetBSD/news68k kernel work with PGSHIFT==13, i.e. 8KB/page.
Tested on NWS-1750 with 68030.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/news68k/news68k/locore.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/news68k/news68k/locore.s
diff -u src/sys/arch/news68k/news68k/locore.s:1.50 src/sys/arch/news68k/news68k/locore.s:1.51
--- src/sys/arch/news68k/news68k/locore.s:1.50	Fri Dec 11 18:28:35 2009
+++ src/sys/arch/news68k/news68k/locore.s	Sat Dec 12 09:54:42 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.50 2009/12/11 18:28:35 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.51 2009/12/12 09:54:42 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -423,7 +423,11 @@
 	.long	0x4e7b0007		| movc %d0,%dtt1
 	.word	0xf4d8			| cinva bc
 	.word	0xf518			| pflusha
+#if PGSHIFT == 13
+	movl	#0xc000,%d0
+#else
 	movl	#0x8000,%d0
+#endif
 	.long	0x4e7b0003		| movc %d0,%tc
 	movl	#CACHE40_ON,%d0
 	movc	%d0,%cacr		| turn on both caches
@@ -435,7 +439,11 @@
 	.long	0xf0100800		| pmove %a0@,%tt0
 #endif
 	RELOC(prototc, %a2)
+#if PGSHIFT == 13
+	movl	#0x82d08b00,%a2@	| value to load TC with
+#else
 	movl	#0x82c0aa00,%a2@	| value to load TC with
+#endif
 	pmove	%a2@,%tc		| load it
 
 /*



CVS commit: src/sys/arch/news68k/news68k

2009-12-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed Dec  2 15:54:19 UTC 2009

Modified Files:
src/sys/arch/news68k/news68k: locore.s pmap_bootstrap.c

Log Message:
Use common pmap_bootstrap_finalize() to initialize lwp0 uarea etc.
Tested on NWS-1750.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/news68k/news68k/locore.s
cvs rdiff -u -r1.23 -r1.24 src/sys/arch/news68k/news68k/pmap_bootstrap.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/news68k/news68k/locore.s
diff -u src/sys/arch/news68k/news68k/locore.s:1.48 src/sys/arch/news68k/news68k/locore.s:1.49
--- src/sys/arch/news68k/news68k/locore.s:1.48	Thu Nov 26 00:19:19 2009
+++ src/sys/arch/news68k/news68k/locore.s	Wed Dec  2 15:54:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.48 2009/11/26 00:19:19 matt Exp $	*/
+/*	$NetBSD: locore.s,v 1.49 2009/12/02 15:54:19 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -445,13 +445,13 @@
 /* select the software page size now */
 	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
 	jbsr	_C_LABEL(uvm_setpagesize)  | select software page size
-/* set kernel stack, user SP, and initial pcb */
-	lea	_C_LABEL(lwp0),%a2	| get lwp0.l_addr
-	movl	%a2@(L_ADDR),%a1	|   set kernel stack to end of area 
-	lea	%a1@(USPACE-4),%sp	|   and curlwp so that we don't
-	movl	%a2,_C_LABEL(curlwp)	|   deref NULL in trap()
+/* call final pmap setup which initialize lwp0, curlwp, and curpcb */
+	jbsr	_C_LABEL(pmap_bootstrap_finalize)
+/* set kernel stack, user SP */
+	movl	_C_LABEL(lwp0uarea),%a1	| get lwp0 uarea
+	lea	%a1@(USPACE-4),%sp	|   set kernel stack to end of area
+	movl	#USRSTACK-4,%a2
 	movl	%a2,%usp		| init user SP
-	movl	%a1,_C_LABEL(curpcb)	| lwp0 is running
 
 	tstl	_C_LABEL(fputype)	| Have an FPU?
 	jeq	Lenab2			| No, skip.

Index: src/sys/arch/news68k/news68k/pmap_bootstrap.c
diff -u src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.23 src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.24
--- src/sys/arch/news68k/news68k/pmap_bootstrap.c:1.23	Thu Nov 26 00:19:19 2009
+++ src/sys/arch/news68k/news68k/pmap_bootstrap.c	Wed Dec  2 15:54:19 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.23 2009/11/26 00:19:19 matt Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.24 2009/12/02 15:54:19 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.23 2009/11/26 00:19:19 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap_bootstrap.c,v 1.24 2009/12/02 15:54:19 tsutsui Exp $);
 
 #include sys/param.h
 
@@ -89,7 +89,7 @@
 void
 pmap_bootstrap(paddr_t nextpa, paddr_t firstpa)
 {
-	paddr_t kstpa, kptpa, kptmpa, l0upa;
+	paddr_t kstpa, kptpa, kptmpa, lwp0upa;
 	u_int nptpages, kstsize;
 	st_entry_t protoste, *ste;
 	pt_entry_t protopte, *pte, *epte;
@@ -110,7 +110,7 @@
 	 *
 	 *	kptmpa		kernel PT map		1 page
 	 *
-	 *	l0upa		lwp 0 u-area		UPAGES pages
+	 *	lwp0upa		lwp 0 u-area		UPAGES pages
 	 *
 	 * The KVA corresponding to any of these PAs is:
 	 *	(PA - firstpa + KERNBASE).
@@ -136,7 +136,7 @@
 	nextpa += kstsize * PAGE_SIZE;
 	kptmpa = nextpa;
 	nextpa += PAGE_SIZE;
-	l0upa = nextpa;
+	lwp0upa = nextpa;
 	nextpa += USPACE;
 	kptpa = nextpa;
 	nptpages = RELOC(Sysptsize, int) +
@@ -306,7 +306,7 @@
 	}
 	/*
 	 * Validate PTEs for kernel data/bss, dynamic data allocated
-	 * by us so far (nextpa - firstpa bytes), and pages for proc0
+	 * by us so far (nextpa - firstpa bytes), and pages for lwp0
 	 * u-area and page table allocated below (RW).
 	 */
 	epte = ((u_int *)kptpa)[m68k_btop(nextpa - firstpa)];
@@ -361,21 +361,21 @@
 	(pt_entry_t *)m68k_ptob((NPTEPG - 1) * NPTEPG);
 
 	/*
-	 * Setup u-area for process 0.
+	 * Setup u-area for lwp 0.
 	 */
 	/*
 	 * Zero the u-area.
 	 * NOTE: `pte' and `epte' aren't PTEs here.
 	 */
-	pte = (u_int *)l0upa;
-	epte = (u_int *)(l0upa + USPACE);
+	pte = (u_int *)lwp0upa;
+	epte = (u_int *)(lwp0upa + USPACE);
 	while (pte  epte)
 		*pte++ = 0;
 	/*
-	 * Remember the u-area address so it can be loaded in the
-	 * proc struct p_addr field later.
+	 * Remember the u-area address so it can be loaded in the lwp0
+	 * via uvm_lwp_setuarea() later in pmap_bootstrap_finalize().
 	 */
-	RELOC(lwp0.l_addr, struct user *) = (struct user *)(l0upa - firstpa);
+	RELOC(lwp0uarea, vaddr_t) = lwp0upa - firstpa;
 
 	/*
 	 * VM data structures are now initialized, set up data for