CVS commit: src/sys/dev/wsfb

2018-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 04:20:10 UTC 2018

Modified Files:
src/sys/dev/wsfb: genfb.c

Log Message:
CID-1427771: Remove incorrect pre-condition (index cannot be 256!)


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/dev/wsfb/genfb.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/dev/wsfb/genfb.c
diff -u src/sys/dev/wsfb/genfb.c:1.61 src/sys/dev/wsfb/genfb.c:1.62
--- src/sys/dev/wsfb/genfb.c:1.61	Wed May 31 22:45:12 2017
+++ src/sys/dev/wsfb/genfb.c	Sat Jan 20 23:20:10 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: genfb.c,v 1.61 2017/06/01 02:45:12 chs Exp $ */
+/*	$NetBSD: genfb.c,v 1.62 2018/01/21 04:20:10 christos Exp $ */
 
 /*-
  * Copyright (c) 2007 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.61 2017/06/01 02:45:12 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: genfb.c,v 1.62 2018/01/21 04:20:10 christos Exp $");
 
 #include 
 #include 
@@ -611,8 +611,7 @@ genfb_putcmap(struct genfb_softc *sc, st
 #ifdef GENFB_DEBUG
 	aprint_debug("putcmap: %d %d\n",index, count);
 #endif
-	if (cm->index >= 256 || cm->count > 256 ||
-	(cm->index + cm->count) > 256)
+	if (index + count > 256)
 		return EINVAL;
 	error = copyin(cm->red, &rbuf[index], count);
 	if (error)



CVS commit: src/sys/dev/pci

2018-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 04:07:49 UTC 2018

Modified Files:
src/sys/dev/pci: if_wm.c

Log Message:
CID-1427779: Fix uninitialized variables


To generate a diff of this commit:
cvs rdiff -u -r1.557 -r1.558 src/sys/dev/pci/if_wm.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/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.557 src/sys/dev/pci/if_wm.c:1.558
--- src/sys/dev/pci/if_wm.c:1.557	Thu Jan 18 04:36:26 2018
+++ src/sys/dev/pci/if_wm.c	Sat Jan 20 23:07:49 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.557 2018/01/18 09:36:26 knakahara Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.558 2018/01/21 04:07:49 christos Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.557 2018/01/18 09:36:26 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.558 2018/01/21 04:07:49 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -12589,7 +12589,7 @@ wm_nvm_version(struct wm_softc *sc)
 	case WM_T_82575:
 	case WM_T_82576:
 	case WM_T_82580:
-		if ((uid1 & NVM_MAJOR_MASK) != NVM_UID_VALID)
+		if (have_uid && (uid1 & NVM_MAJOR_MASK) != NVM_UID_VALID)
 			check_version = true;
 		break;
 	case WM_T_I211:



CVS commit: src/sys/dev/wscons

2018-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan 21 01:18:48 UTC 2018

Modified Files:
src/sys/dev/wscons: wsemul_vt100.c

Log Message:
make check cleaner, and simplify the code.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/wscons/wsemul_vt100.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/dev/wscons/wsemul_vt100.c
diff -u src/sys/dev/wscons/wsemul_vt100.c:1.42 src/sys/dev/wscons/wsemul_vt100.c:1.43
--- src/sys/dev/wscons/wsemul_vt100.c:1.42	Sat Jan 20 18:27:06 2018
+++ src/sys/dev/wscons/wsemul_vt100.c	Sat Jan 20 20:18:48 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $ */
+/* $NetBSD: wsemul_vt100.c,v 1.43 2018/01/21 01:18:48 christos Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.43 2018/01/21 01:18:48 christos Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsmsgattrs.h"
@@ -230,7 +230,7 @@ wsemul_vt100_cnattach(const struct wsscr
 	edp->isolatin1tab = edp->decgraphtab = edp->dectechtab = 0;
 	edp->nrctab = 0;
 	wsemul_vt100_reset(edp);
-	return (edp);
+	return edp;
 }
 
 void *
@@ -263,7 +263,7 @@ wsemul_vt100_attach(int console, const s
 	edp->nrctab = malloc(128 * sizeof(int), M_DEVBUF, M_NOWAIT);
 	vt100_initchartables(edp);
 	wsemul_vt100_reset(edp);
-	return (edp);
+	return edp;
 }
 
 void
@@ -461,7 +461,7 @@ wsemul_vt100_output_c0c1(struct wsemul_v
 		break;
 	case ASCII_ESC:
 		if (kernel) {
-			printf("wsemul_vt100_output_c0c1: ESC in kernel output ignored\n");
+			printf("%s: ESC in kernel output ignored\n", __func__);
 			break;	/* ignore the ESC */
 		}
 
@@ -490,7 +490,8 @@ wsemul_vt100_output_c0c1(struct wsemul_v
 	case ST: /* string end 8-bit */
 		/* XXX only in VT100_EMUL_STATE_STRING */
 		wsemul_vt100_handle_dcs(edp);
-		return (VT100_EMUL_STATE_NORMAL);
+		edp->state = VT100_EMUL_STATE_NORMAL;
+		break;
 #endif
 	case ASCII_LF:
 	case ASCII_VT:
@@ -504,7 +505,6 @@ static u_int
 wsemul_vt100_output_esc(struct wsemul_vt100_emuldata *edp, u_char c)
 {
 	struct vt100base_data *vd = &edp->bd;
-	u_int newstate = VT100_EMUL_STATE_NORMAL;
 	int i;
 
 	switch (c) {
@@ -512,8 +512,7 @@ wsemul_vt100_output_esc(struct wsemul_vt
 		vd->nargs = 0;
 		memset(vd->args, 0, sizeof (vd->args));
 		vd->modif1 = vd->modif2 = '\0';
-		newstate = VT100_EMUL_STATE_CSI;
-		break;
+		return VT100_EMUL_STATE_CSI;
 	case '7': /* DECSC */
 		vd->flags |= VTFL_SAVEDCURS;
 		edp->savedcursor_row = vd->crow;
@@ -591,8 +590,7 @@ wsemul_vt100_output_esc(struct wsemul_vt
 	case 'P': /* DCS */
 		vd->nargs = 0;
 		memset(vd->args, 0, sizeof (vd->args));
-		newstate = VT100_EMUL_STATE_DCS;
-		break;
+		return VT100_EMUL_STATE_DCS;
 	case 'c': /* RIS */
 		wsemul_vt100_reset(edp);
 		wsemul_vt100_ed(vd, 2);
@@ -600,24 +598,19 @@ wsemul_vt100_output_esc(struct wsemul_vt
 		break;
 	case '(': case ')': case '*': case '+': /* SCS */
 		edp->designating = c - '(';
-		newstate = VT100_EMUL_STATE_SCS94;
-		break;
+		return VT100_EMUL_STATE_SCS94;
 	case '-': case '.': case '/': /* SCS */
 		edp->designating = c - '-' + 1;
-		newstate = VT100_EMUL_STATE_SCS96;
-		break;
+		return VT100_EMUL_STATE_SCS96;
 	case '#':
-		newstate = VT100_EMUL_STATE_ESC_HASH;
-		break;
+		return VT100_EMUL_STATE_ESC_HASH;
 	case ' ': /* 7/8 bit */
-		newstate = VT100_EMUL_STATE_ESC_SPC;
-		break;
+		return VT100_EMUL_STATE_ESC_SPC;
 	case ']': /* OSC operating system command */
 	case '^': /* PM privacy message */
 	case '_': /* APC application program command */
 		/* ignored */
-		newstate = VT100_EMUL_STATE_STRING;
-		break;
+		return VT100_EMUL_STATE_STRING;
 	case '<': /* exit VT52 mode - ignored */
 		break;
 	default:
@@ -626,19 +619,15 @@ wsemul_vt100_output_esc(struct wsemul_vt
 #endif
 		break;
 	}
-
-	return (newstate);
+	return VT100_EMUL_STATE_NORMAL;
 }
 
 static u_int
 wsemul_vt100_output_scs94(struct wsemul_vt100_emuldata *edp, u_char c)
 {
-	u_int newstate = VT100_EMUL_STATE_NORMAL;
-
 	switch (c) {
 	case '%': /* probably DEC supplemental graphic */
-		newstate = VT100_EMUL_STATE_SCS94_PERCENT;
-		break;
+		return VT100_EMUL_STATE_SCS94_PERCENT;
 	case 'A': /* british / national */
 		edp->chartab_G[edp->designating] = edp->nrctab;
 		break;
@@ -661,7 +650,7 @@ wsemul_vt100_output_scs94(struct wsemul_
 #endif
 		break;
 	}
-	return (newstate);
+	return VT100_EMUL_STATE_NORMAL;
 }
 
 static u_int
@@ -678,19 +667,17 @@ wsemul_vt100_output_scs94_percent(struct
 #endif
 		break;
 	}
-	return (VT100_EMUL_STATE_NORMAL);
+	return VT100_EMUL_STATE_NORMAL;
 }
 
 static u_int
 wsemul_vt100_output_scs96(struct wsemul_vt100_emuldata *edp, u_char c)
 {
-	u_int newstate = VT100_EMUL_STATE_NORMAL;
 	int nrc;
 
 	switch (c) {
 	case '%': /* probably portuguese */
-		newstate = VT100_EMUL_STATE_SCS96

CVS commit: src/sys/dev/wscons

2018-01-20 Thread Rin Okuyama
Module Name:src
Committed By:   rin
Date:   Sat Jan 20 23:27:06 UTC 2018

Modified Files:
src/sys/dev/wscons: wsemul_vt100.c

Log Message:
Correct wrong assertion code introduced by rev 1.41:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/dev/wscons/wsemul_vt100.c#rev1.41

Fix kernel panic reported in PR kern/52935.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/wscons/wsemul_vt100.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/dev/wscons/wsemul_vt100.c
diff -u src/sys/dev/wscons/wsemul_vt100.c:1.41 src/sys/dev/wscons/wsemul_vt100.c:1.42
--- src/sys/dev/wscons/wsemul_vt100.c:1.41	Fri Nov  3 19:20:27 2017
+++ src/sys/dev/wscons/wsemul_vt100.c	Sat Jan 20 23:27:06 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: wsemul_vt100.c,v 1.41 2017/11/03 19:20:27 maya Exp $ */
+/* $NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $ */
 
 /*
  * Copyright (c) 1998
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.41 2017/11/03 19:20:27 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wsemul_vt100.c,v 1.42 2018/01/20 23:27:06 rin Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_wsmsgattrs.h"
@@ -1006,7 +1006,7 @@ wsemul_vt100_output(void *cookie, const 
 			wsemul_vt100_output_normal(edp, *data, kernel);
 			continue;
 		}
-		KASSERT(edp->state < __arraycount(vt100_output) - 1);
+		KASSERT(edp->state <= __arraycount(vt100_output));
 		edp->state = vt100_output[edp->state - 1](edp, *data);
 	}
 	if (vd->flags & VTFL_CURSORON)



CVS commit: src/sys/arch/atari/isa

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 19:36:47 UTC 2018

Modified Files:
src/sys/arch/atari/isa: isa_milan.c

Log Message:
Ack EOI for IRQ_SLAVE of the master PIC after ack for IRQ of the slave PIC.

I'm not sure if there are possible races in the original code, but
this is what i8259_asm_ack2() in sys/arch/x86/include/i8259.h does
and it looks this change makes a Milan kernel a bit stable.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/atari/isa/isa_milan.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/atari/isa/isa_milan.c
diff -u src/sys/arch/atari/isa/isa_milan.c:1.15 src/sys/arch/atari/isa/isa_milan.c:1.16
--- src/sys/arch/atari/isa/isa_milan.c:1.15	Sat Jan 20 18:33:09 2018
+++ src/sys/arch/atari/isa/isa_milan.c	Sat Jan 20 19:36:47 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_milan.c,v 1.15 2018/01/20 18:33:09 tsutsui Exp $	*/
+/*	$NetBSD: isa_milan.c,v 1.16 2018/01/20 19:36:47 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_milan.c,v 1.15 2018/01/20 18:33:09 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_milan.c,v 1.16 2018/01/20 19:36:47 tsutsui Exp $");
 
 #include 
 #include 
@@ -122,9 +122,11 @@ isa_callback(int vector)
 
 	s = splx(iinfo_p->ipl);
 	(void) (iinfo_p->ifunc)(iinfo_p->iarg);
-	if (vector > 7)
+	if (vector > 7) {
 		WICU(AD_8259_SLAVE, 0x60 | (vector & 7));
-	else WICU(AD_8259_MASTER, 0x60 | (vector & 7));
+		vector = IRQ_SLAVE;
+	}
+	WICU(AD_8259_MASTER, 0x60 | (vector & 7));
 	splx(s);
 }
 
@@ -140,10 +142,6 @@ milan_isa_intr(int vector, int sr)
 		return;
 	}
 
-	/* Ack cascade 0x60 == Specific EOI		*/
-	if (vector > 7)
-		WICU(AD_8259_MASTER, 0x60|IRQ_SLAVE);
-
 	iinfo_p = &milan_isa_iinfo[vector];
 	if (iinfo_p->ifunc == NULL) {
 		printf("milan_isa_intr: Stray interrupt: %d (mask:%04x)\n",
@@ -159,9 +157,11 @@ milan_isa_intr(int vector, int sr)
 	else {
 		s = splx(iinfo_p->ipl);
 		(void) (iinfo_p->ifunc)(iinfo_p->iarg);
-		if (vector > 7)
+		if (vector > 7) {
 			WICU(AD_8259_SLAVE, 0x60 | (vector & 7));
-		else WICU(AD_8259_MASTER, 0x60 | (vector & 7));
+			vector = IRQ_SLAVE;
+		}
+		WICU(AD_8259_MASTER, 0x60 | (vector & 7));
 		splx(s);
 	}
 }



CVS commit: [perseant-stdc-iso10646] src

2018-01-20 Thread Konrad Schroder
Module Name:src
Committed By:   perseant
Date:   Sat Jan 20 19:36:29 UTC 2018

Modified Files:
src/include [perseant-stdc-iso10646]: wchar.h
src/lib/libc/citrus [perseant-stdc-iso10646]: citrus_lc_collate.c
src/lib/libc/citrus/modules [perseant-stdc-iso10646]: citrus_big5.c
citrus_euc.c citrus_iso2022.c citrus_mskanji.c
src/lib/libc/locale [perseant-stdc-iso10646]: collate.h
collate_locale.c ducet_collation_data.h unicode_ucd.c
src/tools [perseant-stdc-iso10646]: Makefile
src/usr.bin/localedef [perseant-stdc-iso10646]: Makefile collate.c
Added Files:
src/lib/libc/citrus/modules [perseant-stdc-iso10646]: citrus_big5_k2u.h
citrus_big5_u2k.h citrus_euc_k2u.h citrus_euc_u2k.h
citrus_iso2022_k2u.h citrus_iso2022_u2k.h citrus_mskanji_k2u.h
citrus_mskanji_u2k.h
Removed Files:
src/usr.bin/localedef [perseant-stdc-iso10646]: localedef parser.c
parser.h

Log Message:
Use multilevel tables (tries) to convert kuten <-> unicode.
Get rid of dchains, replace with chain/rchain conversions through keys
allocated from the PUA.


To generate a diff of this commit:
cvs rdiff -u -r1.42.8.1 -r1.42.8.2 src/include/wchar.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/lib/libc/citrus/citrus_lc_collate.c
cvs rdiff -u -r1.15.18.3 -r1.15.18.4 \
src/lib/libc/citrus/modules/citrus_big5.c
cvs rdiff -u -r0 -r1.1.2.1 src/lib/libc/citrus/modules/citrus_big5_k2u.h \
src/lib/libc/citrus/modules/citrus_big5_u2k.h \
src/lib/libc/citrus/modules/citrus_euc_k2u.h \
src/lib/libc/citrus/modules/citrus_euc_u2k.h \
src/lib/libc/citrus/modules/citrus_iso2022_k2u.h \
src/lib/libc/citrus/modules/citrus_iso2022_u2k.h \
src/lib/libc/citrus/modules/citrus_mskanji_k2u.h \
src/lib/libc/citrus/modules/citrus_mskanji_u2k.h
cvs rdiff -u -r1.17.20.3 -r1.17.20.4 src/lib/libc/citrus/modules/citrus_euc.c
cvs rdiff -u -r1.23.22.3 -r1.23.22.4 \
src/lib/libc/citrus/modules/citrus_iso2022.c
cvs rdiff -u -r1.14.22.3 -r1.14.22.4 \
src/lib/libc/citrus/modules/citrus_mskanji.c
cvs rdiff -u -r1.1.40.1 -r1.1.40.2 src/lib/libc/locale/collate.h
cvs rdiff -u -r1.1.2.2 -r1.1.2.3 src/lib/libc/locale/collate_locale.c \
src/lib/libc/locale/unicode_ucd.c
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/lib/libc/locale/ducet_collation_data.h
cvs rdiff -u -r1.191 -r1.191.2.1 src/tools/Makefile
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/usr.bin/localedef/Makefile \
src/usr.bin/localedef/collate.c
cvs rdiff -u -r1.1.2.1 -r0 src/usr.bin/localedef/localedef \
src/usr.bin/localedef/parser.c src/usr.bin/localedef/parser.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

diffs are larger than 1MB and have been omitted


CVS commit: src/sys/arch/atari/dev

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 19:33:53 UTC 2018

Modified Files:
src/sys/arch/atari/dev: nvram.c

Log Message:
Skip NVRAM checksum check and re-initialization on Milan.

Milan's firmware seems to use different check method.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/atari/dev/nvram.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/atari/dev/nvram.c
diff -u src/sys/arch/atari/dev/nvram.c:1.20 src/sys/arch/atari/dev/nvram.c:1.21
--- src/sys/arch/atari/dev/nvram.c:1.20	Fri Mar  6 12:41:05 2015
+++ src/sys/arch/atari/dev/nvram.c	Sat Jan 20 19:33:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: nvram.c,v 1.20 2015/03/06 12:41:05 christos Exp $	*/
+/*	$NetBSD: nvram.c,v 1.21 2018/01/20 19:33:53 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1995 Leo Weppelman.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.20 2015/03/06 12:41:05 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nvram.c,v 1.21 2018/01/20 19:33:53 tsutsui Exp $");
 
 #include 
 #include 
@@ -92,11 +92,15 @@ nvr_attach(device_t parent, device_t sel
 	/*
 	 * Check the validity of the NVram contents
 	 */
-	if (!nvram_csum_valid(nvram_csum())) {
-		printf(": Invalid checksum - re-initialized");
-		for (nreg = MC_NVRAM_START; nreg < MC_NVRAM_CSUM; nreg++)
-			mc146818_write(RTC, nreg, 0);
-		nvram_set_csum(nvram_csum());
+	/* XXX: Milan's firmware seems to use different check method */
+	if ((machineid & ATARI_MILAN) == 0) {
+		if (!nvram_csum_valid(nvram_csum())) {
+			printf(": Invalid checksum - re-initialized");
+			for (nreg = MC_NVRAM_START; nreg < MC_NVRAM_CSUM;
+			nreg++)
+mc146818_write(RTC, nreg, 0);
+			nvram_set_csum(nvram_csum());
+		}
 	}
 	sc = device_private(self);
 	sc->sc_dev = self;



CVS commit: src/sys/arch/atari/conf

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 19:26:38 UTC 2018

Modified Files:
src/sys/arch/atari/conf: MILAN-ISAIDE MILAN-PCIIDE

Log Message:
Regen from MILAN.in rev 1.28.

> Restore piixide(4) for Milan and disable other pciide devices.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/atari/conf/MILAN-PCIIDE

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/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.89 src/sys/arch/atari/conf/MILAN-ISAIDE:1.90
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.89	Sat Jan 20 16:30:57 2018
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sat Jan 20 19:26:38 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.89 2018/01/20 16:30:57 tsutsui Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.90 2018/01/20 19:26:38 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.28 2018/01/20 19:24:27 tsutsui Exp $
 #		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.93 src/sys/arch/atari/conf/MILAN-PCIIDE:1.94
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.93	Sat Jan 20 16:30:57 2018
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Sat Jan 20 19:26:38 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.93 2018/01/20 16:30:57 tsutsui Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.94 2018/01/20 19:26:38 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
+#		NetBSD: MILAN.in,v 1.28 2018/01/20 19:24:27 tsutsui Exp $
 #		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
@@ -91,19 +91,7 @@ ser0 at mainbus0
 fdcisa0 at isa? port 0x3f0 irq 6 drq 2 # standard PC floppy contr.
 fdisa0 at fdcisa0 drive 0
 pciide* at pci? dev ? function ? flags 0x # GENERIC pciide driver
-acardide* at pci? dev ? function ? # Acard IDE controllers
-aceride* at pci? dev ? function ? # Acer Lab IDE controllers
-artsata* at pci? dev ? function ? # Intel i31244 SATA controller
-cmdide* at pci? dev ? function ? # CMD tech IDE controllers
-cypide* at pci? dev ? function ? # Cypress IDE controllers
-hptide* at pci? dev ? function ? # Triones/HighPoint IDE controllers
-optiide* at pci? dev ? function ? # Opti IDE controllers
-pdcide* at pci? dev ? function ? # Promise IDE controllers
-pdcsata* at pci? dev ? function ? # Promise SATA150 controllers
-satalink* at pci? dev ? function ? # SiI SATALink controllers
-siside* at pci? dev ? function ? # SiS IDE controllers
-slide* at pci? dev ? function ? # Symphony Labs IDE controllers
-viaide* at pci? dev ? function ? # VIA/AMD/Nvidia IDE controllers
+piixide* at pci? dev ? function ? # Intel IDE controllers
 atabus* at ata? channel ?
 vga0 at pci? dev ? function ? # a PCI VGA card
 wsdisplay* at vga? console ? # as a wscons console



CVS commit: src/sys/arch/atari/conf

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 19:24:27 UTC 2018

Modified Files:
src/sys/arch/atari/conf: MILAN.in

Log Message:
Restore piixide(4) for Milan and disable other pciide devices.

piixide was removed in rev 1.18 and the log message said
"because Intel IDE disk controllers only exist as part of
 Intel chipsets for x86 systems" but the Milan actually has
the Intel 82371FB southbridge on its board.
Other pciide devices are unlikely necessary for the default
kernel for such a rare machine.
Also fix pasto in comment.


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/arch/atari/conf/MILAN.in

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/atari/conf/MILAN.in
diff -u src/sys/arch/atari/conf/MILAN.in:1.27 src/sys/arch/atari/conf/MILAN.in:1.28
--- src/sys/arch/atari/conf/MILAN.in:1.27	Sat Jul  5 09:24:23 2014
+++ src/sys/arch/atari/conf/MILAN.in	Sat Jan 20 19:24:27 2018
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
+#	$NetBSD: MILAN.in,v 1.28 2018/01/20 19:24:27 tsutsui Exp $
 #
 # Milan
 #
@@ -77,20 +77,21 @@ wdc1 		at isa? port 0x170 irq 15 flags 0
 
 #if defined(MILAN_PCIIDE)
 pciide* 	at pci? dev ? function ? flags 0x	# GENERIC pciide driver
-acardide*	at pci? dev ? function ?	# Acard IDE controllers
-aceride* 	at pci? dev ? function ?	# Acer Lab IDE controllers
-artsata*	at pci? dev ? function ?	# Intel i31244 SATA controller
-cmdide* 	at pci? dev ? function ?	# CMD tech IDE controllers
-cypide* 	at pci? dev ? function ?	# Cypress IDE controllers
-hptide* 	at pci? dev ? function ?	# Triones/HighPoint IDE controllers
-optiide* 	at pci? dev ? function ?	# Opti IDE controllers
-pdcide* 	at pci? dev ? function ?	# Promise IDE controllers
-pdcsata* 	at pci? dev ? function ?	# Promise SATA150 controllers
-satalink*	at pci? dev ? function ?	# SiI SATALink controllers
-siside* 	at pci? dev ? function ?	# SiS IDE controllers
-slide*  	at pci? dev ? function ?	# Symphony Labs IDE controllers
-viaide* 	at pci? dev ? function ?	# VIA/AMD/Nvidia IDE controllers
-#endif /* MILAN_ISAIDE */
+#acardide*	at pci? dev ? function ?	# Acard IDE controllers
+#aceride* 	at pci? dev ? function ?	# Acer Lab IDE controllers
+#artsata*	at pci? dev ? function ?	# Intel i31244 SATA controller
+#cmdide* 	at pci? dev ? function ?	# CMD tech IDE controllers
+#cypide* 	at pci? dev ? function ?	# Cypress IDE controllers
+#hptide* 	at pci? dev ? function ?	# Triones/HighPoint IDE controllers
+#optiide* 	at pci? dev ? function ?	# Opti IDE controllers
+#pdcide* 	at pci? dev ? function ?	# Promise IDE controllers
+#pdcsata* 	at pci? dev ? function ?	# Promise SATA150 controllers
+piixide* 	at pci? dev ? function ?	# Intel IDE controllers
+#satalink*	at pci? dev ? function ?	# SiI SATALink controllers
+#siside* 	at pci? dev ? function ?	# SiS IDE controllers
+#slide*  	at pci? dev ? function ?	# Symphony Labs IDE controllers
+#viaide* 	at pci? dev ? function ?	# VIA/AMD/Nvidia IDE controllers
+#endif /* MILAN_PCIIDE */
 
 atabus*		at ata? channel ?
 



CVS commit: src/sys/arch/atari/isa

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 18:33:09 UTC 2018

Modified Files:
src/sys/arch/atari/isa: isa_milan.c

Log Message:
Use a proper PSL value to be passed to splx(9) functions.

This should have been changed on yamt-splraiseipl branch merge
back in 2006, which made MI IPL_xxx values independent from
m68k MD PSL values for the %sr register.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/atari/isa/isa_milan.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/atari/isa/isa_milan.c
diff -u src/sys/arch/atari/isa/isa_milan.c:1.14 src/sys/arch/atari/isa/isa_milan.c:1.15
--- src/sys/arch/atari/isa/isa_milan.c:1.14	Wed Mar 18 10:22:25 2009
+++ src/sys/arch/atari/isa/isa_milan.c	Sat Jan 20 18:33:09 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_milan.c,v 1.14 2009/03/18 10:22:25 cegger Exp $	*/
+/*	$NetBSD: isa_milan.c,v 1.15 2018/01/20 18:33:09 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_milan.c,v 1.14 2009/03/18 10:22:25 cegger Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_milan.c,v 1.15 2018/01/20 18:33:09 tsutsui Exp $");
 
 #include 
 #include 
@@ -209,7 +209,7 @@ isa_intr_establish(isa_chipset_tag_t ic,
 
 	iinfo_p->slot  = 0;	/* Unused on Milan */
 	iinfo_p->ihand = NULL;	/* Unused on Milan */
-	iinfo_p->ipl   = level;
+	iinfo_p->ipl   = ipl2psl_table[level];
 	iinfo_p->ifunc = ih_fun;
 	iinfo_p->iarg  = ih_arg;
 



CVS commit: src/sys/dev/isa

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 18:18:02 UTC 2018

Modified Files:
src/sys/dev/isa: fd.c

Log Message:
Handle yet another atari specific quirk in the MI ISA fdc(4)/fd(4) driver.

This makes fd(4) drive(s) (which is necessary for installation)
properly attached on Milan.

atari uses "fdcisa" and "fdisa" for ISA fdc to co-exist other fd(4)
drivers, on-board (atari/dev/fd.c) one and Hades (atari/dev/hdfd.c) one.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/isa/fd.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/dev/isa/fd.c
diff -u src/sys/dev/isa/fd.c:1.110 src/sys/dev/isa/fd.c:1.111
--- src/sys/dev/isa/fd.c:1.110	Tue Dec  8 20:36:15 2015
+++ src/sys/dev/isa/fd.c	Sat Jan 20 18:18:02 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $	*/
+/*	$NetBSD: fd.c,v 1.111 2018/01/20 18:18:02 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2003, 2008 The NetBSD Foundation, Inc.
@@ -81,7 +81,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.110 2015/12/08 20:36:15 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.111 2018/01/20 18:18:02 tsutsui Exp $");
 
 #include "opt_ddb.h"
 
@@ -460,14 +460,16 @@ fdcfinishattach(device_t self)
 			 * Atari has a different ordening, defaults to 1.44
 			 */
 			fa.fa_deftype = &fd_types[2];
+			 /* Atari also configures ISA fdc(4) as "fdcisa" */
+			(void)config_found_ia(fdc->sc_dev, "fdcisa", (void *)&fa, fdprint);
 #else
 			/*
 			 * Default to 1.44MB on Alpha and BeBox.  How do we tell
 			 * on these platforms?
 			 */
 			fa.fa_deftype = &fd_types[0];
-#endif
 			(void)config_found_ia(fdc->sc_dev, "fdc", (void *)&fa, fdprint);
+#endif
 		}
 	}
 	fdc->sc_state = DEVIDLE;



CVS commit: src/sys/arch/atari/atari

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 18:04:28 UTC 2018

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

Log Message:
Fix silent hang after isa_intr_establish() on Milan.

The problems (wrong macro replacements) were slipped in rev 1.107:
http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/arch/atari/atari/locore.s#rev1.107


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/atari/atari/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/atari/atari/locore.s
diff -u src/sys/arch/atari/atari/locore.s:1.110 src/sys/arch/atari/atari/locore.s:1.111
--- src/sys/arch/atari/atari/locore.s:1.110	Thu Dec 22 15:33:28 2011
+++ src/sys/arch/atari/atari/locore.s	Sat Jan 20 18:04:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.110 2011/12/22 15:33:28 tsutsui Exp $	*/
+/*	$NetBSD: locore.s,v 1.111 2018/01/20 18:04:28 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -399,7 +399,7 @@ ENTRY_NOPROFILE(lev6intr)
 	movel	%d1,%sp@-		| Call handler
 	jbsr	_C_LABEL(milan_isa_intr)
 	addql	#8,%sp
-	INTERRUPT_RESTOREREG
+	moveml  %sp@+,%d0-%d2/%a0-%a1
 	subql	#1,_C_LABEL(idepth)
 	jra	_ASM_LABEL(rei)
 
@@ -450,7 +450,6 @@ ENTRY_NOPROFILE(lev7intr)
 	tstl	_ASM_LABEL(plx_nonmi)	| milan_conf_read shortcut
 	jne	1f			|  get out immediately
 	INTERRUPT_SAVEREG
-	moveml	%d0-%d1/%a0-%a1,%sp@-
 	movl	_C_LABEL(stio_addr),%a0	| get KVA of ST-IO area
 	movw	%a0@(PLX_PCICR),_C_LABEL(plx_status)
 	movw	#0xf900,%a0@(PLX_PCICR)	| Clear error bits
@@ -464,7 +463,6 @@ ENTRY_NOPROFILE(lev7intr)
 ENTRY_NOPROFILE(lev3intr)
 ENTRY_NOPROFILE(badtrap)
 	addql	#1,_C_LABEL(idepth)
-	moveml	#0xC0C0,%sp@-		|  save scratch regs
 	INTERRUPT_SAVEREG
 	movw	%sp@(22),%sp@-		|  push exception vector info
 	clrw	%sp@-



CVS commit: src/sys/arch/atari/isa

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 18:01:53 UTC 2018

Modified Files:
src/sys/arch/atari/isa: isa_machdep.c

Log Message:
Fix silent hang during config_console() (before consinit()) on Milan.

config_console() was a dirty hack used by ancient m68k ports
to probe and initialize console devices before "real" configure(9),
using subset of configure(9) functions.

In that case, most device specific data (except I/O access method)
are not initialized so we must not access device specific device_t and
softc structures in config_console() cases.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/atari/isa/isa_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/atari/isa/isa_machdep.c
diff -u src/sys/arch/atari/isa/isa_machdep.c:1.40 src/sys/arch/atari/isa/isa_machdep.c:1.41
--- src/sys/arch/atari/isa/isa_machdep.c:1.40	Sat Oct 13 17:58:54 2012
+++ src/sys/arch/atari/isa/isa_machdep.c	Sat Jan 20 18:01:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.40 2012/10/13 17:58:54 jdc Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.41 2018/01/20 18:01:53 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1997 Leo Weppelman.  All rights reserved.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.40 2012/10/13 17:58:54 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isa_machdep.c,v 1.41 2018/01/20 18:01:53 tsutsui Exp $");
 
 #include 
 #include 
@@ -111,17 +111,14 @@ isabusmatch(device_t parent, cfdata_t cf
 void
 isabusattach(device_t parent, device_t self, void *aux)
 {
-	struct isabus_softc *sc = device_private(self);
+	struct isabus_softc *sc;
 	struct isabus_attach_args	iba;
 	extern struct atari_bus_dma_tag isa_bus_dma_tag;
 	extern void isa_bus_init(void);
 
-	sc->sc_dev = self;
-
 	iba.iba_dmat	= &isa_bus_dma_tag;
 	iba.iba_iot = leb_alloc_bus_space_tag(&bs_storage[0]);
 	iba.iba_memt= leb_alloc_bus_space_tag(&bs_storage[1]);
-	iba.iba_ic	= &sc->sc_chipset;
 	if ((iba.iba_iot == NULL) || (iba.iba_memt == NULL)) {
 		printf("leb_alloc_bus_space_tag failed!\n");
 		return;
@@ -139,6 +136,10 @@ isabusattach(device_t parent, device_t s
 		return;
 	}
 
+	sc = device_private(self);
+	sc->sc_dev = self;
+	iba.iba_ic = &sc->sc_chipset;
+
 	printf("\n");
 	config_found_ia(self, "isabus", &iba, atariisabusprint);
 }



CVS commit: src/sys/arch/atari/atari

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 17:37:15 UTC 2018

Modified Files:
src/sys/arch/atari/atari: bus.c

Log Message:
Fix I/O access failures for regions allocated by bus_space_map(9) on Milan.

Passing to PMAP_WIRED against I/O spaces seems problematic,
probably after yamt-km branch merge, which was committed
between NetBSD 3.0 and NetBSD 4.0.
(i.e. ISA and PCI devices on Milan didn't work after 4.0 release)

XXX:
According to pmap(9) man page, the "flags" arg for pmap_enter(9)
doesn't take VM_PROT_READ and VM_PROT_WRITE, but pmap_enter()
implementation in sys/arch/m68k/m68k/pmap_motolora.c historically
checks them.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/atari/atari/bus.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/atari/atari/bus.c
diff -u src/sys/arch/atari/atari/bus.c:1.58 src/sys/arch/atari/atari/bus.c:1.59
--- src/sys/arch/atari/atari/bus.c:1.58	Sat Oct 18 08:33:24 2014
+++ src/sys/arch/atari/atari/bus.c	Sat Jan 20 17:37:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.58 2014/10/18 08:33:24 snj Exp $	*/
+/*	$NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -33,7 +33,7 @@
 #include "opt_m68k_arch.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.58 2014/10/18 08:33:24 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.59 2018/01/20 17:37:15 tsutsui Exp $");
 
 #include 
 #include 
@@ -251,7 +251,7 @@ bus_mem_add_mapping(bus_space_tag_t t, b
 		u_int	*ptep, npte;
 
 		pmap_enter(pmap_kernel(), (vaddr_t)va, pa,
-		VM_PROT_READ|VM_PROT_WRITE, PMAP_WIRED);
+		VM_PROT_READ|VM_PROT_WRITE, VM_PROT_READ|VM_PROT_WRITE);
 
 		ptep = kvtopte(va);
 		npte = *ptep & ~PG_CMASK;
@@ -667,7 +667,7 @@ bus_dmamem_map(bus_dma_tag_t t, bus_dma_
 panic("_bus_dmamem_map: size botch");
 			pmap_enter(pmap_kernel(), va, addr - offset,
 			VM_PROT_READ | VM_PROT_WRITE,
-			VM_PROT_READ | VM_PROT_WRITE | PMAP_WIRED);
+			VM_PROT_READ | VM_PROT_WRITE);
 		}
 	}
 	pmap_update(pmap_kernel());



CVS commit: src/sys/arch/atari/conf

2018-01-20 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Sat Jan 20 16:30:57 UTC 2018

Modified Files:
src/sys/arch/atari/conf: ATARITT FALCON HADES MILAN-ISAIDE MILAN-PCIIDE
SMALL030

Log Message:
Regenerate config files to update RCSIds in "Created from:" lines.


To generate a diff of this commit:
cvs rdiff -u -r1.117 -r1.118 src/sys/arch/atari/conf/ATARITT
cvs rdiff -u -r1.114 -r1.115 src/sys/arch/atari/conf/FALCON
cvs rdiff -u -r1.111 -r1.112 src/sys/arch/atari/conf/HADES
cvs rdiff -u -r1.88 -r1.89 src/sys/arch/atari/conf/MILAN-ISAIDE
cvs rdiff -u -r1.92 -r1.93 src/sys/arch/atari/conf/MILAN-PCIIDE
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/atari/conf/SMALL030

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/atari/conf/ATARITT
diff -u src/sys/arch/atari/conf/ATARITT:1.117 src/sys/arch/atari/conf/ATARITT:1.118
--- src/sys/arch/atari/conf/ATARITT:1.117	Thu Sep 14 07:58:39 2017
+++ src/sys/arch/atari/conf/ATARITT	Sat Jan 20 16:30:57 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: ATARITT,v 1.117 2017/09/14 07:58:39 mrg Exp $
+# $NetBSD: ATARITT,v 1.118 2018/01/20 16:30:57 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.113 2017/07/29 18:08:56 maxv Exp $
+#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.atari"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/FALCON
diff -u src/sys/arch/atari/conf/FALCON:1.114 src/sys/arch/atari/conf/FALCON:1.115
--- src/sys/arch/atari/conf/FALCON:1.114	Thu Sep 14 07:58:39 2017
+++ src/sys/arch/atari/conf/FALCON	Sat Jan 20 16:30:57 2018
@@ -1,11 +1,11 @@
 #
-# $NetBSD: FALCON,v 1.114 2017/09/14 07:58:39 mrg Exp $
+# $NetBSD: FALCON,v 1.115 2018/01/20 16:30:57 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
-#		NetBSD: GENERIC.in,v 1.113 2017/07/29 18:08:56 maxv Exp $
+#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.atari"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/HADES
diff -u src/sys/arch/atari/conf/HADES:1.111 src/sys/arch/atari/conf/HADES:1.112
--- src/sys/arch/atari/conf/HADES:1.111	Thu Sep 14 07:58:39 2017
+++ src/sys/arch/atari/conf/HADES	Sat Jan 20 16:30:57 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: HADES,v 1.111 2017/09/14 07:58:39 mrg Exp $
+# $NetBSD: HADES,v 1.112 2018/01/20 16:30:57 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: HADES.in,v 1.15 2016/12/13 20:42:16 christos Exp $
-#		NetBSD: GENERIC.in,v 1.113 2017/07/29 18:08:56 maxv Exp $
+#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.hades"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/MILAN-ISAIDE
diff -u src/sys/arch/atari/conf/MILAN-ISAIDE:1.88 src/sys/arch/atari/conf/MILAN-ISAIDE:1.89
--- src/sys/arch/atari/conf/MILAN-ISAIDE:1.88	Thu Sep 14 07:58:39 2017
+++ src/sys/arch/atari/conf/MILAN-ISAIDE	Sat Jan 20 16:30:57 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: MILAN-ISAIDE,v 1.88 2017/09/14 07:58:39 mrg Exp $
+# $NetBSD: MILAN-ISAIDE,v 1.89 2018/01/20 16:30:57 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.113 2017/07/29 18:08:56 maxv Exp $
+#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.milan"
 options INCLUDE_CONFIG_FILE # embed config file in kernel binary
 makeoptions COPTS="-O2 -fno-reorder-blocks" # see share/mk/sys.mk

Index: src/sys/arch/atari/conf/MILAN-PCIIDE
diff -u src/sys/arch/atari/conf/MILAN-PCIIDE:1.92 src/sys/arch/atari/conf/MILAN-PCIIDE:1.93
--- src/sys/arch/atari/conf/MILAN-PCIIDE:1.92	Thu Sep 14 07:58:39 2017
+++ src/sys/arch/atari/conf/MILAN-PCIIDE	Sat Jan 20 16:30:57 2018
@@ -1,12 +1,12 @@
 #
-# $NetBSD: MILAN-PCIIDE,v 1.92 2017/09/14 07:58:39 mrg Exp $
+# $NetBSD: MILAN-PCIIDE,v 1.93 2018/01/20 16:30:57 tsutsui Exp $
 #
 # This file was automatically created. Changes will be
 # lost when running makeconf in this directory.
 #
 # Created from:
 #		NetBSD: MILAN.in,v 1.27 2014/07/05 09:24:23 tsutsui Exp $
-#		NetBSD: GENERIC.in,v 1.113 2017/07/29 18:08:56 maxv Exp $
+#		NetBSD: GENERIC.in,v 1.114 2017/09/14 07:58:39 mrg Exp $
 include "arch/atari/conf/std.milan"
 options INCLU

CVS commit: src/sys/arch/arm/arm

2018-01-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Jan 20 14:43:25 UTC 2018

Modified Files:
src/sys/arch/arm/arm: cpufunc_asm_arm11x6.S

Log Message:
PR/52934: Yasushi Oshima: Apply the erratum fix that was applied to wbinv_range
to isync_range so that we don't hang when we try to sync from execcmd_readvn().
XXX: pullup 8


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.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/arm/arm/cpufunc_asm_arm11x6.S
diff -u src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.9 src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.10
--- src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S:1.9	Sat Jul 15 02:25:20 2017
+++ src/sys/arch/arm/arm/cpufunc_asm_arm11x6.S	Sat Jan 20 09:43:25 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.9 2017/07/15 06:25:20 skrll Exp $	*/
+/*	$NetBSD: cpufunc_asm_arm11x6.S,v 1.10 2018/01/20 14:43:25 christos Exp $	*/
 
 /*
  * Copyright (c) 2007 Microsoft
@@ -63,7 +63,7 @@
 #include 
 #include 
 
-RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.9 2017/07/15 06:25:20 skrll Exp $")
+RCSID("$NetBSD: cpufunc_asm_arm11x6.S,v 1.10 2018/01/20 14:43:25 christos Exp $")
 
 #if 0
 #define Invalidate_I_cache(Rtmp1, Rtmp2) \
@@ -137,6 +137,11 @@ ENTRY_NP(arm11x6_flush_prefetchbuf)
 END(arm11x6_flush_prefetchbuf)
 
 ENTRY_NP(arm11x6_icache_sync_range)
+	ldr	r2, .Larm_pcache
+	ldr	r2, [r2, #DCACHE_SIZE]
+	cmp	r1, r2
+	bge	arm11x6_icache_sync_all
+
 	add	r1, r1, r0
 	sub	r1, r1, #1
 	/* Erratum ARM1136 371025, workaround #2 */



CVS commit: src/sys/arch/amd64/include

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 14:39:21 UTC 2018

Modified Files:
src/sys/arch/amd64/include: frameasm.h

Log Message:
Use .pushsection/.popsection, we will soon embed macros in several layers
of nested sections.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/amd64/include/frameasm.h

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/amd64/include/frameasm.h
diff -u src/sys/arch/amd64/include/frameasm.h:1.29 src/sys/arch/amd64/include/frameasm.h:1.30
--- src/sys/arch/amd64/include/frameasm.h:1.29	Thu Jan 18 07:25:34 2018
+++ src/sys/arch/amd64/include/frameasm.h	Sat Jan 20 14:39:21 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: frameasm.h,v 1.29 2018/01/18 07:25:34 maxv Exp $	*/
+/*	$NetBSD: frameasm.h,v 1.30 2018/01/20 14:39:21 maxv Exp $	*/
 
 #ifndef _AMD64_MACHINE_FRAMEASM_H
 #define _AMD64_MACHINE_FRAMEASM_H
@@ -43,11 +43,11 @@
 
 #define HOTPATCH(name, size) \
 123:		; \
-	.section	.rodata.hotpatch, "a"	; \
+	.pushsection	.rodata.hotpatch, "a"	; \
 	.byte		name			; \
 	.byte		size			; \
 	.quad		123b			; \
-	.previous
+	.popsection
 
 #define SMAP_ENABLE \
 	HOTPATCH(HP_NAME_CLAC, 3)		; \



CVS commit: src/sys/arch/amd64

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 14:27:15 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S vector.S
src/sys/arch/amd64/conf: files.amd64

Log Message:
Compile amd64_trap.S as a file instead of including it.


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/amd64/amd64/vector.S
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/amd64/conf/files.amd64

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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.21 src/sys/arch/amd64/amd64/amd64_trap.S:1.22
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.21	Sat Jan 20 13:45:15 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Sat Jan 20 14:27:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.21 2018/01/20 13:45:15 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.22 2018/01/20 14:27:15 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -64,10 +64,19 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.21 2018/01/20 13:45:15 maxv Exp $");
-#endif
+
+#include "opt_xen.h"
+#include "opt_dtrace.h"
+
+#define ALIGN_TEXT	.align 16,0x90
+
+#include 
+#include 
+#include 
+#include 
+
+#include "assym.h"
 
 /*
  * Trap and fault vector routines
@@ -80,8 +89,6 @@ __KERNEL_RCSID(0, "$NetBSD: amd64_trap.S
  * handler.
  */
 
-/*/
-
 #ifdef	XEN
 #define	PRE_TRAP	movq (%rsp),%rcx ; movq 8(%rsp),%r11 ; addq $0x10,%rsp
 #else

Index: src/sys/arch/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.54 src/sys/arch/amd64/amd64/vector.S:1.55
--- src/sys/arch/amd64/amd64/vector.S:1.54	Sat Jan 20 14:08:08 2018
+++ src/sys/arch/amd64/amd64/vector.S	Sat Jan 20 14:27:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.54 2018/01/20 14:08:08 maxv Exp $	*/
+/*	$NetBSD: vector.S,v 1.55 2018/01/20 14:27:15 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -85,8 +85,6 @@
 #include "lapic.h"
 #include "assym.h"
 
-#include "amd64_trap.S"
-
 	.text
 
 /*/

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.100 src/sys/arch/amd64/conf/files.amd64:1.101
--- src/sys/arch/amd64/conf/files.amd64:1.100	Mon Jan  8 09:33:53 2018
+++ src/sys/arch/amd64/conf/files.amd64	Sat Jan 20 14:27:14 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.100 2018/01/08 09:33:53 maxv Exp $
+#	$NetBSD: files.amd64,v 1.101 2018/01/20 14:27:14 maxv Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -36,6 +36,7 @@ file	arch/amd64/amd64/copy.S			machdep
 file	arch/amd64/amd64/spl.S			machdep
 
 file	arch/amd64/amd64/amd64func.S		machdep
+file	arch/amd64/amd64/amd64_trap.S		machdep
 file	arch/amd64/amd64/autoconf.c		machdep
 file	arch/amd64/amd64/busfunc.S		machdep
 file	arch/amd64/amd64/cpu_in_cksum.S		(inet | inet6) & cpu_in_cksum



CVS commit: src/sys/arch/amd64/amd64

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 14:08:08 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: vector.S

Log Message:
Start with .text not to inherit the last section of amd64_trap.S, and
remove outdated #define.


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/arch/amd64/amd64/vector.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/amd64/amd64/vector.S
diff -u src/sys/arch/amd64/amd64/vector.S:1.53 src/sys/arch/amd64/amd64/vector.S:1.54
--- src/sys/arch/amd64/amd64/vector.S:1.53	Wed Nov  8 18:29:04 2017
+++ src/sys/arch/amd64/amd64/vector.S	Sat Jan 20 14:08:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: vector.S,v 1.53 2017/11/08 18:29:04 maxv Exp $	*/
+/*	$NetBSD: vector.S,v 1.54 2018/01/20 14:08:08 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008 The NetBSD Foundation, Inc.
@@ -87,9 +87,9 @@
 
 #include "amd64_trap.S"
 
-/*/
+	.text
 
-#define __HAVE_GENERIC_SOFT_INTERRUPTS	/* XXX */
+/*/
 
 /*
  * Macros for interrupt entry, call to handler, and exit.



CVS commit: src/sys/arch/cobalt

2018-01-20 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Jan 20 13:56:09 UTC 2018

Modified Files:
src/sys/arch/cobalt/cobalt: bus.c interrupt.c machdep.c mainbus.c
src/sys/arch/cobalt/conf: GENERIC files.cobalt
src/sys/arch/cobalt/dev: com_mainbus.c gt.c
src/sys/arch/cobalt/include: bus_defs.h bus_funcs.h
Added Files:
src/sys/arch/cobalt/dev: gt_io_space.c gt_mem_space.c gtvar.h

Log Message:
Switch cobalt to common bus_space.

Tested on raq 2


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/cobalt/cobalt/bus.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/cobalt/cobalt/interrupt.c
cvs rdiff -u -r1.120 -r1.121 src/sys/arch/cobalt/cobalt/machdep.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/cobalt/cobalt/mainbus.c
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/cobalt/conf/GENERIC
cvs rdiff -u -r1.38 -r1.39 src/sys/arch/cobalt/conf/files.cobalt
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/cobalt/dev/com_mainbus.c
cvs rdiff -u -r1.28 -r1.29 src/sys/arch/cobalt/dev/gt.c
cvs rdiff -u -r0 -r1.1 src/sys/arch/cobalt/dev/gt_io_space.c \
src/sys/arch/cobalt/dev/gt_mem_space.c src/sys/arch/cobalt/dev/gtvar.h
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/cobalt/include/bus_defs.h \
src/sys/arch/cobalt/include/bus_funcs.h

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/cobalt/cobalt/bus.c
diff -u src/sys/arch/cobalt/cobalt/bus.c:1.45 src/sys/arch/cobalt/cobalt/bus.c:1.46
--- src/sys/arch/cobalt/cobalt/bus.c:1.45	Tue Jul 29 21:21:43 2014
+++ src/sys/arch/cobalt/cobalt/bus.c	Sat Jan 20 13:56:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.c,v 1.45 2014/07/29 21:21:43 skrll Exp $	*/
+/*	$NetBSD: bus.c,v 1.46 2018/01/20 13:56:08 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,370 +30,37 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-__KERNEL_RCSID(0, "$NetBSD: bus.c,v 1.45 2014/07/29 21:21:43 skrll Exp $");
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-
-#include 
-
-#include 
-
-/*
- * Utility macros; do not use outside this file.
- */
-#define	__PB_TYPENAME_PREFIX(BITS)	___CONCAT(uint,BITS)
-#define	__PB_TYPENAME(BITS)		___CONCAT(__PB_TYPENAME_PREFIX(BITS),_t)
-
-/*
- *	void bus_space_read_multi_N(bus_space_tag_t tag,
- *	bus_space_handle_t bsh, bus_size_t offset,
- *	uintN_t *addr, bus_size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle/offset and copy into buffer provided.
- */
-
-#define __COBALT_bus_space_read_multi(BYTES,BITS)			\
-void __CONCAT(bus_space_read_multi_,BYTES)\
-	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
-	__PB_TYPENAME(BITS) *, bus_size_t);\
-	\
-void	\
-__CONCAT(bus_space_read_multi_,BYTES)(	\
-	bus_space_tag_t t,		\
-	bus_space_handle_t h,		\
-	bus_size_t o,			\
-	__PB_TYPENAME(BITS) *a,		\
-	bus_size_t c)			\
-{	\
-	\
-	while (c--)			\
-		*a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o);	\
-}
-
-__COBALT_bus_space_read_multi(1,8)
-__COBALT_bus_space_read_multi(2,16)
-__COBALT_bus_space_read_multi(4,32)
-
-#if 0	/* Cause a link error for bus_space_read_multi_8 */
-#define	bus_space_read_multi_8	!!! bus_space_read_multi_8 unimplemented !!!
-#endif
-
-#undef __COBALT_bus_space_read_multi
-
 /*
- *	void bus_space_read_region_N(bus_space_tag_t tag,
- *	bus_space_handle_t bsh, bus_size_t offset,
- *	uintN_t *addr, bus_size_t count);
- *
- * Read `count' 1, 2, 4, or 8 byte quantities from bus space
- * described by tag/handle and starting at `offset' and copy into
- * buffer provided.
- */
-
-#define __COBALT_bus_space_read_region(BYTES,BITS)			\
-void __CONCAT(bus_space_read_region_,BYTES)\
-	(bus_space_tag_t, bus_space_handle_t, bus_size_t,		\
-	__PB_TYPENAME(BITS) *, bus_size_t);\
-	\
-void	\
-__CONCAT(bus_space_read_region_,BYTES)(	\
-	bus_space_tag_t t,		\
-	bus_space_handle_t h,		\
-	bus_size_t o,			\
-	__PB_TYPENAME(BITS) *a,		\
-	bus_size_t c)			\
-{	\
-	\
-	while (c--) {			\
-		*a++ = __CONCAT(bus_space_read_,BYTES)(t, h, o);	\
-		o += BYTES;		\
-	}\
-}
-
-__COBALT_bus_space_read_region(1,8)
-__COBALT_bus_space_read_region(2,16)
-__COBALT_bus_space_read_region(4,32)
-
-#if 0	/* Cause a link error for bus_space_read_region_8 */
-#define	bus_space_read_region_8	!!! bus_space_read_region_8 unimplemented !!!
-#endif
-
-#undef __COBALT_bus_space_read_region
-
-/*
- *	void bus_space_write_multi_N(bus_space_tag_t tag,
- *	bus_space_handle_t bsh, bus_size_t offset,
- *	const uintN_t *addr, bus_size_t count);
- *
- * Write `count' 1, 2, 4, or 8 byte quantities from the buffer
- * provided to bus space described by tag/handle/offset.
+ * Platform-specific I/O support for the cobalt machines
  */
 
-#define __COBALT_bus_space_write_mu

CVS commit: src/sys/arch/amd64/amd64

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 13:45:15 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S

Log Message:
Eliminate a '.text'.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/amd64/amd64/amd64_trap.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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.20 src/sys/arch/amd64/amd64/amd64_trap.S:1.21
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.20	Sat Jan 20 13:42:07 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Sat Jan 20 13:45:15 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.20 2018/01/20 13:42:07 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.21 2018/01/20 13:45:15 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.20 2018/01/20 13:42:07 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.21 2018/01/20 13:45:15 maxv Exp $");
 #endif
 
 /*
@@ -183,21 +183,6 @@ IDTVEC(trap03)
 	/* Jump to the code hooked in by DTrace. */
 	movq	dtrace_invop_jump_addr, %rax
 	jmpq	*dtrace_invop_jump_addr
-
-	.bss
-	.globl	dtrace_invop_jump_addr
-	.align	8
-	.type	dtrace_invop_jump_addr, @object
-	.size	dtrace_invop_jump_addr, 8
-dtrace_invop_jump_addr:
-	.zero	8
-	.globl	dtrace_invop_calltrap_addr
-	.align	8
-	.type	dtrace_invop_calltrap_addr, @object
-	.size	dtrace_invop_calltrap_addr, 8
-dtrace_invop_calltrap_addr:
-	.zero	8
-	.text
 #endif
 IDTVEC_END(trap03)
 
@@ -493,6 +478,22 @@ calltrap:
 #endif
 END(alltraps)
 
+#ifdef KDTRACE_HOOKS
+	.bss
+	.globl	dtrace_invop_jump_addr
+	.align	8
+	.type	dtrace_invop_jump_addr, @object
+	.size	dtrace_invop_jump_addr, 8
+dtrace_invop_jump_addr:
+	.zero	8
+	.globl	dtrace_invop_calltrap_addr
+	.align	8
+	.type	dtrace_invop_calltrap_addr, @object
+	.size	dtrace_invop_calltrap_addr, 8
+dtrace_invop_calltrap_addr:
+	.zero	8
+#endif
+
 	.section .rodata
 
 LABEL(x86_exceptions)



CVS commit: src/sys/arch/amd64/amd64

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 13:42:07 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S machdep.c

Log Message:
Don't declare exceptions[] with IDTVEC, it's an array, not a function.
Rename it to x86_exceptions[], and move it to .rodata.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.292 -r1.293 src/sys/arch/amd64/amd64/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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.19 src/sys/arch/amd64/amd64/amd64_trap.S:1.20
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.19	Sat Jan 20 08:30:53 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Sat Jan 20 13:42:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.19 2018/01/20 08:30:53 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.20 2018/01/20 13:42:07 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.19 2018/01/20 08:30:53 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.20 2018/01/20 13:42:07 maxv Exp $");
 #endif
 
 /*
@@ -360,25 +360,6 @@ IDTVEC_END(trap29)
 IDTVEC_END(trap30)
 IDTVEC_END(trap31)
 
-IDTVEC(exceptions)
-	.quad	_C_LABEL(Xtrap00), _C_LABEL(Xtrap01)
-	.quad	_C_LABEL(Xtrap02), _C_LABEL(Xtrap03)
-	.quad	_C_LABEL(Xtrap04), _C_LABEL(Xtrap05)
-	.quad	_C_LABEL(Xtrap06), _C_LABEL(Xtrap07)
-	.quad	_C_LABEL(Xtrap08), _C_LABEL(Xtrap09)
-	.quad	_C_LABEL(Xtrap10), _C_LABEL(Xtrap11)
-	.quad	_C_LABEL(Xtrap12), _C_LABEL(Xtrap13)
-	.quad	_C_LABEL(Xtrap14), _C_LABEL(Xtrap15)
-	.quad	_C_LABEL(Xtrap16), _C_LABEL(Xtrap17)
-	.quad	_C_LABEL(Xtrap18), _C_LABEL(Xtrap19)
-	.quad	_C_LABEL(Xtrap20), _C_LABEL(Xtrap21)
-	.quad	_C_LABEL(Xtrap22), _C_LABEL(Xtrap23)
-	.quad	_C_LABEL(Xtrap24), _C_LABEL(Xtrap25)
-	.quad	_C_LABEL(Xtrap26), _C_LABEL(Xtrap27)
-	.quad	_C_LABEL(Xtrap28), _C_LABEL(Xtrap29)
-	.quad	_C_LABEL(Xtrap30), _C_LABEL(Xtrap31)
-IDTVEC_END(exceptions)
-
 IDTVEC(intrspurious)
 	ZTRAP_NJ(T_ASTFLT)
 	INTRENTRY
@@ -512,3 +493,24 @@ calltrap:
 #endif
 END(alltraps)
 
+	.section .rodata
+
+LABEL(x86_exceptions)
+	.quad	_C_LABEL(Xtrap00), _C_LABEL(Xtrap01)
+	.quad	_C_LABEL(Xtrap02), _C_LABEL(Xtrap03)
+	.quad	_C_LABEL(Xtrap04), _C_LABEL(Xtrap05)
+	.quad	_C_LABEL(Xtrap06), _C_LABEL(Xtrap07)
+	.quad	_C_LABEL(Xtrap08), _C_LABEL(Xtrap09)
+	.quad	_C_LABEL(Xtrap10), _C_LABEL(Xtrap11)
+	.quad	_C_LABEL(Xtrap12), _C_LABEL(Xtrap13)
+	.quad	_C_LABEL(Xtrap14), _C_LABEL(Xtrap15)
+	.quad	_C_LABEL(Xtrap16), _C_LABEL(Xtrap17)
+	.quad	_C_LABEL(Xtrap18), _C_LABEL(Xtrap19)
+	.quad	_C_LABEL(Xtrap20), _C_LABEL(Xtrap21)
+	.quad	_C_LABEL(Xtrap22), _C_LABEL(Xtrap23)
+	.quad	_C_LABEL(Xtrap24), _C_LABEL(Xtrap25)
+	.quad	_C_LABEL(Xtrap26), _C_LABEL(Xtrap27)
+	.quad	_C_LABEL(Xtrap28), _C_LABEL(Xtrap29)
+	.quad	_C_LABEL(Xtrap30), _C_LABEL(Xtrap31)
+END(x86_exceptions)
+

Index: src/sys/arch/amd64/amd64/machdep.c
diff -u src/sys/arch/amd64/amd64/machdep.c:1.292 src/sys/arch/amd64/amd64/machdep.c:1.293
--- src/sys/arch/amd64/amd64/machdep.c:1.292	Sat Jan 20 07:43:28 2018
+++ src/sys/arch/amd64/amd64/machdep.c	Sat Jan 20 13:42:07 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.292 2018/01/20 07:43:28 maxv Exp $	*/
+/*	$NetBSD: machdep.c,v 1.293 2018/01/20 13:42:07 maxv Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011
@@ -110,7 +110,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.292 2018/01/20 07:43:28 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.293 2018/01/20 13:42:07 maxv Exp $");
 
 /* #define XENDEBUG_LOW  */
 
@@ -1488,7 +1488,7 @@ typedef void (vector)(void);
 extern vector IDTVEC(syscall);
 extern vector IDTVEC(syscall32);
 extern vector IDTVEC(osyscall);
-extern vector *IDTVEC(exceptions)[];
+extern vector *x86_exceptions[];
 
 static void
 init_x86_64_ksyms(void)
@@ -1777,7 +1777,7 @@ init_x86_64(paddr_t first_avail)
 			ist = 0;
 			break;
 		}
-		setgate(&idt[x], IDTVEC(exceptions)[x], ist, SDT_SYS386IGT,
+		setgate(&idt[x], x86_exceptions[x], ist, SDT_SYS386IGT,
 		(x == 3 || x == 4) ? SEL_UPL : SEL_KPL,
 		GSEL(GCODE_SEL, SEL_KPL));
 #else /* XEN */
@@ -1801,7 +1801,7 @@ init_x86_64(paddr_t first_avail)
 
 		xen_idt[xen_idt_idx].cs = GSEL(GCODE_SEL, SEL_KPL);
 		xen_idt[xen_idt_idx].address =
-		(unsigned long)IDTVEC(exceptions)[x];
+		(unsigned long)x86_exceptions[x];
 		xen_idt_idx++;
 #endif /* XEN */
 	}



CVS commit: src/sys/arch/x86/x86

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 08:45:28 UTC 2018

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Mmh, restore PG_G on the direct map, we still want that in the non-SVS
case.


To generate a diff of this commit:
cvs rdiff -u -r1.278 -r1.279 src/sys/arch/x86/x86/pmap.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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.278 src/sys/arch/x86/x86/pmap.c:1.279
--- src/sys/arch/x86/x86/pmap.c:1.278	Sun Jan  7 16:10:16 2018
+++ src/sys/arch/x86/x86/pmap.c	Sat Jan 20 08:45:28 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.278 2018/01/07 16:10:16 maxv Exp $	*/
+/*	$NetBSD: pmap.c,v 1.279 2018/01/20 08:45:28 maxv Exp $	*/
 
 /*
  * Copyright (c) 2008, 2010, 2016, 2017 The NetBSD Foundation, Inc.
@@ -170,7 +170,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.278 2018/01/07 16:10:16 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.279 2018/01/20 08:45:28 maxv Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1635,9 +1635,11 @@ pmap_init_directmap(struct pmap *kpm)
 		pa = (paddr_t)(i * NBPD_L2);
 
 		if (spahole <= pa && pa < epahole) {
-			L2_BASE[L2e_idx+i] = pa | holepteflags | PG_U | PG_PS;
+			L2_BASE[L2e_idx+i] = pa | holepteflags | PG_U |
+			PG_PS | pmap_pg_g;
 		} else {
-			L2_BASE[L2e_idx+i] = pa | pteflags | PG_U | PG_PS;
+			L2_BASE[L2e_idx+i] = pa | pteflags | PG_U |
+			PG_PS | pmap_pg_g;
 		}
 	}
 



CVS commit: src/sys/arch/amd64/amd64

2018-01-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Jan 20 08:30:53 UTC 2018

Modified Files:
src/sys/arch/amd64/amd64: amd64_trap.S trap.c

Log Message:
Fix the double-fault handler. We're executing on ist1 and must not jump
out of it, so don't enable interrupts. And use the SVS_*_ALTSTACK macros.

While here, fix the NMI handler too: it should use SVS_LEAVE_ALTSTACK.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/amd64/amd64/amd64_trap.S
cvs rdiff -u -r1.110 -r1.111 src/sys/arch/amd64/amd64/trap.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/amd64/amd64/amd64_trap.S
diff -u src/sys/arch/amd64/amd64/amd64_trap.S:1.18 src/sys/arch/amd64/amd64/amd64_trap.S:1.19
--- src/sys/arch/amd64/amd64/amd64_trap.S:1.18	Thu Jan 18 07:25:34 2018
+++ src/sys/arch/amd64/amd64/amd64_trap.S	Sat Jan 20 08:30:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: amd64_trap.S,v 1.18 2018/01/18 07:25:34 maxv Exp $	*/
+/*	$NetBSD: amd64_trap.S,v 1.19 2018/01/20 08:30:53 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2007, 2008, 2017 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
 
 #if 0
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.18 2018/01/18 07:25:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: amd64_trap.S,v 1.19 2018/01/20 08:30:53 maxv Exp $");
 #endif
 
 /*
@@ -146,7 +146,7 @@ IDTVEC(trap02)
 	movq	%rsp,%rdi
 	incq	CPUVAR(NTRAP)
 	call	_C_LABEL(nmitrap)
-	SVS_LEAVE
+	SVS_LEAVE_ALTSTACK
 
 .Lnmileave:
 	movw	TF_ES(%rsp),%es
@@ -224,8 +224,43 @@ IDTVEC(trap07)
 	jmp	.Lalltraps_checkusr
 IDTVEC_END(trap07)
 
+/*
+ * Double faults execute on a particular stack, and we must not jump out
+ * of it. So don't enable interrupts.
+ */
 IDTVEC(trap08)
+#if defined(XEN)
 	TRAP(T_DOUBLEFLT)
+#else
+	TRAP_NJ(T_DOUBLEFLT)
+	subq	$TF_REGSIZE,%rsp
+	INTR_SAVE_GPRS
+	SVS_ENTER_ALTSTACK
+	testb	$SEL_UPL,TF_CS(%rsp)
+	jz	1f
+	swapgs
+1:
+	cld
+	SMAP_ENABLE
+	movw	%gs,TF_GS(%rsp)
+	movw	%fs,TF_FS(%rsp)
+	movw	%es,TF_ES(%rsp)
+	movw	%ds,TF_DS(%rsp)
+
+	movq	%rsp,%rdi
+	incq	CPUVAR(NTRAP)
+	call	_C_LABEL(doubletrap)
+
+	SVS_LEAVE_ALTSTACK
+	INTR_RESTORE_GPRS
+
+	testb	$SEL_UPL,TF_CS(%rsp)
+	jz	1f
+	swapgs
+1:
+	addq	$TF_REGSIZE+16,%rsp
+	iretq
+#endif
 IDTVEC_END(trap08)
 
 IDTVEC(trap09)

Index: src/sys/arch/amd64/amd64/trap.c
diff -u src/sys/arch/amd64/amd64/trap.c:1.110 src/sys/arch/amd64/amd64/trap.c:1.111
--- src/sys/arch/amd64/amd64/trap.c:1.110	Wed Jan 10 20:51:11 2018
+++ src/sys/arch/amd64/amd64/trap.c	Sat Jan 20 08:30:53 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.110 2018/01/10 20:51:11 maxv Exp $	*/
+/*	$NetBSD: trap.c,v 1.111 2018/01/20 08:30:53 maxv Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000, 2017 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.110 2018/01/10 20:51:11 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.111 2018/01/20 08:30:53 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_kgdb.h"
@@ -121,6 +121,7 @@ dtrace_doubletrap_func_t	dtrace_doubletr
 #endif
 
 void nmitrap(struct trapframe *);
+void doubletrap(struct trapframe *);
 void trap(struct trapframe *);
 void trap_return_fault_return(struct trapframe *) __dead;
 
@@ -228,6 +229,22 @@ nmitrap(struct trapframe *frame)
 	x86_nmi();
 }
 
+void
+doubletrap(struct trapframe *frame)
+{
+	const int type = T_DOUBLEFLT;
+	struct lwp *l = curlwp;
+
+	trap_print(frame, l);
+
+	if (kdb_trap(type, 0, frame))
+		return;
+	if (kgdb_trap(type, frame))
+		return;
+
+	panic("double fault");
+}
+
 /*
  * Did we receive in kernel mode a trap that ought to be considered as a user
  * trap? If this function returns, the answer is no.