CVS commit: src/sys/arch/x68k/x68k

2021-08-05 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Fri Aug  6 04:21:56 UTC 2021

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

Log Message:
Fix broken mm_md_physacc().
- Fix access to main memory and extended memory.
  This makes /dev/mem work again.
- Introduce kauth(9) to access unmanaged memory area.
  Now you can read/write the internal I/O space via /dev/mem when
  securelevel = -1.
Thanks ryo@, tsutsui@ for advices and reviews.


To generate a diff of this commit:
cvs rdiff -u -r1.205 -r1.206 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.205 src/sys/arch/x68k/x68k/machdep.c:1.206
--- src/sys/arch/x68k/x68k/machdep.c:1.205	Thu Feb 11 02:37:11 2021
+++ src/sys/arch/x68k/x68k/machdep.c	Fri Aug  6 04:21:56 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.205 2021/02/11 02:37:11 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.206 2021/08/06 04:21:56 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.205 2021/02/11 02:37:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.206 2021/08/06 04:21:56 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1252,15 +1252,28 @@ cpu_intr_p(void)
 int
 mm_md_physacc(paddr_t pa, vm_prot_t prot)
 {
-	uvm_physseg_t i;
+	int i;
 
-	for (i = uvm_physseg_get_first(); uvm_physseg_valid_p(i); i = uvm_physseg_get_next(i)) {
-		if (uvm_physseg_valid_p(i) == false)
-			break;
+	/* Main memory */
+	if (phys_basemem_seg.start <= pa && pa < phys_basemem_seg.end)
+		return 0;
 
-		if (ctob(uvm_physseg_get_start(i)) <= pa &&
-		pa < ctob(uvm_physseg_get_end(i)))
+#ifdef EXTENDED_MEMORY
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		if (phys_extmem_seg[i].start == phys_extmem_seg[i].end)
+			continue;
+		if (phys_extmem_seg[i].start <= pa &&
+		pa < phys_extmem_seg[i].end) {
 			return 0;
+		}
 	}
+#endif
+
+	/* I/O space */
+	if (INTIOBASE <= pa && pa < INTIOTOP) {
+		return kauth_authorize_machdep(kauth_cred_get(),
+		KAUTH_MACHDEP_UNMANAGEDMEM, NULL, NULL, NULL, NULL);
+	}
+
 	return EFAULT;
 }



CVS commit: src/sys/arch/x68k/x68k

2021-02-10 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Feb 11 02:37:11 UTC 2021

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

Log Message:
Fix a message for NMI.

Maybe the "keyboard NMI" message was derived from hp300 but
on X68030 NMI is triggered by the NMI button, and there is no
parity check.


To generate a diff of this commit:
cvs rdiff -u -r1.204 -r1.205 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.204 src/sys/arch/x68k/x68k/machdep.c:1.205
--- src/sys/arch/x68k/x68k/machdep.c:1.204	Sun Feb  7 15:51:11 2021
+++ src/sys/arch/x68k/x68k/machdep.c	Thu Feb 11 02:37:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.204 2021/02/07 15:51:11 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.205 2021/02/11 02:37:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.204 2021/02/07 15:51:11 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.205 2021/02/11 02:37:11 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -957,7 +957,7 @@ candbtimer(void *arg)
 #endif
 
 /*
- * Level 7 interrupts can be caused by the keyboard or parity errors.
+ * Level 7 interrupts can be caused by the NMI button.
  */
 void
 nmihand(struct frame frame)
@@ -975,7 +975,7 @@ nmihand(struct frame frame)
 		 */
 		if (innmihand == 0) {
 			innmihand = 1;
-			printf("Got a keyboard NMI\n");
+			printf("NMI button pressed\n");
 			innmihand = 0;
 		}
 #ifdef DDB



CVS commit: src/sys/arch/x68k/x68k

2021-02-07 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Feb  7 15:51:11 UTC 2021

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

Log Message:
Restore fixes for PR/51663 lost in r1.195 (uvm_hotplug(9) merge).

The kernel crashdump and savecore(8) on NetBSD/x68k have been broken
(even without EXTNEDED_MEMORY) since NetBSD 8.0. Oops.

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


To generate a diff of this commit:
cvs rdiff -u -r1.203 -r1.204 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.203 src/sys/arch/x68k/x68k/machdep.c:1.204
--- src/sys/arch/x68k/x68k/machdep.c:1.203	Thu Jun 11 19:20:46 2020
+++ src/sys/arch/x68k/x68k/machdep.c	Sun Feb  7 15:51:11 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.203 2020/06/11 19:20:46 ad Exp $	*/
+/*	$NetBSD: machdep.c,v 1.204 2021/02/07 15:51:11 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.203 2020/06/11 19:20:46 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.204 2021/02/07 15:51:11 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -568,7 +568,10 @@ cpu_init_kcore_hdr(void)
 {
 	cpu_kcore_hdr_t *h = &cpu_kcore_hdr;
 	struct m68k_kcore_hdr *m = &h->un._m68k;
-	uvm_physseg_t i;
+	psize_t size;
+#ifdef EXTENDED_MEMORY
+	int i, seg;
+#endif
 
 	memset(&cpu_kcore_hdr, 0, sizeof(cpu_kcore_hdr));
 
@@ -617,25 +620,20 @@ cpu_init_kcore_hdr(void)
 	/*
 	 * X68k has multiple RAM segments on some models.
 	 */
-	m->ram_segs[0].start = lowram;
-	m->ram_segs[0].size = mem_size - lowram;
-
-	i = uvm_physseg_get_first();
-	
-for (uvm_physseg_get_next(i); uvm_physseg_valid_p(i); i = uvm_physseg_get_next(i)) {
-		if (uvm_physseg_valid_p(i) == false)
-			break;
-
-		const paddr_t startpfn = uvm_physseg_get_start(i);
-		const paddr_t endpfn = uvm_physseg_get_end(i);
-
-		KASSERT(startpfn != -1 && endpfn != -1);
-
-		m->ram_segs[i].start = 
-		ctob(startpfn);
-		m->ram_segs[i].size  =			
-		ctob(endpfn - startpfn);
+	size = phys_basemem_seg.end - phys_basemem_seg.start;
+	m->ram_segs[0].start = phys_basemem_seg.start;
+	m->ram_segs[0].size  = size;
+#ifdef EXTENDED_MEMORY
+	seg = 1;
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		size = phys_extmem_seg[i].end - phys_extmem_seg[i].start;
+		if (size == 0)
+			continue;
+		m->ram_segs[seg].start = phys_extmem_seg[i].start;
+		m->ram_segs[seg].size  = size;
+		seg++;
 	}
+#endif
 }
 
 /*



CVS commit: src/sys/arch/x68k/x68k

2020-06-18 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu Jun 18 19:54:08 UTC 2020

Modified Files:
src/sys/arch/x68k/x68k: disksubr.c

Log Message:
Use a sane default for size of partition a: rather than odd 0x1fff.

The latter one seems derived from 386BSD (and 4.4BSD),
but it could confuse sysinst as noted in PR/55187.
Sync with most other modern ports that use secperunit
as well as RAW_PART.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/arch/x68k/x68k/disksubr.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/x68k/x68k/disksubr.c
diff -u src/sys/arch/x68k/x68k/disksubr.c:1.35 src/sys/arch/x68k/x68k/disksubr.c:1.36
--- src/sys/arch/x68k/x68k/disksubr.c:1.35	Wed Apr  3 22:10:51 2019
+++ src/sys/arch/x68k/x68k/disksubr.c	Thu Jun 18 19:54:08 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.35 2019/04/03 22:10:51 christos Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.36 2020/06/18 19:54:08 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.35 2019/04/03 22:10:51 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.36 2020/06/18 19:54:08 tsutsui Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -78,16 +78,16 @@ readdisklabel(dev_t dev, void (*strat)(s
 		lp->d_secsize = DEF_BSIZE;
 	if (lp->d_secperunit == 0)
 		lp->d_secperunit = 0x1fff;
-	if (lp->d_secpercyl == 0)
-		lp->d_secpercyl = 0x1fff;
 	lp->d_npartitions = RAW_PART + 1;
 	for (i = 0; i < RAW_PART; i++) {
 		lp->d_partitions[i].p_size = 0;
 		lp->d_partitions[i].p_offset = 0;
 	}
-	if (lp->d_partitions[0].p_size == 0)
-		lp->d_partitions[0].p_size = 0x1fff;
-	lp->d_partitions[0].p_offset = 0;
+	if (lp->d_partitions[RAW_PART].p_size == 0)
+		lp->d_partitions[RAW_PART].p_size = lp->d_secperunit;
+	lp->d_partitions[RAW_PART].p_offset = 0;
+
+	lp->d_partitions[0].p_size = lp->d_partitions[RAW_PART].p_size;
 
 	/* get a buffer and initialize it */
 	bsdlabelsz =



CVS commit: src/sys/arch/x68k/x68k

2019-04-03 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Apr  4 04:31:01 UTC 2019

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

Log Message:
Remove cpuspeed info for 68060.
- On 68060, it's not accurate so worthless.
- I don't have 68040 so I leave it untouched.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.199 src/sys/arch/x68k/x68k/machdep.c:1.200
--- src/sys/arch/x68k/x68k/machdep.c:1.199	Thu Apr  4 03:36:15 2019
+++ src/sys/arch/x68k/x68k/machdep.c	Thu Apr  4 04:31:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.199 2019/04/04 03:36:15 isaki Exp $	*/
+/*	$NetBSD: machdep.c,v 1.200 2019/04/04 04:31:01 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.199 2019/04/04 03:36:15 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.200 2019/04/04 04:31:01 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -327,7 +327,7 @@ identifycpu(void)
 {
 	/* there's alot of XXX in here... */
 	const char *cpu_type, *mach, *mmu, *fpu;
-	char clock[16];
+	char clock[20];
 	char emubuf[20];
 	char cpubuf[16];
 	uint32_t pcr;
@@ -362,11 +362,10 @@ identifycpu(void)
 		break;
 	}
 
+	clock[0] = '\0';
 	emubuf[0] = '\0';
 	check_emulator(emubuf, sizeof(emubuf));
 
-	cpuspeed = 2048 / delay_divisor;
-	snprintf(clock, sizeof(clock), "%dMHz", cpuspeed);
 	switch (cputype) {
 	case CPU_68060:
 		/* from amiga */
@@ -376,22 +375,30 @@ identifycpu(void)
 		(pcr & 0x1) ? "LC/EC" : "", (pcr >> 8) & 0xff);
 		cpu_type = cpubuf;
 		mmu = "/MMU";
-		cpuspeed = 128 / delay_divisor;
-		snprintf(clock, sizeof(clock), "%d/%dMHz", cpuspeed*2, cpuspeed);
+		/*
+		 * This delay_divisor method cannot get accurate cpuspeed
+		 * for 68060.
+		 */
+		clock[0] = '\0';
 		break;
 	case CPU_68040:
 		cpu_type = "m68040";
 		mmu = "/MMU";
 		cpuspeed = 759 / delay_divisor;
-		snprintf(clock, sizeof(clock), "%d/%dMHz", cpuspeed*2, cpuspeed);
+		snprintf(clock, sizeof(clock), ", %d/%dMHz clock",
+		cpuspeed*2, cpuspeed);
 		break;
 	case CPU_68030:
 		cpu_type = "m68030";
 		mmu = "/MMU";
+		cpuspeed = 2048 / delay_divisor;
+		snprintf(clock, sizeof(clock), ", %dMHz clock", cpuspeed);
 		break;
 	case CPU_68020:
 		cpu_type = "m68020";
 		mmu = ", m68851 MMU";
+		cpuspeed = 2048 / delay_divisor;
+		snprintf(clock, sizeof(clock), ", %dMHz clock", cpuspeed);
 		break;
 	default:
 		cpu_type = "unknown";
@@ -402,7 +409,7 @@ identifycpu(void)
 		fpu = fpu_descr[fputype];
 	else
 		fpu = ", unknown FPU";
-	cpu_setmodel("X68%s (%s CPU%s%s, %s clock)%s%s",
+	cpu_setmodel("X68%s (%s CPU%s%s%s)%s%s",
 	mach, cpu_type, mmu, fpu, clock,
 		emubuf[0] ? " on " : "", emubuf);
 	printf("%s\n", cpu_getmodel());



CVS commit: src/sys/arch/x68k/x68k

2019-04-03 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Thu Apr  4 03:36:15 UTC 2019

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

Log Message:
Display 68060 revision.  From amiga/amiga/machdep.c.


To generate a diff of this commit:
cvs rdiff -u -r1.198 -r1.199 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.198 src/sys/arch/x68k/x68k/machdep.c:1.199
--- src/sys/arch/x68k/x68k/machdep.c:1.198	Thu Mar 14 16:59:10 2019
+++ src/sys/arch/x68k/x68k/machdep.c	Thu Apr  4 03:36:15 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.198 2019/03/14 16:59:10 thorpej Exp $	*/
+/*	$NetBSD: machdep.c,v 1.199 2019/04/04 03:36:15 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.198 2019/03/14 16:59:10 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.199 2019/04/04 03:36:15 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -329,6 +329,8 @@ identifycpu(void)
 	const char *cpu_type, *mach, *mmu, *fpu;
 	char clock[16];
 	char emubuf[20];
+	char cpubuf[16];
+	uint32_t pcr;
 
 	/*
 	 * check machine type constant
@@ -367,7 +369,12 @@ identifycpu(void)
 	snprintf(clock, sizeof(clock), "%dMHz", cpuspeed);
 	switch (cputype) {
 	case CPU_68060:
-		cpu_type = "m68060";
+		/* from amiga */
+		__asm(".word 0x4e7a,0x0808; movl %%d0,%0"
+		: "=d"(pcr) : : "d0");
+		snprintf(cpubuf, sizeof(cpubuf), "m68%s060 rev.%d",
+		(pcr & 0x1) ? "LC/EC" : "", (pcr >> 8) & 0xff);
+		cpu_type = cpubuf;
 		mmu = "/MMU";
 		cpuspeed = 128 / delay_divisor;
 		snprintf(clock, sizeof(clock), "%d/%dMHz", cpuspeed*2, cpuspeed);



CVS commit: src/sys/arch/x68k/x68k

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

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

Log Message:
pass the correct argument


To generate a diff of this commit:
cvs rdiff -u -r1.196 -r1.197 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.196 src/sys/arch/x68k/x68k/machdep.c:1.197
--- src/sys/arch/x68k/x68k/machdep.c:1.196	Mon Apr  3 13:37:29 2017
+++ src/sys/arch/x68k/x68k/machdep.c	Thu Sep 14 23:12:05 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.197 2017/09/15 03:12:05 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.197 2017/09/15 03:12:05 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -1029,12 +1029,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);
 		break;
 #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);
 		break;
 #endif
 	default:



CVS commit: src/sys/arch/x68k/x68k

2017-04-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Apr  3 17:37:29 UTC 2017

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

Log Message:
PR/52135: David Binderman: Fix loop bounds checking.


To generate a diff of this commit:
cvs rdiff -u -r1.195 -r1.196 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.195 src/sys/arch/x68k/x68k/machdep.c:1.196
--- src/sys/arch/x68k/x68k/machdep.c:1.195	Fri Dec 23 02:15:28 2016
+++ src/sys/arch/x68k/x68k/machdep.c	Mon Apr  3 13:37:29 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.195 2016/12/23 07:15:28 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.195 2016/12/23 07:15:28 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.196 2017/04/03 17:37:29 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -693,7 +693,7 @@ cpu_dumpconf(void)
 	chdrsize = cpu_dumpsize();
 
 	dumpsize = 0;
-	for (i = 0; m->ram_segs[i].size && i < M68K_NPHYS_RAM_SEGS; i++)
+	for (i = 0; i < M68K_NPHYS_RAM_SEGS && m->ram_segs[i].size; i++)
 		dumpsize += btoc(m->ram_segs[i].size);
 	/*
 	 * Check to see if we will fit.  Note we always skip the



CVS commit: src/sys/arch/x68k/x68k

2016-12-02 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec  2 12:43:07 UTC 2016

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

Log Message:
Fix crashdump on machines with EXTENDED_MEMORY.

PR port-x68k/51663 from Rin Okuyama.


To generate a diff of this commit:
cvs rdiff -u -r1.193 -r1.194 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.193 src/sys/arch/x68k/x68k/machdep.c:1.194
--- src/sys/arch/x68k/x68k/machdep.c:1.193	Tue Jun 14 07:51:10 2016
+++ src/sys/arch/x68k/x68k/machdep.c	Fri Dec  2 12:43:07 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.193 2016/06/14 07:51:10 isaki Exp $	*/
+/*	$NetBSD: machdep.c,v 1.194 2016/12/02 12:43:07 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.193 2016/06/14 07:51:10 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.194 2016/12/02 12:43:07 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -553,7 +553,10 @@ cpu_init_kcore_hdr(void)
 {
 	cpu_kcore_hdr_t *h = &cpu_kcore_hdr;
 	struct m68k_kcore_hdr *m = &h->un._m68k;
-	int i;
+	psize_t size;
+#ifdef EXTENDED_MEMORY
+	int i, seg;
+#endif
 
 	memset(&cpu_kcore_hdr, 0, sizeof(cpu_kcore_hdr));
 
@@ -602,14 +605,20 @@ cpu_init_kcore_hdr(void)
 	/*
 	 * X68k has multiple RAM segments on some models.
 	 */
-	m->ram_segs[0].start = lowram;
-	m->ram_segs[0].size = mem_size - lowram;
-	for (i = 1; i < vm_nphysseg; i++) {
-		m->ram_segs[i].start =
-		ctob(VM_PHYSMEM_PTR(i)->start);
-		m->ram_segs[i].size  =
-		ctob(VM_PHYSMEM_PTR(i)->end - VM_PHYSMEM_PTR(i)->start);
+	size = phys_basemem_seg.end - phys_basemem_seg.start;
+	m->ram_segs[0].start = phys_basemem_seg.start;
+	m->ram_segs[0].size  = size;
+#ifdef EXTENDED_MEMORY
+	seg = 1;
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		size = phys_extmem_seg[i].end - phys_extmem_seg[i].start;
+		if (size == 0)
+			continue;
+		m->ram_segs[seg].start = phys_extmem_seg[i].start;
+		m->ram_segs[seg].size  = size;
+		seg++;
 	}
+#endif
 }
 
 /*



CVS commit: src/sys/arch/x68k/x68k

2016-06-14 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jun 14 07:51:11 UTC 2016

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

Log Message:
In XM6 TypeG (and original XM6), its version number is
represented by BCD, not decimal.
Reported by GIMONS (the author of XM6 typeG).


To generate a diff of this commit:
cvs rdiff -u -r1.192 -r1.193 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.192 src/sys/arch/x68k/x68k/machdep.c:1.193
--- src/sys/arch/x68k/x68k/machdep.c:1.192	Wed Sep 16 05:48:52 2015
+++ src/sys/arch/x68k/x68k/machdep.c	Tue Jun 14 07:51:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.192 2015/09/16 05:48:52 isaki Exp $	*/
+/*	$NetBSD: machdep.c,v 1.193 2016/06/14 07:51:10 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.192 2015/09/16 05:48:52 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.193 2016/06/14 07:51:10 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -421,7 +421,7 @@ check_emulator(char *buf, int bufsize)
 		xm6imark = intio_get_sysport_sramwp();
 		switch (xm6imark) {
 		case 0xff:	/* Original XM6 or unknown compatibles */
-			snprintf(buf, bufsize, "XM6 v%d.%02d",
+			snprintf(buf, bufsize, "XM6 v%x.%02x",
 xm6major, xm6minor);
 			break;
 
@@ -433,7 +433,7 @@ check_emulator(char *buf, int bufsize)
 			break;
 
 		case 'g':	/* XM6 TypeG */
-			snprintf(buf, bufsize, "XM6 TypeG v%d.%02d",
+			snprintf(buf, bufsize, "XM6 TypeG v%x.%02x",
 xm6major, xm6minor);
 			break;
 



CVS commit: src/sys/arch/x68k/x68k

2015-09-15 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Sep 16 05:48:53 UTC 2015

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

Log Message:
To turn off the power, it's necessary to turn off the alarm signal
of RTC before writing the system port.  This is a fix for rev 1.191.
Thanks to Y.Sugahara.
Should be pulled up to netbsd-7.


To generate a diff of this commit:
cvs rdiff -u -r1.191 -r1.192 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.191 src/sys/arch/x68k/x68k/machdep.c:1.192
--- src/sys/arch/x68k/x68k/machdep.c:1.191	Wed Mar 26 16:21:39 2014
+++ src/sys/arch/x68k/x68k/machdep.c	Wed Sep 16 05:48:52 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $	*/
+/*	$NetBSD: machdep.c,v 1.192 2015/09/16 05:48:52 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.192 2015/09/16 05:48:52 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -106,6 +106,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 #include 
+#include 
 
 extern void doboot(void) __attribute__((__noreturn__));
 
@@ -522,6 +523,10 @@ cpu_reboot(int howto, char *bootstr)
 	if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) {
 		printf("powering off...\n");
 		delay(100);
+
+		/* Turn off the alarm signal of RTC */
+		IODEVbase->io_rtc.bank0.reset = 0x0c;
+
 		intio_set_sysport_powoff(0x00);
 		intio_set_sysport_powoff(0x0f);
 		intio_set_sysport_powoff(0x0f);



CVS commit: src/sys/arch/x68k/x68k

2015-07-24 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sat Jul 25 06:24:53 UTC 2015

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

Log Message:
Add a comment on mnemonic that assembler cannot recognize.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.118 src/sys/arch/x68k/x68k/locore.s:1.119
--- src/sys/arch/x68k/x68k/locore.s:1.118	Thu Jul 31 14:41:19 2014
+++ src/sys/arch/x68k/x68k/locore.s	Sat Jul 25 06:24:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.118 2014/07/31 14:41:19 isaki Exp $	*/
+/*	$NetBSD: locore.s,v 1.119 2015/07/25 06:24:53 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -362,7 +362,7 @@ Lenab2:
 	movc	%d0,%cacr		| clear cache(s)
 	jra	Lenab3
 Ltbia040:
-	.word	0xf518
+	.word	0xf518			| pflusha
 Lenab3:
 /* final setup for C code */
 	movl	%d7,_C_LABEL(boothowto)	| save reboot flags



CVS commit: src/sys/arch/x68k/x68k

2014-03-26 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed Mar 26 16:21:39 UTC 2014

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

Log Message:
Implement the software power-off (correctly) when RB_POWERDOWN is
specified.  Before this, the kernel doesn't turn off the power in fact,
and thus the power off had happened in IPLROM after software reset.

Many thanks to tsutsui@ on port-x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.190 -r1.191 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.190 src/sys/arch/x68k/x68k/machdep.c:1.191
--- src/sys/arch/x68k/x68k/machdep.c:1.190	Wed Mar 26 08:17:59 2014
+++ src/sys/arch/x68k/x68k/machdep.c	Wed Mar 26 16:21:39 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.190 2014/03/26 08:17:59 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.190 2014/03/26 08:17:59 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.191 2014/03/26 16:21:39 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -513,16 +513,23 @@ cpu_reboot(int howto, char *bootstr)
 	 *	Power cannot be removed; simply halt the system (b)
 	 *	Power switch state is checked in shutdown hook
 	 *  a2: the power switch is off
-	 *	Remove the power; the simplest way is go back to ROM eg. reboot
+	 *	Remove the power
 	 * b) RB_HALT
 	 *	call cngetc
 	 * c) otherwise
 	 *	Reboot
 	 */
-	if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off)
-		doboot();
-	else if (/*((howto & RB_POWERDOWN) == RB_POWERDOWN) ||*/
-		 ((howto & RB_HALT) == RB_HALT)) {
+	if (((howto & RB_POWERDOWN) == RB_POWERDOWN) && power_switch_is_off) {
+		printf("powering off...\n");
+		delay(100);
+		intio_set_sysport_powoff(0x00);
+		intio_set_sysport_powoff(0x0f);
+		intio_set_sysport_powoff(0x0f);
+		delay(100);
+		printf("WARNING: powerdown failed\n");
+		delay(100);
+		/* PASSTHROUGH even if came back */
+	} else if ((howto & RB_HALT) == RB_HALT) {
 		printf("System halted.  Hit any key to reboot.\n\n");
 		(void)cngetc();
 	}



CVS commit: src/sys/arch/x68k/x68k

2014-03-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar 22 15:59:07 UTC 2014

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

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

No binary changes on GENERIC.
(though the previous revision has not been tested on 040/060 yet)


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.116 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.115 src/sys/arch/x68k/x68k/locore.s:1.116
--- src/sys/arch/x68k/x68k/locore.s:1.115	Fri Mar 14 20:24:24 2014
+++ src/sys/arch/x68k/x68k/locore.s	Sat Mar 22 15:59:07 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.115 2014/03/14 20:24:24 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.116 2014/03/22 15:59:07 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -392,176 +392,10 @@ Lenab3:
  */
 #include 
 
-#if defined(M68040) || defined(M68060)
-ENTRY_NOPROFILE(addrerr4060)
-	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
-	movl	%sp@(FR_HW+8),%sp@-
-	clrl	%sp@-			| dummy code
-	movl	#T_ADDRERR,%sp@-	| mark address error
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-#endif
-
-#if defined(M68060)
-ENTRY_NOPROFILE(buserr60)		| XXX
-	clrl	%sp@-			| stack adjust count
-	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	movel	%sp@(FR_HW+12),%d0	| FSLW
-	btst	#2,%d0			| branch prediction error?
-	jeq	Lnobpe
-	movc	%cacr,%d2
-	orl	#IC60_CABC,%d2		| clear all branch cache entries
-	movc	%d2,%cacr
-	movl	%d0,%d1
-	andl	#0x7ffd,%d1		| check other faults
-	jeq	_ASM_LABEL(faultstkadjnotrap2)
-Lnobpe:
-| we need to adjust for misaligned addresses
-	movl	%sp@(FR_HW+8),%d1	| grab VA
-	btst	#27,%d0			| check for mis-aligned access
-	jeq	Lberr3			| no, skip
-	addl	#28,%d1			| yes, get into next page
-	| operand case: 3,
-	| instruction case: 4+12+12
-	| XXX instr. case not done yet
-	andl	#PG_FRAME,%d1		| and truncate
-Lberr3:
-	movl	%d1,%sp@-
-	movl	%d0,%sp@-		| code is FSLW now.
-	andw	#0x1f80,%d0
-	jeq	Lberr60			| it is a bus error
-	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-Lberr60:
-	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
-
-#if defined(M68040)
-ENTRY_NOPROFILE(buserr40)
-	clrl	%sp@-			| stack adjust count
-	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
-	movl	%usp,%a0		| save the user SP
-	movl	%a0,%sp@(FR_SP)		|   in the savearea
-	movl	%sp@(FR_HW+20),%d1	| get fault address
-	moveq	#0,%d0
-	movw	%sp@(FR_HW+12),%d0	| get SSW
-	btst	#11,%d0			| check for mis-aligned
-	jeq	Lbe1stpg		| no skip
-	addl	#3,%d1			| get into next page
-	andl	#PG_FRAME,%d1		| and truncate
-Lbe1stpg:
-	movl	%d1,%sp@-		| pass fault address.
-	movl	%d0,%sp@-		| pass SSW as code
-	btst	#10,%d0			| test ATC
-	jeq	Lberr40			| it is a bus error
-	movl	#T_MMUFLT,%sp@-		| show that we are an MMU fault
-	jra	_ASM_LABEL(faultstkadj)	| and deal with it
-Lberr40:
-	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
-
-#if defined(M68020) || defined(M68030)
-ENTRY_NOPROFILE(busaddrerr2030)
-	clrl	%sp@-			| stack adjust count
-	moveml	%d0-%d7/%a0-%a7,%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
-	mov

CVS commit: src/sys/arch/x68k/x68k

2014-03-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Mar 14 20:24:24 UTC 2014

Modified Files:
src/sys/arch/x68k/x68k: locore.s vectors.s

Log Message:
Sync bus error and address error handlers with other m68k implementation.

Tested on X68030.  Needs tests on 040 and 060turbo
(though it should work as other m68k ports).

The x68k port implemented 68060 support including these vector handlers
as early as amiga back in 1996, but even after amiga's locore.s was
improved several times (updating vectors at runtime to switch handlers
per CPU types etc.), x68k's one has not been updated.
After that, atari and mac68k pulled amiga's implementation,
hp300 pulled mac68k, and then most other m68k ports pulled hp300 ones.

Probably that's the reason why only x68k had different implementations
(i.e. no reason that avoids using common handler implementation),
and now it's time to prepare common arch/m68k/m68k/busaddrerr.s.


To generate a diff of this commit:
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/x68k/x68k/locore.s
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/x68k/x68k/vectors.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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.114 src/sys/arch/x68k/x68k/locore.s:1.115
--- src/sys/arch/x68k/x68k/locore.s:1.114	Sat Mar  8 17:44:37 2014
+++ src/sys/arch/x68k/x68k/locore.s	Fri Mar 14 20:24:24 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.114 2014/03/08 17:44:37 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.115 2014/03/14 20:24:24 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -185,6 +185,35 @@ Lis68020:
 	movl	#CPU_68020,%a0@		| and a 68020 CPU
 
 Lstart1:
+	/*
+	 * Now that we know what CPU we have, initialize the address error
+	 * and bus error handlers in the vector table:
+	 *
+	 *  vectab+8bus error
+	 *  vectab+12   address error
+	 */
+	RELOC(cputype,%a0)
+	RELOC(vectab,%a2)
+#if defined(M68060)
+	cmpl	#CPU_68060,%a0@		| 68060?
+	jne	1f
+	movl	#_C_LABEL(buserr60),%a2@(8)
+	movl	#_C_LABEL(addrerr4060),%a2@(12)
+	jra	Lstart2
+1:
+#endif
+#if defined(M68040)
+	cmpl	#CPU_68040,%a0@		| 68040?
+	jne	1f
+	movl	#_C_LABEL(buserr40),%a2@(8)
+	movl	#_C_LABEL(addrerr4060),%a2@(12)
+	jra	Lstart2
+1:
+#endif
+	movl	#_C_LABEL(busaddrerr2030),%a2@(8)
+	movl	#_C_LABEL(busaddrerr2030),%a2@(12)
+
+Lstart2:
 /* initialize source/destination control registers for movs */
 	moveq	#FC_USERD,%d0		| user space
 	movc	%d0,%sfc		|   as source
@@ -205,10 +234,10 @@ Lstart1:
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	RELOC(esym,%a0)			| end of static kernel test/data/syms
 	movl	%a0@,%d5
-	jne	Lstart2
+	jne	Lstart3
 #endif
 	movl	#_C_LABEL(end),%d5	| end of static kernel text/data
-Lstart2:
+Lstart3:
 	RELOC(setmemrange,%a0)		| call setmemrange()
 	jbsr	%a0@			|  to probe all memory regions
 	addl	#PAGE_SIZE-1,%d5
@@ -363,39 +392,36 @@ Lenab3:
  */
 #include 
 
-ENTRY_NOPROFILE(buserr)
-ENTRY_NOPROFILE(buserr60)		| XXX
-	tstl	_C_LABEL(nofault)	| device probe?
-	jeq	Lberr			| no, handle as usual
-	movl	_C_LABEL(nofault),%sp@-	| yes,
-	jbsr	_C_LABEL(longjmp)	|  longjmp(nofault)
-Lberr:
 #if defined(M68040) || defined(M68060)
-	cmpl	#MMU_68040,_C_LABEL(mmutype) | 68040/060?
-	jne	_C_LABEL(addrerr)	| no, skip
+ENTRY_NOPROFILE(addrerr4060)
 	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
-	lea	%sp@(FR_HW),%a1		| grab base of HW berr frame
+	movl	%sp@(FR_HW+8),%sp@-
+	clrl	%sp@-			| dummy code
+	movl	#T_ADDRERR,%sp@-	| mark address error
+	jra	_ASM_LABEL(faultstkadj)	| and deal with it
+#endif
+
 #if defined(M68060)
-	cmpl	#CPU_68060,_C_LABEL(cputype) | 68060?
-	jne	Lbenot060
-	movel	%a1@(12),%d0		| grap FSLW
+ENTRY_NOPROFILE(buserr60)		| XXX
+	clrl	%sp@-			| stack adjust count
+	moveml	%d0-%d7/%a0-%a7,%sp@-	| save user registers
+	movl	%usp,%a0		| save the user SP
+	movl	%a0,%sp@(FR_SP)		|   in the savearea
+	movel	%sp@(FR_HW+12),%d0	| FSLW
 	btst	#2,%d0			| branch prediction error?
-	jeq	Lnobpe			| no, skip
-	movc	%cacr,%d1
-	orl	#IC60_CABC,%d1		| clear all branch cache entries
-	movc	%d1,%cacr
+	jeq	Lnobpe
+	movc	%cacr,%d2
+	orl	#IC60_CABC,%d2		| clear all branch cache entries
+	movc	%d2,%cacr
 	movl	%d0,%d1
 	andl	#0x7ffd,%d1		| check other faults
 	jeq	_ASM_LABEL(faultstkadjnotrap2)
 Lnobpe:
-| XXX this is not needed.
-|	movl	%d0,%sp@		| code is FSLW now.
-
 | we need to adjust for misaligned addresses
-	movl	%a1@(8),%d1		| grab VA
+	movl	%sp@(FR_HW+8),%d1	| grab VA
 	btst	#27,%d0			| check for mis-aligned access
 	jeq	Lberr3			| no, skip
 	addl	#28,%d1			| yes, get into next page
@@ -404,68 +430,74 @@ Lnobpe:
 	| XXX instr. case not done yet
 	andl	#PG_FRAME,%d1		| and truncate
 Lberr3:
-	movl	%d1,%sp@-		| push fault VA
-	movl	%d0,%sp@-		| and FSLW
+	movl	%d1,%sp@-
+	movl	%d0,%sp@-		| code is FSLW now.
 	an

CVS commit: src/sys/arch/x68k/x68k

2014-03-08 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Mar  8 17:44:37 UTC 2014

Modified Files:
src/sys/arch/x68k/x68k: genassym.cf locore.s

Log Message:
Misc cosmetic changes to reduce diffs from other m68k ports.

- replace magic numbers with macro via genassym.cf
- include opt_fpu_emulate.h at the top
- use C-style comments
- add register '%' prefix in comments
- sync several comments
- indent adjustments etc.

No text binary changes. (only .global _KERNEL_OPT_FPU_EMULATE is moved)


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x68k/x68k/genassym.cf
cvs rdiff -u -r1.113 -r1.114 src/sys/arch/x68k/x68k/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/x68k/x68k/genassym.cf
diff -u src/sys/arch/x68k/x68k/genassym.cf:1.33 src/sys/arch/x68k/x68k/genassym.cf:1.34
--- src/sys/arch/x68k/x68k/genassym.cf:1.33	Fri Jan 14 02:06:33 2011
+++ src/sys/arch/x68k/x68k/genassym.cf	Sat Mar  8 17:44:37 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.33 2011/01/14 02:06:33 rmind Exp $
+#	$NetBSD: genassym.cf,v 1.34 2014/03/08 17:44:37 tsutsui Exp $
 
 #
 # Copyright (c) 1982, 1990, 1993
@@ -158,6 +158,8 @@ define	SPL6			PSL_S | PSL_IPL6
 # magic
 define	FC_USERD		FC_USERD
 define	FC_SUPERD		FC_SUPERD
+define	DC_FREEZE		DC_FREEZE
+define	CACHE40_ON		CACHE40_ON
 define	CACHE_ON		CACHE_ON
 define	CACHE_OFF		CACHE_OFF
 define	CACHE_CLR		CACHE_CLR

Index: src/sys/arch/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.113 src/sys/arch/x68k/x68k/locore.s:1.114
--- src/sys/arch/x68k/x68k/locore.s:1.113	Fri Jan 31 18:49:35 2014
+++ src/sys/arch/x68k/x68k/locore.s	Sat Mar  8 17:44:37 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.113 2014/01/31 18:49:35 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.114 2014/03/08 17:44:37 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -45,6 +45,7 @@
 #include "opt_fpsp.h"
 #include "opt_kgdb.h"
 #include "opt_lockdebug.h"
+#include "opt_fpu_emulate.h"
 #include "opt_m68k_arch.h"
 
 #include "ite.h"
@@ -55,8 +56,10 @@
 
 #include 
 
-| This is for kvm_mkdb, and should be the address of the beginning
-| of the kernel text segment (not necessarily the same as kernbase).
+/*
+ * This is for kvm_mkdb, and should be the address of the beginning
+ * of the kernel text segment (not necessarily the same as kernbase).
+ */
 	.text
 GLOBAL(kernel_text)
 
@@ -84,8 +87,8 @@ ASLOCAL(tmpstk)
 /*
  * Macro to relocate a symbol, used before MMU is enabled.
  */
-#define	_RELOC(var, ar)	\
-	lea	var,ar;	\
+#define	_RELOC(var, ar)			\
+	lea	var,ar;			\
 	addl	%a5,ar
 
 #define	RELOC(var, ar)		_RELOC(_C_LABEL(var), ar)
@@ -100,6 +103,7 @@ ASLOCAL(tmpstk)
  * through ROM until MMU is turned on at which time they will vector
  * through our table (vectors.s).
  */
+
 BSS(lowram,4)
 BSS(esym,4)
 
@@ -143,7 +147,7 @@ ASENTRY_NOPROFILE(start)
 	movc	%d0,%cacr		| clear and disable on-chip cache(s)
 
 /* determine our CPU/MMU combo - check for all regardless of kernel config */
-	movl	#0x200,%d0		| data freeze bit
+	movl	#DC_FREEZE,%d0		| data freeze bit
 	movc	%d0,%cacr		|   only exists on 68030
 	movc	%cacr,%d0		| read it back
 	tstl	%d0			| zero?
@@ -196,6 +200,7 @@ Lstart1:
 	subl	%d0,%d1			| compute amount of RAM present
 	RELOC(physmem, %a0)
 	movl	%d1,%a0@		| and physmem
+
 /* configure kernel and lwp0 VA space so we can get going */
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	RELOC(esym,%a0)			| end of static kernel test/data/syms
@@ -225,7 +230,7 @@ Lstart2:
 	RELOC(mmutype, %a0)
 	cmpl	#MMU_68040,%a0@		| 68040?
 	jne	Lmotommu1		| no, skip
-	.long	0x4e7b1807		| movc d1,srp
+	.long	0x4e7b1807		| movc %d1,%srp
 	jra	Lstploaddone
 Lmotommu1:
 	RELOC(protorp, %a0)
@@ -242,9 +247,9 @@ Lstploaddone:
 	/* JUPITER-X: set system register "SUPER" bit */
 	movl	#0x0200a240,%d0		| translate DRAM area transparently
 	.long	0x4e7b0006		| movc d0,dtt0
-	lea	0x00c0,%a0		| a0: graphic VRAM
-	lea	0x02c0,%a1		| a1: graphic VRAM ( not JUPITER-X )
-	| DRAM ( JUPITER-X )
+	lea	0x00c0,%a0		| %a0: graphic VRAM
+	lea	0x02c0,%a1		| %a1: graphic VRAM ( not JUPITER-X )
+	|  DRAM ( JUPITER-X )
 	movw	%a0@,%d0
 	movw	%d0,%d1
 	notw	%d1
@@ -253,15 +258,15 @@ Lstploaddone:
 	cmpw	%a1@,%d1		| JUPITER-X?
 	jne	Ljupiterdone		| no, skip
 	movl	#0x0100a240,%d0		| to access system register
-	.long	0x4e7b0006		| movc d0,dtt0
+	.long	0x4e7b0006		| movc %d0,%dtt0
 	movb	#0x01,0x0183	| set "SUPER" bit
 Ljupiterdone:
 #endif /* JUPITER */
 	moveq	#0,%d0			| ensure TT regs are disabled
-	.long	0x4e7b0004		| movc d0,itt0
-	.long	0x4e7b0005		| movc d0,itt1
-	.long	0x4e7b0006		| movc d0,dtt0
-	.long	0x4e7b0007		| movc d0,dtt1
+	.long	0x4e7b0004		| movc %d0,%itt0
+	.long	0x4e7b0005		| movc %d0,%itt1
+	.long	0x4e7b0006		| movc %d0,%dtt0
+	.long	0x4e7b0007		| movc %d0,%dtt1
 	.word	0xf4d8			| cinva bc
 	.word	0xf518			| pflusha
 #if PGSHIFT 

CVS commit: src/sys/arch/x68k/x68k

2014-01-31 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Jan 31 18:24:03 UTC 2014

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

Log Message:
Move the startup routine to the beginning of the source as other m68k ports.

No particular comments on port-x68k@.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.111 src/sys/arch/x68k/x68k/locore.s:1.112
--- src/sys/arch/x68k/x68k/locore.s:1.111	Sun Oct 27 02:06:06 2013
+++ src/sys/arch/x68k/x68k/locore.s	Fri Jan 31 18:24:03 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.111 2013/10/27 02:06:06 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.112 2014/01/31 18:24:03 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -82,6 +82,278 @@ ASLOCAL(tmpstk)
 	/* NOTREACHED */
 
 /*
+ * Macro to relocate a symbol, used before MMU is enabled.
+ */
+#define	_RELOC(var, ar)	\
+	lea	var,ar;	\
+	addl	%a5,ar
+
+#define	RELOC(var, ar)		_RELOC(_C_LABEL(var), ar)
+#define	ASRELOC(var, ar)	_RELOC(_ASM_LABEL(var), ar)
+
+/*
+ * Initialization
+ *
+ * A4 contains the address of the end of the symtab
+ * A5 contains physical load point from boot
+ * VBR contains zero from ROM.  Exceptions will continue to vector
+ * through ROM until MMU is turned on at which time they will vector
+ * through our table (vectors.s).
+ */
+BSS(lowram,4)
+BSS(esym,4)
+
+GLOBAL(_verspad)
+	.word	0
+GLOBAL(boot_version)
+	.word	X68K_BOOTIF_VERS
+
+ASENTRY_NOPROFILE(start)
+	movw	#PSL_HIGHIPL,%sr	| no interrupts
+
+	addql	#4,%sp
+	movel	%sp@+,%a5		| firstpa
+	movel	%sp@+,%d5		| fphysize -- last page
+	movel	%sp@,%a4		| esym
+
+	RELOC(vectab,%a0)		| set Vector Base Register temporaly
+	movc	%a0,%vbr
+
+#if 0	/* XXX this should be done by the boot loader */
+	RELOC(edata, %a0)		| clear out BSS
+	movl	#_C_LABEL(end)-4,%d0	| (must be <= 256 kB)
+	subl	#_C_LABEL(edata),%d0
+	lsrl	#2,%d0
+1:	clrl	%a0@+
+	dbra	%d0,1b
+#endif
+
+	ASRELOC(tmpstk, %a0)
+	movl	%a0,%sp			| give ourselves a temporary stack
+	RELOC(esym, %a0)
+#if 1
+	movl	%a4,%a0@		| store end of symbol table
+#else
+	clrl	%a0@			| no symbol table, yet
+#endif
+	RELOC(lowram, %a0)
+	movl	%a5,%a0@		| store start of physical memory
+
+	movl	#CACHE_OFF,%d0
+	movc	%d0,%cacr		| clear and disable on-chip cache(s)
+
+/* determine our CPU/MMU combo - check for all regardless of kernel config */
+	movl	#0x200,%d0		| data freeze bit
+	movc	%d0,%cacr		|   only exists on 68030
+	movc	%cacr,%d0		| read it back
+	tstl	%d0			| zero?
+	jeq	Lnot68030		| yes, we have 68020/68040/68060
+	jra	Lstart1			| no, we have 68030
+Lnot68030:
+	bset	#31,%d0			| data cache enable bit
+	movc	%d0,%cacr		|   only exists on 68040/68060
+	movc	%cacr,%d0		| read it back
+	tstl	%d0			| zero?
+	jeq	Lis68020		| yes, we have 68020
+	moveq	#0,%d0			| now turn it back off
+	movec	%d0,%cacr		|   before we access any data
+	.word	0xf4d8			| cinva bc - invalidate caches XXX
+	bset	#30,%d0			| data cache no allocate mode bit
+	movc	%d0,%cacr		|   only exists on 68060
+	movc	%cacr,%d0		| read it back
+	tstl	%d0			| zero?
+	jeq	Lis68040		| yes, we have 68040
+	RELOC(mmutype, %a0)		| no, we have 68060
+	movl	#MMU_68040,%a0@		| with a 68040 compatible MMU
+	RELOC(cputype, %a0)
+	movl	#CPU_68060,%a0@		| and a 68060 CPU
+	jra	Lstart1
+Lis68040:
+	RELOC(mmutype, %a0)
+	movl	#MMU_68040,%a0@		| with a 68040 MMU
+	RELOC(cputype, %a0)
+	movl	#CPU_68040,%a0@		| and a 68040 CPU
+	jra	Lstart1
+Lis68020:
+	RELOC(mmutype, %a0)
+	movl	#MMU_68851,%a0@		| we have PMMU
+	RELOC(cputype, %a0)
+	movl	#CPU_68020,%a0@		| and a 68020 CPU
+
+Lstart1:
+/* initialize source/destination control registers for movs */
+	moveq	#FC_USERD,%d0		| user space
+	movc	%d0,%sfc		|   as source
+	movc	%d0,%dfc		|   and destination of transfers
+/* initialize memory sizes (for pmap_bootstrap) */
+	movl	%d5,%d1			| last page
+	moveq	#PGSHIFT,%d2
+	lsrl	%d2,%d1			| convert to page (click) number
+	RELOC(maxmem, %a0)
+	movl	%d1,%a0@		| save as maxmem
+	movl	%a5,%d0			| lowram value from ROM via boot
+	lsrl	%d2,%d0			| convert to page number
+	subl	%d0,%d1			| compute amount of RAM present
+	RELOC(physmem, %a0)
+	movl	%d1,%a0@		| and physmem
+/* configure kernel and lwp0 VA space so we can get going */
+#if NKSYMS || defined(DDB) || defined(LKM)
+	RELOC(esym,%a0)			| end of static kernel test/data/syms
+	movl	%a0@,%d5
+	jne	Lstart2
+#endif
+	movl	#_C_LABEL(end),%d5	| end of static kernel text/data
+Lstart2:
+	RELOC(setmemrange,%a0)		| call setmemrange()
+	jbsr	%a0@			|  to probe all memory regions
+	addl	#PAGE_SIZE-1,%d5
+	andl	#PG_FRAME,%d5		| round to a page
+	movl	%d5,%a4
+	addl	%a5,%a4			| convert to PA
+	pea	%a5@			| firstpa
+	pea	%a4@			| nextpa
+	RELOC(pmap_bootstrap,%a0)
+	jbsr	%a0@			| pmap_bootstrap(firstpa, nextpa)
+	addql	#8,%sp
+
+/*
+ * Prepare to 

CVS commit: src/sys/arch/x68k/x68k

2013-10-26 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct 27 02:06:06 UTC 2013

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

Log Message:
Probe extended memories before pmap_boostrap() for actual fix of PR/45915.

Also expand expected maximum extended memory regions to recognize
upto 1008 MB RAM that is supported by the XM6i emulator.

See my post on port-x68k@ for more details:
http://mail-index.NetBSD.org/port-x68k/2013/10/19/msg39.html

Probably worth to pullup to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/x68k/x68k/locore.s
cvs rdiff -u -r1.186 -r1.187 src/sys/arch/x68k/x68k/machdep.c
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.110 src/sys/arch/x68k/x68k/locore.s:1.111
--- src/sys/arch/x68k/x68k/locore.s:1.110	Sat May 19 08:29:32 2012
+++ src/sys/arch/x68k/x68k/locore.s	Sun Oct 27 02:06:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.110 2012/05/19 08:29:32 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.111 2013/10/27 02:06:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -777,6 +777,8 @@ Lstart1:
 #endif
 	movl	#_C_LABEL(end),%d5	| end of static kernel text/data
 Lstart2:
+	RELOC(setmemrange,%a0)		| call setmemrange()
+	jbsr	%a0@			|  to probe all memory regions
 	addl	#PAGE_SIZE-1,%d5
 	andl	#PG_FRAME,%d5		| round to a page
 	movl	%d5,%a4

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.186 src/sys/arch/x68k/x68k/machdep.c:1.187
--- src/sys/arch/x68k/x68k/machdep.c:1.186	Tue Jan 22 11:58:39 2013
+++ src/sys/arch/x68k/x68k/machdep.c	Sun Oct 27 02:06:06 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.186 2013/01/22 11:58:39 isaki Exp $	*/
+/*	$NetBSD: machdep.c,v 1.187 2013/10/27 02:06:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.186 2013/01/22 11:58:39 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.187 2013/10/27 02:06:06 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -130,10 +130,6 @@ void	initcpu(void);
 int	cpu_dumpsize(void);
 int	cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
 void	cpu_init_kcore_hdr(void);
-#ifdef EXTENDED_MEMORY
-static int mem_exists(void *, u_long);
-static void setmemrange(void);
-#endif
 
 /* functions called from locore.s */
 void	x68k_init(void);
@@ -142,6 +138,24 @@ void	straytrap(int, u_short);
 void	nmihand(struct frame);
 void	intrhand(int);
 
+/* memory probe function called from locore.s */
+void	setmemrange(void);
+#ifdef EXTENDED_MEMORY
+static bool mem_exists(paddr_t, paddr_t);
+#endif
+
+typedef struct {
+	paddr_t start;
+	paddr_t end;
+} phys_seg_t;
+
+static int basemem;
+static phys_seg_t phys_basemem_seg;
+#ifdef EXTENDED_MEMORY
+#define EXTMEM_SEGS	(VM_PHYSSEG_MAX - 1)
+static phys_seg_t phys_extmem_seg[EXTMEM_SEGS];
+#endif
+
 /*
  * On the 68020/68030, the value of delay_divisor is roughly
  * 2048 / cpuspeed (where cpuspeed is in MHz).
@@ -167,24 +181,35 @@ x68k_init(void)
 {
 	u_int i;
 	paddr_t msgbuf_pa;
+	paddr_t s, e;
 
 	/*
-	 * Tell the VM system about available physical memory.
+	 * Most m68k ports allocate msgbuf at the end of available memory
+	 * (i.e. just after avail_end), but on x68k we allocate msgbuf
+	 * at the end of main memory for compatibility.
 	 */
-	uvm_page_physload(atop(avail_start), atop(avail_end),
-	atop(avail_start), atop(avail_end),
-	VM_FREELIST_MAINMEM);
+	msgbuf_pa = phys_basemem_seg.end - m68k_round_page(MSGBUFSIZE);
 
 	/*
-	 * avail_end was pre-decremented in pmap_bootstrap to compensate
-	 * for msgbuf pages, but avail_end is also used to check DMA'able
-	 * memory range for intio devices and it would be updated per
-	 * probed extended memories, so explicitly save msgbuf address here.
+	 * Tell the VM system about available physical memory.
 	 */
-	msgbuf_pa = avail_end;
+	/* load the main memory region */
+	s = avail_start;
+	e = msgbuf_pa;
+	uvm_page_physload(atop(s), atop(e), atop(s), atop(e),
+	VM_FREELIST_MAINMEM);
 
 #ifdef EXTENDED_MEMORY
-	setmemrange();
+	/* load extended memory regions */
+	for (i = 0; i < EXTMEM_SEGS; i++) {
+		if (phys_extmem_seg[i].start == phys_extmem_seg[i].end)
+			continue;
+		uvm_page_physload(atop(phys_extmem_seg[i].start),
+		atop(phys_extmem_seg[i].end),
+		atop(phys_extmem_seg[i].start),
+		atop(phys_extmem_seg[i].end),
+		VM_FREELIST_HIGHMEM);
+	}
 #endif
 
 	/*
@@ -1011,57 +1036,63 @@ module_init_md(void)
 #endif
 
 #ifdef EXTENDED_MEMORY
-#ifdef EM_DEBUG
-static int em_debug = 0;
-#define DPRINTF(str) do{ if (em_debug) printf str; } while (0);
-#else
-#define DPRINTF(str)
-#endif
 
-static struct memlist {
-	void *base

CVS commit: src/sys/arch/x68k/x68k

2012-07-30 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jul 30 17:20:00 UTC 2012

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

Log Message:
Remove extra definition of physmem (locore sets it anyway). Someone please
check.


To generate a diff of this commit:
cvs rdiff -u -r1.184 -r1.185 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.184 src/sys/arch/x68k/x68k/machdep.c:1.185
--- src/sys/arch/x68k/x68k/machdep.c:1.184	Fri Jul 27 01:36:12 2012
+++ src/sys/arch/x68k/x68k/machdep.c	Mon Jul 30 13:19:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.184 2012/07/27 05:36:12 matt Exp $	*/
+/*	$NetBSD: machdep.c,v 1.185 2012/07/30 17:19:59 christos Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.184 2012/07/27 05:36:12 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.185 2012/07/30 17:19:59 christos Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -122,7 +122,6 @@ extern u_int lowram;
 extern int end, *esym;
 
 int	maxmem;			/* max memory per process */
-int	physmem = MAXMEM;	/* max supported memory, changes to actual */
 
 /* prototypes for local functions */
 void	identifycpu(void);



CVS commit: src/sys/arch/x68k/x68k

2012-05-21 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue May 22 04:03:03 UTC 2012

Modified Files:
src/sys/arch/x68k/x68k: clock.c

Log Message:
With the freerunnnig mode, set 0 (=256count) not 0xff (=255count)
in Timer-D.  It fixes the clock ticked faster when timecounter uses
"mfp" (as default choice).  It was introduced in rev 1.24 in 2006.
Thanks tsutsui@ for many comments.
Should be pulled up to netbsd-6 and netbsd-5.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x68k/x68k/clock.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/x68k/x68k/clock.c
diff -u src/sys/arch/x68k/x68k/clock.c:1.33 src/sys/arch/x68k/x68k/clock.c:1.34
--- src/sys/arch/x68k/x68k/clock.c:1.33	Tue Feb  8 20:20:26 2011
+++ src/sys/arch/x68k/x68k/clock.c	Tue May 22 04:03:03 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.33 2011/02/08 20:20:26 rmind Exp $	*/
+/*	$NetBSD: clock.c,v 1.34 2012/05/22 04:03:03 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.33 2011/02/08 20:20:26 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.34 2012/05/22 04:03:03 isaki Exp $");
 
 #include "clock.h"
 
@@ -143,7 +143,7 @@ cpu_initclocks(void)
 	mfp_set_tcdr(CLOCKS_PER_SEC / hz);
 	mfp_bit_set_ierb(MFP_INTR_TIMER_C);
 
-	mfp_set_tddr(0xff);	/* maximum free run -- only 8 bits wide */
+	mfp_set_tddr(0);	/* maximum free run -- only 8 bits wide */
 	mfp_set_tcdcr(mfp_get_tcdcr() | 0x07);	/* 1/200 prescaler */
 
 	tc_init(&tc);



CVS commit: src/sys/arch/x68k/x68k

2012-05-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 19 08:29:32 UTC 2012

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

Log Message:
Fix leftover comment derived from hp300 but not applicable to x68k.


To generate a diff of this commit:
cvs rdiff -u -r1.109 -r1.110 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.109 src/sys/arch/x68k/x68k/locore.s:1.110
--- src/sys/arch/x68k/x68k/locore.s:1.109	Sun Apr 29 07:17:12 2012
+++ src/sys/arch/x68k/x68k/locore.s	Sat May 19 08:29:32 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.109 2012/04/29 07:17:12 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.110 2012/05/19 08:29:32 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -789,13 +789,7 @@ Lstart2:
 
 /*
  * Prepare to enable MMU.
- * Since the kernel is not mapped logical == physical we must insure
- * that when the MMU is turned on, all prefetched addresses (including
- * the PC) are valid.  In order guarantee that, we use the last physical
- * page (which is conveniently mapped == VA) and load it up with enough
- * code to defeat the prefetch, then we execute the jump back to here.
- *
- * Is this all really necessary, or am I paranoid??
+ * Since the kernel is mapped logical == physical, we just turn it on.
  */
 	RELOC(Sysseg_pa, %a0)		| system segment table addr
 	movl	%a0@,%d1		| read value (a PA)



CVS commit: src/sys/arch/x68k/x68k

2012-05-16 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Wed May 16 07:32:30 UTC 2012

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

Log Message:
- Remove duplicated declarations.
- Make declaration of doboot() "extern" explicitly.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.182 src/sys/arch/x68k/x68k/machdep.c:1.183
--- src/sys/arch/x68k/x68k/machdep.c:1.182	Sun May  6 19:46:18 2012
+++ src/sys/arch/x68k/x68k/machdep.c	Wed May 16 07:32:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.182 2012/05/06 19:46:18 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.183 2012/05/16 07:32:30 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.182 2012/05/06 19:46:18 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.183 2012/05/16 07:32:30 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -107,9 +107,7 @@ __KERNEL_RCSID(0, "$NetBSD: machdep.c,v 
 #include 
 #include 
 
-void initcpu(void);
-void identifycpu(void);
-void doboot(void) __attribute__((__noreturn__));
+extern void doboot(void) __attribute__((__noreturn__));
 
 /* the following is used externally (sysctl_hw) */
 char	machine[] = MACHINE;	/* from  */



CVS commit: src/sys/arch/x68k/x68k

2012-05-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue May 15 12:14:59 UTC 2012

Modified Files:
src/sys/arch/x68k/x68k: mainbus.c

Log Message:
com at mainbus was gone.
http://mail-index.NetBSD.org/source-changes/2012/04/29/msg034022.html


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/x68k/x68k/mainbus.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/x68k/x68k/mainbus.c
diff -u src/sys/arch/x68k/x68k/mainbus.c:1.4 src/sys/arch/x68k/x68k/mainbus.c:1.5
--- src/sys/arch/x68k/x68k/mainbus.c:1.4	Sun Oct 16 03:10:18 2011
+++ src/sys/arch/x68k/x68k/mainbus.c	Tue May 15 12:14:59 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: mainbus.c,v 1.4 2011/10/16 03:10:18 isaki Exp $ */
+/* $NetBSD: mainbus.c,v 1.5 2012/05/15 12:14:59 tsutsui Exp $ */
 
 /*
  * Copyright (c) 2008 Tetsuya Isaki. All rights reserved.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.4 2011/10/16 03:10:18 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus.c,v 1.5 2012/05/15 12:14:59 tsutsui Exp $");
 
 #include 
 #include 
@@ -67,6 +67,4 @@ mainbus_attach(device_t parent, device_t
 
 	config_found(self, __UNCONST("intio")  , NULL);
 	config_found(self, __UNCONST("grfbus") , NULL);
-	config_found(self, __UNCONST("com"), NULL);
-	config_found(self, __UNCONST("com"), NULL);
 }



CVS commit: src/sys/arch/x68k/x68k

2012-04-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Mon Apr 23 05:31:31 UTC 2012

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

Log Message:
Print a message before enabling interrupts.  It's helpful to
know when a kernel was hung up.  Suggested by tsutsui@,
the message is derived from arch/sun3/sun3/autoconf.c.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x68k/x68k/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/x68k/x68k/autoconf.c
diff -u src/sys/arch/x68k/x68k/autoconf.c:1.65 src/sys/arch/x68k/x68k/autoconf.c:1.66
--- src/sys/arch/x68k/x68k/autoconf.c:1.65	Thu Nov  5 18:13:07 2009
+++ src/sys/arch/x68k/x68k/autoconf.c	Mon Apr 23 05:31:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.65 2009/11/05 18:13:07 dyoung Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.66 2012/04/23 05:31:31 isaki Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.65 2009/11/05 18:13:07 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.66 2012/04/23 05:31:31 isaki Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "scsibus.h"
@@ -68,6 +68,7 @@ cpu_configure(void)
 		panic("no mainbus found");
 
 	/* Turn on interrupts */
+	printf("enabling interrupts\n");
 	(void) spl0();
 }
 



CVS commit: src/sys/arch/x68k/x68k

2012-02-24 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Feb 25 02:43:08 UTC 2012

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

Log Message:
Reserve more bootstrap kernel PT pages if options EXTENDED_MEMORY is defined
for VA allocation in the extended memory probe function and possible 128MB
memory on 060turbo, as worksaround for x68k specific part of PR/45915.
Fixes GENERIC kernel panic on X68030 even without extended memory.
XXX: we should rather have proper probe function before pmap_bootstrap()

Tested on 060turbo with 128MB SIMM by Y.Sugahara, and also
tested on XM6i with 68030 and custom 128MB memory settings by isaki@.

Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x68k/x68k/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/x68k/x68k/pmap_bootstrap.c
diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.58 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.59
--- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.58	Fri Feb 10 06:28:39 2012
+++ src/sys/arch/x68k/x68k/pmap_bootstrap.c	Sat Feb 25 02:43:08 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.58 2012/02/10 06:28:39 mhitch Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.59 2012/02/25 02:43:08 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,9 +36,10 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.58 2012/02/10 06:28:39 mhitch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.59 2012/02/25 02:43:08 tsutsui Exp $");
 
 #include "opt_m68k_arch.h"
+#include "opt_extmem.h"
 
 #include 
 #include 
@@ -124,6 +125,19 @@ pmap_bootstrap(paddr_t nextpa, paddr_t f
 	kptpa = nextpa;
 	nptpages = RELOC(Sysptsize, int) + howmany(RELOC(physmem, int), NPTEPG) +
 		(IIOMAPSIZE + NPTEPG - 1) / NPTEPG;
+#ifdef EXTENDED_MEMORY
+	/*
+	 * Current supported maximum EXTENDED_MEMORY is 128MB on 060turbo.
+	 */
+#define MAX_EXTENDED_MEMORY	(128 * 1024 * 1024)
+	nptpages += howmany(btoc(MAX_EXTENDED_MEMORY), NPTEPG);
+
+	/*
+	 * mem_exist() in machdep.c needs two extra VA pages before pmap_init()
+	 * to probe >16MB memory.
+	 */
+	nptpages += 1;
+#endif
 	nextpa += nptpages * PAGE_SIZE;
 
 	/*



CVS commit: src/sys/arch/x68k/x68k

2012-01-29 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Sun Jan 29 12:43:00 UTC 2012

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

Log Message:
Make it compile with EM_DEBUG (..here, EM_ is EXTENDED_MEMORY).


To generate a diff of this commit:
cvs rdiff -u -r1.180 -r1.181 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.180 src/sys/arch/x68k/x68k/machdep.c:1.181
--- src/sys/arch/x68k/x68k/machdep.c:1.180	Sat Jan 21 20:19:55 2012
+++ src/sys/arch/x68k/x68k/machdep.c	Sun Jan 29 12:43:00 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.180 2012/01/21 20:19:55 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.181 2012/01/29 12:43:00 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.180 2012/01/21 20:19:55 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.181 2012/01/29 12:43:00 isaki Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -992,8 +992,8 @@ mem_exists(void *mem, u_long basemax)
 	void *begin_check, *end_check;
 	label_t	faultbuf;
 
-	DPRINTF(("Enter mem_exists(%p, %x)\n", mem, basemax));
-	DPRINTF((" pmap_enter(%p, %p) for target... ", mem_v, mem));
+	DPRINTF(("Enter mem_exists(%p, %lx)\n", mem, basemax));
+	DPRINTF((" pmap_enter(%" PRIxVADDR ", %p) for target... ", mem_v, mem));
 	pmap_enter(pmap_kernel(), mem_v, (paddr_t)mem,
 	VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|PMAP_WIRED);
 	pmap_update(pmap_kernel());
@@ -1001,7 +1001,7 @@ mem_exists(void *mem, u_long basemax)
 
 	/* only 24bits are significant on normal X680x0 systems */
 	base = (void *)((u_long)mem & 0x00FF);
-	DPRINTF((" pmap_enter(%p, %p) for shadow... ", base_v, base));
+	DPRINTF((" pmap_enter(%" PRIxVADDR ", %p) for shadow... ", base_v, base));
 	pmap_enter(pmap_kernel(), base_v, (paddr_t)base,
 	VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|PMAP_WIRED);
 	pmap_update(pmap_kernel());



CVS commit: src/sys/arch/x68k/x68k

2011-11-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Nov  4 17:51:54 UTC 2011

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

Log Message:
64040 -> 68040 in comment


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.104 src/sys/arch/x68k/x68k/locore.s:1.105
--- src/sys/arch/x68k/x68k/locore.s:1.104	Sun Oct  9 08:51:56 2011
+++ src/sys/arch/x68k/x68k/locore.s	Fri Nov  4 17:51:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.104 2011/10/09 08:51:56 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.105 2011/11/04 17:51:54 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -253,7 +253,7 @@ Lisberr:
 #include "opt_fpu_emulate.h"
 ENTRY_NOPROFILE(fpfline)
 #if defined(M68040)
-	cmpl	#FPU_68040,_C_LABEL(fputype) | 64040 FPU?
+	cmpl	#FPU_68040,_C_LABEL(fputype) | 68040 FPU?
 	jne	Lfp_unimp		| no, skip FPSP
 	cmpw	#0x202c,%sp@(6)		| format type 2?
 	jne	_C_LABEL(illinst)	| no, not an FP emulation



CVS commit: src/sys/arch/x68k/x68k

2011-10-09 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun Oct  9 08:51:56 UTC 2011

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

Log Message:
Make NetBSD/x68k kernel work with 8KB/page (i.e. PGSHIFT==13) settings.

It's quite interesting to check ATC miss rate with both settings on XM6i,
as noted in XM6i presentation by isaki@ at OSC 2011 Hiroshima.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.103 src/sys/arch/x68k/x68k/locore.s:1.104
--- src/sys/arch/x68k/x68k/locore.s:1.103	Sat May 14 10:49:06 2011
+++ src/sys/arch/x68k/x68k/locore.s	Sun Oct  9 08:51:56 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.103 2011/05/14 10:49:06 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.104 2011/10/09 08:51:56 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -870,7 +870,11 @@ Ljupiterdone:
 	.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
 #ifdef M68060
 	RELOC(cputype, %a0)
@@ -887,7 +891,11 @@ Lnot060cache:
 	movc	%d0,%cacr		| turn on both caches
 	jmp	Lenab1
 Lmotommu2:
+#if PGSHIFT == 13
+	movl	#0x82d08b00,%sp@-	| value to load TC with
+#else
 	movl	#0x82c0aa00,%sp@-	| value to load TC with
+#endif
 	pmove	%sp@,%tc		| load it
 
 /*



CVS commit: src/sys/arch/x68k/x68k

2011-05-15 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sun May 15 17:27:49 UTC 2011

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

Log Message:
Misc KNF and cosmetics.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.175 src/sys/arch/x68k/x68k/machdep.c:1.176
--- src/sys/arch/x68k/x68k/machdep.c:1.175	Sat May 14 10:57:50 2011
+++ src/sys/arch/x68k/x68k/machdep.c	Sun May 15 17:27:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.175 2011/05/14 10:57:50 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.176 2011/05/15 17:27:49 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175 2011/05/14 10:57:50 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.176 2011/05/15 17:27:49 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -131,8 +131,8 @@
 int	safepri = PSL_LOWIPL;
 
 /* prototypes for local functions */
-voididentifycpu(void);
-voidinitcpu(void);
+void	identifycpu(void);
+void	initcpu(void);
 int	cpu_dumpsize(void);
 int	cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
 void	cpu_init_kcore_hdr(void);
@@ -144,7 +144,7 @@
 /* functions called from locore.s */
 void	x68k_init(void);
 void	dumpsys(void);
-voidstraytrap(int, u_short);
+void	straytrap(int, u_short);
 void	nmihand(struct frame);
 void	intrhand(int);
 
@@ -202,6 +202,7 @@
 void
 consinit(void)
 {
+
 	/*
 	 * bring graphics layer up.
 	 */
@@ -217,7 +218,7 @@
 #endif
 #if NKSYMS || defined(DDB) || defined(MODULAR)
 	ksyms_addsyms_elf((int)esym - (int)&end - sizeof(Elf32_Ehdr),
-		 (void *)&end, esym);
+	(void *)&end, esym);
 #endif
 #ifdef DDB
 	if (boothowto & RB_KDB)
@@ -263,7 +264,7 @@
 	 * Allocate a submap for physio
 	 */
 	phys_map = uvm_km_suballoc(kernel_map, &minaddr, &maxaddr,
-   VM_PHYS_SIZE, 0, false, NULL);
+	VM_PHYS_SIZE, 0, false, NULL);
 
 #ifdef DEBUG
 	pmapdebug = opmapdebug;
@@ -319,7 +320,7 @@
 char	cpu_model[96];		/* max 85 chars */
 static const char *fpu_descr[] = {
 #ifdef	FPU_EMULATE
-	", emulator FPU", 	/* 0 */
+	", emulator FPU",	/* 0 */
 #else
 	", no math support",	/* 0 */
 #endif
@@ -399,7 +400,7 @@
 	else
 		fpu = ", unknown FPU";
 	sprintf(cpu_model, "X68%s (%s CPU%s%s, %s clock)",
-		mach, cpu_type, mmu, fpu, clock);
+	mach, cpu_type, mmu, fpu, clock);
 	printf("%s\n", cpu_model);
 }
 
@@ -410,16 +411,16 @@
 {
 
 	sysctl_createv(clog, 0, NULL, NULL,
-		   CTLFLAG_PERMANENT,
-		   CTLTYPE_NODE, "machdep", NULL,
-		   NULL, 0, NULL, 0,
-		   CTL_MACHDEP, CTL_EOL);
+	CTLFLAG_PERMANENT,
+	CTLTYPE_NODE, "machdep", NULL,
+	NULL, 0, NULL, 0,
+	CTL_MACHDEP, CTL_EOL);
 
 	sysctl_createv(clog, 0, NULL, NULL,
-		   CTLFLAG_PERMANENT,
-		   CTLTYPE_STRUCT, "console_device", NULL,
-		   sysctl_consdev, 0, NULL, sizeof(dev_t),
-		   CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
+	CTLFLAG_PERMANENT,
+	CTLTYPE_STRUCT, "console_device", NULL,
+	sysctl_consdev, 0, NULL, sizeof(dev_t),
+	CTL_MACHDEP, CPU_CONSDEV, CTL_EOL);
 }
 
 int	waittime = -1;
@@ -487,7 +488,7 @@
 	printf("rebooting...\n");
 	DELAY(100);
 	doboot();
-	/*NOTREACHED*/
+	/* NOTREACHED */
 }
 
 /*
@@ -530,7 +531,7 @@
 	/*
 	 * Initialize pointer to kernel segment table.
 	 */
-	m->sysseg_pa = (u_int32_t)(pmap_kernel()->pm_stpa);
+	m->sysseg_pa = (uint32_t)(pmap_kernel()->pm_stpa);
 
 	/*
 	 * Initialize relocation value such that:
@@ -542,7 +543,7 @@
 	/*
 	 * Define the end of the relocatable range.
 	 */
-	m->relocend = (u_int32_t)&end;
+	m->relocend = (uint32_t)&end;
 
 	/*
 	 * X68k has multiple RAM segments on some models.
@@ -550,9 +551,10 @@
 	m->ram_segs[0].start = lowram;
 	m->ram_segs[0].size = mem_size - lowram;
 	for (i = 1; i < vm_nphysseg; i++) {
-		m->ram_segs[i].start = ctob(VM_PHYSMEM_PTR(i)->start);
-		m->ram_segs[i].size  = ctob(VM_PHYSMEM_PTR(i)->end
-	- VM_PHYSMEM_PTR(i)->start);
+		m->ram_segs[i].start =
+		ctob(VM_PHYSMEM_PTR(i)->start);
+		m->ram_segs[i].size  =
+		ctob(VM_PHYSMEM_PTR(i)->end - VM_PHYSMEM_PTR(i)->start);
 	}
 }
 
@@ -599,7 +601,7 @@
 /*
  * These variables are needed by /sbin/savecore
  */
-u_int32_t dumpmag = 0x8fca0101;	/* magic number */
+uint32_t dumpmag = 0x8fca0101;	/* magic number */
 int	dumpsize = 0;		/* pages */
 long	dumplo = 0;		/* blocks */
 
@@ -767,12 +769,12 @@
 #if defined(M68060)
 	extern void *vectab[256];
 #if defined(M060SP)
-	extern u_int8_t I_CALL_TOP[];
-	extern u_int8_t FP_CALL_TOP[];
+	extern uint8_t I_CALL_TOP[];
+	extern uint8_t FP_CALL_TOP[];
 #else
-	extern u_int8_t illinst;
+	extern uint8_t illinst;
 #endif
-	extern u_int8_t fpfault;
+	extern uint8_t fpfault;
 #endif
 
 #ifdef MAPPEDCOPY
@@ -782

CVS commit: src/sys/arch/x68k/x68k

2011-05-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 14 10:57:50 UTC 2011

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

Log Message:
Use pmap_kenter_pa(9) for msgbuf memory which is not managed by VM.


To generate a diff of this commit:
cvs rdiff -u -r1.174 -r1.175 src/sys/arch/x68k/x68k/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/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.174 src/sys/arch/x68k/x68k/machdep.c:1.175
--- src/sys/arch/x68k/x68k/machdep.c:1.174	Sat May 14 10:49:06 2011
+++ src/sys/arch/x68k/x68k/machdep.c	Sat May 14 10:57:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.174 2011/05/14 10:49:06 tsutsui Exp $	*/
+/*	$NetBSD: machdep.c,v 1.175 2011/05/14 10:57:50 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.174 2011/05/14 10:49:06 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175 2011/05/14 10:57:50 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -188,9 +188,8 @@
 	 * avail_end was pre-decremented in pmap_bootstrap to compensate.
 	 */
 	for (i = 0; i < btoc(MSGBUFSIZE); i++)
-		pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
-		avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
-		VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
+		pmap_kenter_pa((vaddr_t)msgbufaddr + i * PAGE_SIZE,
+		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/x68k/x68k

2011-05-14 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat May 14 10:49:06 UTC 2011

Modified Files:
src/sys/arch/x68k/x68k: locore.s machdep.c

Log Message:
It's a bit horrible to call uvm_page_physload() from consinit().
Instead, prepare x68k_init() function for pre-main MD initialization as other
m68k ports and move uvm_page_physload() call and msgbuf initialization there.

Tested on X68030, but options EXTENDED_MEMORY is untested.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/arch/x68k/x68k/locore.s
cvs rdiff -u -r1.173 -r1.174 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.102 src/sys/arch/x68k/x68k/locore.s:1.103
--- src/sys/arch/x68k/x68k/locore.s:1.102	Wed May 11 14:17:29 2011
+++ src/sys/arch/x68k/x68k/locore.s	Sat May 14 10:49:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.102 2011/05/11 14:17:29 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.103 2011/05/14 10:49:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -930,6 +930,7 @@
 /* final setup for C code */
 	movl	%d7,_C_LABEL(boothowto)	| save reboot flags
 	movl	%d6,_C_LABEL(bootdev)	|   and boot device
+	jbsr	_C_LABEL(x68k_init)	| additional pre-main initialization
 
 /*
  * Create a fake exception frame so that cpu_lwp_fork() can copy it.

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.173 src/sys/arch/x68k/x68k/machdep.c:1.174
--- src/sys/arch/x68k/x68k/machdep.c:1.173	Fri Mar  4 22:25:30 2011
+++ src/sys/arch/x68k/x68k/machdep.c	Sat May 14 10:49:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.173 2011/03/04 22:25:30 joerg Exp $	*/
+/*	$NetBSD: machdep.c,v 1.174 2011/05/14 10:49:06 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.173 2011/03/04 22:25:30 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.174 2011/05/14 10:49:06 tsutsui Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -142,6 +142,7 @@
 #endif
 
 /* functions called from locore.s */
+void	x68k_init(void);
 void	dumpsys(void);
 voidstraytrap(int, u_short);
 void	nmihand(struct frame);
@@ -167,6 +168,33 @@
 
 static callout_t candbtimer_ch;
 
+void
+x68k_init(void)
+{
+	u_int i;
+
+	/*
+	 * Tell the VM system about available physical memory.
+	 */
+	uvm_page_physload(atop(avail_start), atop(avail_end),
+	atop(avail_start), atop(avail_end),
+	VM_FREELIST_DEFAULT);
+#ifdef EXTENDED_MEMORY
+	setmemrange();
+#endif
+
+	/*
+	 * Initialize error message buffer (at end of core).
+	 * avail_end was pre-decremented in pmap_bootstrap to compensate.
+	 */
+	for (i = 0; i < btoc(MSGBUFSIZE); i++)
+		pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
+		avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
+		VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
+	pmap_update(pmap_kernel());
+	initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE));
+}
+
 /*
  * Console initialization: called early on from main,
  * before vm init or startup.  Do enough configuration
@@ -196,16 +224,6 @@
 	if (boothowto & RB_KDB)
 		Debugger();
 #endif
-
-	/*
-	 * Tell the VM system about available physical memory.
-	 */
-	uvm_page_physload(atop(avail_start), atop(avail_end),
-			atop(avail_start), atop(avail_end),
-			VM_FREELIST_DEFAULT);
-#ifdef EXTENDED_MEMORY
-	setmemrange();
-#endif
 }
 
 /*
@@ -217,7 +235,6 @@
 {
 	vaddr_t minaddr, maxaddr;
 	char pbuf[9];
-	u_int i;
 #ifdef DEBUG
 	extern int pmapdebug;
 	int opmapdebug = pmapdebug;
@@ -229,17 +246,6 @@
 		m68k_make_fpu_idle_frame();
 
 	/*
-	 * Initialize error message buffer (at end of core).
-	 * avail_end was pre-decremented in pmap_bootstrap to compensate.
-	 */
-	for (i = 0; i < btoc(MSGBUFSIZE); i++)
-		pmap_enter(pmap_kernel(), (vaddr_t)msgbufaddr + i * PAGE_SIZE,
-		avail_end + i * PAGE_SIZE, VM_PROT_READ|VM_PROT_WRITE,
-		VM_PROT_READ|VM_PROT_WRITE|PMAP_WIRED);
-	pmap_update(pmap_kernel());
-	initmsgbuf(msgbufaddr, m68k_round_page(MSGBUFSIZE));
-
-	/*
 	 * Initialize the kernel crash dump header.
 	 */
 	cpu_init_kcore_hdr();



CVS commit: src/sys/arch/x68k/x68k

2011-05-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Wed May 11 14:17:30 UTC 2011

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

Log Message:
Defer fpu_probe() call until curlwp and related variables are initialized.
Fixes pre-consinit KASSERT() in trap() caused by fnop instruction in
fpu_probe() on machines without FPU, including XM6i.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/arch/x68k/x68k/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/x68k/x68k/locore.s
diff -u src/sys/arch/x68k/x68k/locore.s:1.101 src/sys/arch/x68k/x68k/locore.s:1.102
--- src/sys/arch/x68k/x68k/locore.s:1.101	Tue Feb  8 20:20:26 2011
+++ src/sys/arch/x68k/x68k/locore.s	Wed May 11 14:17:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.101 2011/02/08 20:20:26 rmind Exp $	*/
+/*	$NetBSD: locore.s,v 1.102 2011/05/11 14:17:29 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -898,9 +898,6 @@
 	movl	#_C_LABEL(vectab),%d0	| set Vector Base Register
 	movc	%d0,%vbr
 	lea	_ASM_LABEL(tmpstk),%sp	| temporary stack
-/* detect FPU type */
-	jbsr	_C_LABEL(fpu_probe)
-	movl	%d0,_C_LABEL(fputype)
 /* call final pmap setup */
 	jbsr	_C_LABEL(pmap_bootstrap_finalize)
 /* set kernel stack, user SP */
@@ -909,6 +906,9 @@
 	movl	#USRSTACK-4,%a2
 	movl	%a2,%usp		| init user SP
 
+/* detect FPU type */
+	jbsr	_C_LABEL(fpu_probe)
+	movl	%d0,_C_LABEL(fputype)
 	tstl	_C_LABEL(fputype)	| Have an FPU?
 	jeq	Lenab2			| No, skip.
 	clrl	%a1@(PCB_FPCTX)		| ensure null FP context



CVS commit: src/sys/arch/x68k/x68k

2011-05-04 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Thu May  5 04:38:20 UTC 2011

Modified Files:
src/sys/arch/x68k/x68k: disksubr.c

Log Message:
Fix buffer overrun in readdisklabel(9) (and writedisklabel(9))
that causes unexpected panic during installation and
DIAGNOSTIC pool assertions.
Also fix bp->b_flags in writedisklabel(9) error path.

The problem was reported from Y.Sugahara during XM6i development,
and this fix is confirmed on both X68030 (by me) and XM6i (by Sugahara).

XXX: broken dkbad support (which makes struct cpu_disklabel larger
XXX: than 512 bytes) should be removed...


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/arch/x68k/x68k/disksubr.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/x68k/x68k/disksubr.c
diff -u src/sys/arch/x68k/x68k/disksubr.c:1.33 src/sys/arch/x68k/x68k/disksubr.c:1.34
--- src/sys/arch/x68k/x68k/disksubr.c:1.33	Wed Jan  2 11:48:32 2008
+++ src/sys/arch/x68k/x68k/disksubr.c	Thu May  5 04:38:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: disksubr.c,v 1.33 2008/01/02 11:48:32 ad Exp $	*/
+/*	$NetBSD: disksubr.c,v 1.34 2011/05/05 04:38:20 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.33 2008/01/02 11:48:32 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: disksubr.c,v 1.34 2011/05/05 04:38:20 tsutsui Exp $");
 
 #include "opt_compat_netbsd.h"
 
@@ -69,7 +69,7 @@
 	struct buf *bp;
 	struct disklabel *dlp;
 	const char *msg = NULL;
-	int i, labelsz;
+	int i, bsdlabelsz, humanlabelsz;
 
 	if (osdep)
 		dp = osdep->dosparts;
@@ -90,15 +90,19 @@
 	lp->d_partitions[0].p_offset = 0;
 
 	/* get a buffer and initialize it */
-	bp = geteblk((int)lp->d_secsize);
+	bsdlabelsz =
+	howmany(LABELOFFSET + sizeof(struct disklabel), lp->d_secsize)
+	* lp->d_secsize;
+	humanlabelsz =
+	howmany(sizeof(struct cpu_disklabel), lp->d_secsize)
+	* lp->d_secsize;
+	bp = geteblk(MAX(bsdlabelsz, humanlabelsz));
 	bp->b_dev = dev;
 
 	/* read BSD disklabel first */
 	bp->b_blkno = LABELSECTOR;
 	bp->b_cylinder = LABELSECTOR/lp->d_secpercyl;
-	labelsz = howmany(LABELOFFSET+sizeof(struct disklabel), lp->d_secsize)
-		* lp->d_secsize;
-	bp->b_bcount = labelsz;	/* to support < 512B/sector disks */
+	bp->b_bcount = bsdlabelsz;	/* to support < 512B/sector disks */
 	bp->b_flags |= B_READ;
 	(*strat)(bp);
 
@@ -109,7 +113,7 @@
 	}
 	for (dlp = (struct disklabel *)bp->b_data;
 	 dlp <= (struct disklabel *)
-		((char *)bp->b_data + labelsz - sizeof(*dlp));
+		((char *)bp->b_data + bsdlabelsz - sizeof(*dlp));
 	 dlp = (struct disklabel *)((uint8_t *)dlp + sizeof(long))) {
 		if (dlp->d_magic != DISKMAGIC || dlp->d_magic2 != DISKMAGIC) {
 			if (msg == NULL)
@@ -135,9 +139,7 @@
 	bp->b_blkno = DOSPARTOFF * DEF_BSIZE / lp->d_secsize;
 /* DOSPARTOFF in DEV_BSIZE unit */
 	bp->b_cylinder = DOSBBSECTOR / lp->d_secpercyl;
-	labelsz = howmany(sizeof(struct cpu_disklabel),
-			  lp->d_secsize) * lp->d_secsize;
-	bp->b_bcount = labelsz;	/* to support < 512B/sector disks */
+	bp->b_bcount = humanlabelsz;	/* to support < 512B/sector disks */
 	bp->b_oflags &= ~(BO_DONE);
 	(*strat)(bp);
 
@@ -313,7 +315,7 @@
 	struct dos_partition *dp = 0;
 	struct buf *bp;
 	struct disklabel *dlp;
-	int error, labelsz, i;
+	int error, bsdlabelsz, humanlabelsz, i;
 	const char *np;
 
 	if (osdep)
@@ -326,15 +328,19 @@
 		parttbl_consistency_check(lp, dp);
 
 	/* get a buffer and initialize it */
-	bp = geteblk((int)lp->d_secsize);
+	bsdlabelsz =
+	howmany(LABELOFFSET + sizeof(struct disklabel), lp->d_secsize)
+	* lp->d_secsize;
+	humanlabelsz =
+	howmany(sizeof(struct cpu_disklabel), lp->d_secsize)
+	* lp->d_secsize;
+	bp = geteblk(MAX(bsdlabelsz, humanlabelsz));
 	bp->b_dev = dev;
 
 	/* attempt to write BSD disklabel first */
 	bp->b_blkno = LABELSECTOR;
 	bp->b_cylinder = LABELSECTOR / lp->d_secpercyl;
-	labelsz = howmany(LABELOFFSET+sizeof(struct disklabel), lp->d_secsize)
-		* lp->d_secsize;
-	bp->b_bcount = labelsz;	/* to support < 512B/sector disks */
+	bp->b_bcount = bsdlabelsz;	/* to support < 512B/sector disks */
 	bp->b_flags |= B_READ;
 	(*strat)(bp);
 
@@ -344,7 +350,7 @@
 	error = ESRCH;
 	for (dlp = (struct disklabel *)bp->b_data;
 	 dlp <= (struct disklabel *)
-		((char *)bp->b_data + labelsz - sizeof(*dlp));
+		((char *)bp->b_data + bsdlabelsz - sizeof(*dlp));
 	 dlp = (struct disklabel *)((char *)dlp + sizeof(long))) {
 		if (dlp->d_magic == DISKMAGIC && dlp->d_magic2 == DISKMAGIC &&
 		dkcksum(dlp) == 0) {
@@ -370,6 +376,7 @@
 		bp->b_blkno = DOSBBSECTOR;
 		bp->b_bcount = lp->d_secsize;
 		bp->b_oflags &= ~(BO_DONE);
+		bp->b_flags &= ~(B_WRITE);
 		bp->b_flags |= B_READ;
 		bp->b_cylinder = DOSBBSECTOR / lp->d_secpercyl;
 		(*strat)(bp);
@@ -379,10 +386,9 @@
 
 		/* read the partition table */
 		bp->b_blk

CVS commit: src/sys/arch/x68k/x68k

2010-12-25 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Dec 25 16:37:22 UTC 2010

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

Log Message:
Fix one more typo that affects x68k with 040/060.
I hope this is the last one...


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x68k/x68k/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/x68k/x68k/pmap_bootstrap.c
diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.51 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.52
--- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.51	Sun Jun  6 04:50:08 2010
+++ src/sys/arch/x68k/x68k/pmap_bootstrap.c	Sat Dec 25 16:37:22 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.51 2010/06/06 04:50:08 mrg Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.52 2010/12/25 16:37:22 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.51 2010/06/06 04:50:08 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.52 2010/12/25 16:37:22 tsutsui Exp $");
 
 #include "opt_m68k_arch.h"
 
@@ -188,7 +188,7 @@
 		nl1desc = howmany(nl2desc, SG4_LEV2SIZE);
 		ste = (st_entry_t *)kstpa;
 		este = &ste[nl1desc];
-		protoste = (paddr_t)este[SG4_LEV1SIZE] | SG_U | SG_RW | SG_V;
+		protoste = (paddr_t)&ste[SG4_LEV1SIZE] | SG_U | SG_RW | SG_V;
 		while (ste < este) {
 			*ste++ = protoste;
 			protoste += (SG4_LEV2SIZE * sizeof(st_entry_t));



CVS commit: src/sys/arch/x68k/x68k

2009-12-11 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Fri Dec 11 19:36:05 UTC 2009

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

Log Message:
Fix leftover botch in rev 1.48:
 Remove initialization of protection_codes[] which has been movde into
 pmap_bootstrap_finalize().


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/x68k/x68k/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/x68k/x68k/pmap_bootstrap.c
diff -u src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.48 src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.49
--- src/sys/arch/x68k/x68k/pmap_bootstrap.c:1.48	Sun Dec  6 06:41:31 2009
+++ src/sys/arch/x68k/x68k/pmap_bootstrap.c	Fri Dec 11 19:36:05 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap_bootstrap.c,v 1.48 2009/12/06 06:41:31 tsutsui Exp $	*/
+/*	$NetBSD: pmap_bootstrap.c,v 1.49 2009/12/11 19:36:05 tsutsui Exp $	*/
 
 /* 
  * Copyright (c) 1991, 1993
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.48 2009/12/06 06:41:31 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap_bootstrap.c,v 1.49 2009/12/11 19:36:05 tsutsui Exp $");
 
 #include "opt_m680x0.h"
 
@@ -408,26 +408,6 @@
 	RELOC(virtual_end, vaddr_t) = VM_MAX_KERNEL_ADDRESS;
 
 	/*
-	 * Initialize protection array.
-	 * XXX don't use a switch statement, it might produce an
-	 * absolute "jmp" table.
-	 */
-	{
-		u_int *kp;
-
-		kp = &RELOC(protection_codes, u_int);
-		kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_NONE] = 0;
-		kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_NONE] = PG_RO;
-		kp[VM_PROT_READ|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO;
-		kp[VM_PROT_NONE|VM_PROT_NONE|VM_PROT_EXECUTE] = PG_RO;
-		kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW;
-		kp[VM_PROT_NONE|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW;
-		kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_NONE] = PG_RW;
-		kp[VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE] = PG_RW;
-	}
-
-
-	/*
 	 * Allocate some fixed, special purpose kernel virtual addresses
 	 */
 	{