CVS commit: [netbsd-6] src/sys/arch/arc/include
Module Name:src Committed By: skrll Date: Tue Aug 16 14:09:27 UTC 2022 Modified Files: src/sys/arch/arc/include [netbsd-6]: pci_machdep.h Log Message: Remove commits to wrong branch. To generate a diff of this commit: cvs rdiff -u -r1.9.10.2 -r1.9.10.3 src/sys/arch/arc/include/pci_machdep.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/arc/include/pci_machdep.h diff -u src/sys/arch/arc/include/pci_machdep.h:1.9.10.2 src/sys/arch/arc/include/pci_machdep.h:1.9.10.3 --- src/sys/arch/arc/include/pci_machdep.h:1.9.10.2 Tue Aug 16 13:55:15 2022 +++ src/sys/arch/arc/include/pci_machdep.h Tue Aug 16 14:09:27 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.9.10.2 2022/08/16 13:55:15 skrll Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.9.10.3 2022/08/16 14:09:27 skrll Exp $ */ /* NetBSD: pci_machdep.h,v 1.3 1999/03/19 03:40:46 cgd Exp */ /* @@ -28,9 +28,6 @@ * rights to redistribute these changes. */ -#ifndef _MACHINE_PCI_MACHDEP_H_ -#define _MACHINE_PCI_MACHDEP_H_ - /* * Machine-specific definitions for PCI autoconfiguration. */ @@ -103,7 +100,5 @@ struct arc_pci_chipset { (*(c)->pc_intr_disestablish)((c), (iv)) #define pci_conf_interrupt(c, b, d, f, s, i)\ (*(c)->pc_conf_interrupt)((c), (b), (d), (f), (s), (i)) -#define pci_conf_hook(c, b, d, f, i) \ +#define pci_conf_hook(c, b, d, f, i)\ (*(c)->pc_conf_hook)((c), (b), (d), (f), (i)) - -#endif /* _MACHINE_PCI_MACHDEP_H_ */
CVS commit: [netbsd-6] src/sys/arch/arc/include
Module Name:src Committed By: skrll Date: Tue Aug 16 14:09:27 UTC 2022 Modified Files: src/sys/arch/arc/include [netbsd-6]: pci_machdep.h Log Message: Remove commits to wrong branch. To generate a diff of this commit: cvs rdiff -u -r1.9.10.2 -r1.9.10.3 src/sys/arch/arc/include/pci_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/arc/include
Module Name:src Committed By: skrll Date: Tue Aug 16 13:55:15 UTC 2022 Modified Files: src/sys/arch/arc/include [netbsd-6]: pci_machdep.h Log Message: Multiple inclusion protection. To generate a diff of this commit: cvs rdiff -u -r1.9.10.1 -r1.9.10.2 src/sys/arch/arc/include/pci_machdep.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/arc/include/pci_machdep.h diff -u src/sys/arch/arc/include/pci_machdep.h:1.9.10.1 src/sys/arch/arc/include/pci_machdep.h:1.9.10.2 --- src/sys/arch/arc/include/pci_machdep.h:1.9.10.1 Tue Aug 16 13:52:58 2022 +++ src/sys/arch/arc/include/pci_machdep.h Tue Aug 16 13:55:15 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.9.10.1 2022/08/16 13:52:58 skrll Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.9.10.2 2022/08/16 13:55:15 skrll Exp $ */ /* NetBSD: pci_machdep.h,v 1.3 1999/03/19 03:40:46 cgd Exp */ /* @@ -28,6 +28,9 @@ * rights to redistribute these changes. */ +#ifndef _MACHINE_PCI_MACHDEP_H_ +#define _MACHINE_PCI_MACHDEP_H_ + /* * Machine-specific definitions for PCI autoconfiguration. */ @@ -102,3 +105,5 @@ struct arc_pci_chipset { (*(c)->pc_conf_interrupt)((c), (b), (d), (f), (s), (i)) #define pci_conf_hook(c, b, d, f, i) \ (*(c)->pc_conf_hook)((c), (b), (d), (f), (i)) + +#endif /* _MACHINE_PCI_MACHDEP_H_ */
CVS commit: [netbsd-6] src/sys/arch/arc/include
Module Name:src Committed By: skrll Date: Tue Aug 16 13:55:15 UTC 2022 Modified Files: src/sys/arch/arc/include [netbsd-6]: pci_machdep.h Log Message: Multiple inclusion protection. To generate a diff of this commit: cvs rdiff -u -r1.9.10.1 -r1.9.10.2 src/sys/arch/arc/include/pci_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/arc/include
Module Name:src Committed By: skrll Date: Tue Aug 16 13:52:58 UTC 2022 Modified Files: src/sys/arch/arc/include [netbsd-6]: pci_machdep.h Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.10.1 src/sys/arch/arc/include/pci_machdep.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/arc/include/pci_machdep.h diff -u src/sys/arch/arc/include/pci_machdep.h:1.9 src/sys/arch/arc/include/pci_machdep.h:1.9.10.1 --- src/sys/arch/arc/include/pci_machdep.h:1.9 Mon Apr 4 20:37:45 2011 +++ src/sys/arch/arc/include/pci_machdep.h Tue Aug 16 13:52:58 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_machdep.h,v 1.9 2011/04/04 20:37:45 dyoung Exp $ */ +/* $NetBSD: pci_machdep.h,v 1.9.10.1 2022/08/16 13:52:58 skrll Exp $ */ /* NetBSD: pci_machdep.h,v 1.3 1999/03/19 03:40:46 cgd Exp */ /* @@ -100,5 +100,5 @@ struct arc_pci_chipset { (*(c)->pc_intr_disestablish)((c), (iv)) #define pci_conf_interrupt(c, b, d, f, s, i)\ (*(c)->pc_conf_interrupt)((c), (b), (d), (f), (s), (i)) -#define pci_conf_hook(c, b, d, f, i)\ +#define pci_conf_hook(c, b, d, f, i) \ (*(c)->pc_conf_hook)((c), (b), (d), (f), (i))
CVS commit: [netbsd-6] src/sys/arch/arc/include
Module Name:src Committed By: skrll Date: Tue Aug 16 13:52:58 UTC 2022 Modified Files: src/sys/arch/arc/include [netbsd-6]: pci_machdep.h Log Message: Whitespace To generate a diff of this commit: cvs rdiff -u -r1.9 -r1.9.10.1 src/sys/arch/arc/include/pci_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/conf
Module Name:src Committed By: martin Date: Thu Jun 7 18:01:51 UTC 2018 Modified Files: src/sys/arch/sparc64/conf [netbsd-6]: GENERIC32 NONPLUS Log Message: Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not disable it here again. To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.140.102.1 src/sys/arch/sparc64/conf/GENERIC32 cvs rdiff -u -r1.58 -r1.58.102.1 src/sys/arch/sparc64/conf/NONPLUS Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/conf
Module Name:src Committed By: martin Date: Thu Jun 7 18:01:51 UTC 2018 Modified Files: src/sys/arch/sparc64/conf [netbsd-6]: GENERIC32 NONPLUS Log Message: Fix fallout from ticket #1500: COMPAT_SVR4* has been disabled, do not disable it here again. To generate a diff of this commit: cvs rdiff -u -r1.140 -r1.140.102.1 src/sys/arch/sparc64/conf/GENERIC32 cvs rdiff -u -r1.58 -r1.58.102.1 src/sys/arch/sparc64/conf/NONPLUS 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/sparc64/conf/GENERIC32 diff -u src/sys/arch/sparc64/conf/GENERIC32:1.140 src/sys/arch/sparc64/conf/GENERIC32:1.140.102.1 --- src/sys/arch/sparc64/conf/GENERIC32:1.140 Fri Jun 30 10:27:48 2006 +++ src/sys/arch/sparc64/conf/GENERIC32 Thu Jun 7 18:01:51 2018 @@ -1,13 +1,13 @@ -# $NetBSD: GENERIC32,v 1.140 2006/06/30 10:27:48 tsutsui Exp $ +# $NetBSD: GENERIC32,v 1.140.102.1 2018/06/07 18:01:51 martin Exp $ # # GENERIC machine description file for 32-bit kernel # include "arch/sparc64/conf/GENERIC" -#ident "GENERIC32-$Revision: 1.140 $" +#ident "GENERIC32-$Revision: 1.140.102.1 $" include "arch/sparc64/conf/std.sparc64-32" no options COMPAT_NETBSD32 -no options COMPAT_SVR4_32 +#no options COMPAT_SVR4_32 Index: src/sys/arch/sparc64/conf/NONPLUS diff -u src/sys/arch/sparc64/conf/NONPLUS:1.58 src/sys/arch/sparc64/conf/NONPLUS:1.58.102.1 --- src/sys/arch/sparc64/conf/NONPLUS:1.58 Fri Jun 30 10:27:48 2006 +++ src/sys/arch/sparc64/conf/NONPLUS Thu Jun 7 18:01:51 2018 @@ -1,9 +1,9 @@ -# $NetBSD: NONPLUS,v 1.58 2006/06/30 10:27:48 tsutsui Exp $ +# $NetBSD: NONPLUS,v 1.58.102.1 2018/06/07 18:01:51 martin Exp $ include "arch/sparc64/conf/NONPLUS64" include "arch/sparc64/conf/std.sparc64-32" -#ident "NONPLUS-$Revision: 1.58 $" +#ident "NONPLUS-$Revision: 1.58.102.1 $" no options COMPAT_NETBSD32 # NetBSD/sparc binary compatibility -no options COMPAT_SVR4_32 # 32-bit SVR4 binaries +#no options COMPAT_SVR4_32 # 32-bit SVR4 binaries
CVS commit: [netbsd-6] src/sys/arch/amiga/amiga
Module Name:src Committed By: martin Date: Tue Apr 10 11:27:55 UTC 2018 Modified Files: src/sys/arch/amiga/amiga [netbsd-6]: cc.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1544): sys/arch/amiga/amiga/cc.c: revision 1.27 (patch) spl leak, found by mootja To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.22.14.1 src/sys/arch/amiga/amiga/cc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/amiga/amiga
Module Name:src Committed By: martin Date: Tue Apr 10 11:27:55 UTC 2018 Modified Files: src/sys/arch/amiga/amiga [netbsd-6]: cc.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1544): sys/arch/amiga/amiga/cc.c: revision 1.27 (patch) spl leak, found by mootja To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.22.14.1 src/sys/arch/amiga/amiga/cc.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/amiga/amiga/cc.c diff -u src/sys/arch/amiga/amiga/cc.c:1.22 src/sys/arch/amiga/amiga/cc.c:1.22.14.1 --- src/sys/arch/amiga/amiga/cc.c:1.22 Mon Dec 20 00:25:25 2010 +++ src/sys/arch/amiga/amiga/cc.c Tue Apr 10 11:27:55 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: cc.c,v 1.22 2010/12/20 00:25:25 matt Exp $ */ +/* $NetBSD: cc.c,v 1.22.14.1 2018/04/10 11:27:55 martin Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.22 2010/12/20 00:25:25 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cc.c,v 1.22.14.1 2018/04/10 11:27:55 martin Exp $"); #include #include @@ -504,9 +504,10 @@ alloc_chipmem(u_long size) while (size > mn->size && mn != (void *)_list) mn = mn->free_link.cqe_next; - if (mn == (void *)_list) + if (mn == (void *)_list) { + splx(s); return(NULL); - + } if ((mn->size - size) <= sizeof (*mn)) { /* * our allocation would not leave room
CVS commit: [netbsd-6] src/sys/arch/macppc/dev
Module Name:src Committed By: snj Date: Tue Mar 13 17:09:15 UTC 2018 Modified Files: src/sys/arch/macppc/dev [netbsd-6]: snapper.c Log Message: Pull up following revision(s) (requested by sevan in ticket #1522): sys/arch/macppc/dev/snapper.c: 1.42 Fix issue with audio being downpitched, thanks to "it seems that snapper_init should be called before audio_attach_mi, as snapper init is setting the rate to 44100 after the hardware format has been configured by audio_attach_mi. audio_attach_mi should be the last thing called during an attach of an audio device so the audio device is ready to be configured when audio_attach_mi is called." Resolves PR port-macppc/52949 To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c diff -u src/sys/arch/macppc/dev/snapper.c:1.38 src/sys/arch/macppc/dev/snapper.c:1.38.4.1 --- src/sys/arch/macppc/dev/snapper.c:1.38 Thu Nov 24 03:35:57 2011 +++ src/sys/arch/macppc/dev/snapper.c Tue Mar 13 17:09:15 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: snapper.c,v 1.38 2011/11/24 03:35:57 mrg Exp $ */ +/* $NetBSD: snapper.c,v 1.38.4.1 2018/03/13 17:09:15 snj Exp $ */ /* Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp */ /* Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp */ @@ -35,7 +35,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.38 2011/11/24 03:35:57 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.38.4.1 2018/03/13 17:09:15 snj Exp $"); #include #include @@ -839,10 +839,10 @@ snapper_defer(device_t dev) break; } - audio_attach_mi(_hw_if, sc, sc->sc_dev); - /* ki2c_setmode(sc->sc_i2c, I2C_STDSUBMODE); */ snapper_init(sc, sc->sc_node); + + audio_attach_mi(_hw_if, sc, sc->sc_dev); } static int
CVS commit: [netbsd-6] src/sys/arch/macppc/dev
Module Name:src Committed By: snj Date: Tue Mar 13 17:09:15 UTC 2018 Modified Files: src/sys/arch/macppc/dev [netbsd-6]: snapper.c Log Message: Pull up following revision(s) (requested by sevan in ticket #1522): sys/arch/macppc/dev/snapper.c: 1.42 Fix issue with audio being downpitched, thanks to "it seems that snapper_init should be called before audio_attach_mi, as snapper init is setting the rate to 44100 after the hardware format has been configured by audio_attach_mi. audio_attach_mi should be the last thing called during an attach of an audio device so the audio device is ready to be configured when audio_attach_mi is called." Resolves PR port-macppc/52949 To generate a diff of this commit: cvs rdiff -u -r1.38 -r1.38.4.1 src/sys/arch/macppc/dev/snapper.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc/sparc
Module Name:src Committed By: snj Date: Tue Mar 13 16:48:05 UTC 2018 Modified Files: src/sys/arch/sparc/sparc [netbsd-6]: timer.c timer_sun4m.c timerreg.h Log Message: Pull up following revision(s) (requested by mrg in ticket #1519): sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31 sys/arch/sparc/sparc/timer.c: 1.33 sys/arch/sparc/sparc/timer.c: 1.33 1.34 sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10 fix time goes backwards problems on sparc. there are a few things here: - there's a race between reading the limit register (which clears the interrupt and the limit bit) and increasing the latest offset. this can happen easily if an interrupt comes between the read and the call to tickle_tc() that increases the offset (i obverved this actually happening.) - in early boot, sometimes the counter can cycle twice before the tickle happens. to handle these issues, add two workarounds: - if the limit bit isn't set, but the counter value is less than the previous value, and the offset hasn't changed, use the same fixup as if the limit bit was set. this handles the first case above. - add a hard-workaround for never allowing returning a smaller value (except during 32 bit overflow): if the result is less than the last result, add fixups until it does (or until it would overflow.) the first workaround fixes general run-time issues, and the second fixes issues only seen during boot. also expand some comments in timer_sun4m.c and re-enable the sun4m sub-microsecond tmr_ustolim4m() support (but it's always called with at least 'tick' microseconds, so the end result is the same.) fix hang at 4B microseconds (1h12 or so), and simplify part of the previous To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.29.8.1 src/sys/arch/sparc/sparc/timer.c cvs rdiff -u -r1.28 -r1.28.8.1 src/sys/arch/sparc/sparc/timer_sun4m.c cvs rdiff -u -r1.9 -r1.9.118.1 src/sys/arch/sparc/sparc/timerreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc/sparc
Module Name:src Committed By: snj Date: Tue Mar 13 16:48:05 UTC 2018 Modified Files: src/sys/arch/sparc/sparc [netbsd-6]: timer.c timer_sun4m.c timerreg.h Log Message: Pull up following revision(s) (requested by mrg in ticket #1519): sys/arch/sparc/sparc/timer_sun4m.c: 1.33 1.34 1.31 sys/arch/sparc/sparc/timer.c: 1.33 sys/arch/sparc/sparc/timer.c: 1.33 1.34 sys/arch/sparc/sparc/timerreg.h: 1.33 1.34 1.31 1.10 fix time goes backwards problems on sparc. there are a few things here: - there's a race between reading the limit register (which clears the interrupt and the limit bit) and increasing the latest offset. this can happen easily if an interrupt comes between the read and the call to tickle_tc() that increases the offset (i obverved this actually happening.) - in early boot, sometimes the counter can cycle twice before the tickle happens. to handle these issues, add two workarounds: - if the limit bit isn't set, but the counter value is less than the previous value, and the offset hasn't changed, use the same fixup as if the limit bit was set. this handles the first case above. - add a hard-workaround for never allowing returning a smaller value (except during 32 bit overflow): if the result is less than the last result, add fixups until it does (or until it would overflow.) the first workaround fixes general run-time issues, and the second fixes issues only seen during boot. also expand some comments in timer_sun4m.c and re-enable the sun4m sub-microsecond tmr_ustolim4m() support (but it's always called with at least 'tick' microseconds, so the end result is the same.) fix hang at 4B microseconds (1h12 or so), and simplify part of the previous To generate a diff of this commit: cvs rdiff -u -r1.29 -r1.29.8.1 src/sys/arch/sparc/sparc/timer.c cvs rdiff -u -r1.28 -r1.28.8.1 src/sys/arch/sparc/sparc/timer_sun4m.c cvs rdiff -u -r1.9 -r1.9.118.1 src/sys/arch/sparc/sparc/timerreg.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/sparc/sparc/timer.c diff -u src/sys/arch/sparc/sparc/timer.c:1.29 src/sys/arch/sparc/sparc/timer.c:1.29.8.1 --- src/sys/arch/sparc/sparc/timer.c:1.29 Sun Jul 17 23:18:23 2011 +++ src/sys/arch/sparc/sparc/timer.c Tue Mar 13 16:48:05 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $ */ +/* $NetBSD: timer.c,v 1.29.8.1 2018/03/13 16:48:05 snj Exp $ */ /* * Copyright (c) 1992, 1993 @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29 2011/07/17 23:18:23 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: timer.c,v 1.29.8.1 2018/03/13 16:48:05 snj Exp $"); #include #include @@ -83,56 +83,93 @@ static u_int timer_get_timecount(struct * timecounter local state */ static struct counter { - volatile u_int *cntreg; /* counter register */ + __cpu_simple_lock_t lock; /* protects access to offset, reg, last* */ + volatile u_int *cntreg; /* counter register to read */ u_int limit; /* limit we count up to */ u_int offset; /* accumulated offet due to wraps */ u_int shift; /* scaling for valid bits */ u_int mask; /* valid bit mask */ -} cntr; + u_int lastcnt; /* the last* values are used to notice */ + u_int lastres; /* and fix up cases where it would appear */ + u_int lastoffset; /* time went backwards. */ +} cntr __aligned(CACHE_LINE_SIZE); /* * define timecounter */ static struct timecounter counter_timecounter = { - timer_get_timecount, /* get_timecount */ - 0, /* no poll_pps */ - ~0u, /* counter_mask */ - 0, /* frequency - set at initialisation */ - "timer-counter", /* name */ - 100, /* quality */ -/* private reference */ + .tc_get_timecount = timer_get_timecount, + .tc_poll_pps = NULL, + .tc_counter_mask = ~0u, + .tc_frequency = 0, + .tc_name = "timer-counter", + .tc_quality = 100, + .tc_priv = , }; /* * timer_get_timecount provide current counter value */ +__attribute__((__optimize__("Os"))) static u_int timer_get_timecount(struct timecounter *tc) { - struct counter *ctr = (struct counter *)tc->tc_priv; - - u_int c, res, r; + u_int cnt, res, fixup, offset; int s; - + /* + * We use splhigh/__cpu_simple_lock here as we don't want + * any mutex or lockdebug overhead. The lock protects a + * bunch of the members of cntr that are written here to + * deal with the various minor races to be observed and + * worked around. + */ s = splhigh(); - res = c = *ctr->cntreg; + __cpu_simple_lock(); + res = cnt = *cntr.cntreg; res &= ~TMR_LIMIT; + offset = cntr.offset; - if (c != res) { - r = ctr->limit; + /* + * There are 3 cases here: + * - limit reached, interrupt not yet processed. + * - count reset but offset the same, race between handling + * the interrupt and tickle_tc() updating the offset. + * - normal case. + * + * For the first two cases, add the limit so
CVS commit: [netbsd-6] src/sys/arch/sparc/sparc
Module Name:src Committed By: snj Date: Sat Mar 3 20:47:24 UTC 2018 Modified Files: src/sys/arch/sparc/sparc [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by maya in ticket #1513): sys/arch/sparc/sparc/locore.s: 1.269 Avoid an instruction requiring a higher alignment than we are guaranteed Fixes PR port-sparc/52721: ddb errors on ps command Thanks to mlelstv. To generate a diff of this commit: cvs rdiff -u -r1.265 -r1.265.8.1 src/sys/arch/sparc/sparc/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/sparc/sparc/locore.s diff -u src/sys/arch/sparc/sparc/locore.s:1.265 src/sys/arch/sparc/sparc/locore.s:1.265.8.1 --- src/sys/arch/sparc/sparc/locore.s:1.265 Mon Aug 15 02:19:44 2011 +++ src/sys/arch/sparc/sparc/locore.s Sat Mar 3 20:47:24 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.265 2011/08/15 02:19:44 mrg Exp $ */ +/* $NetBSD: locore.s,v 1.265.8.1 2018/03/03 20:47:24 snj Exp $ */ /* * Copyright (c) 1996 Paul Kranenburg @@ -6286,8 +6286,9 @@ ENTRY(longjmp) cmp %fp, %g7 ! compare against desired frame bl,a 1b ! if below, restore !pop frame and loop - be,a 2f ! if there, - ldd [%g1+0], %o2 !fetch return %sp and pc, and get out + ld [%g1+0], %o2 ! fetch return %sp + be,a 2f ! we're there, get out + ld [%g1+4], %o3 ! fetch return pc Llongjmpbotch: ! otherwise, went too far; bomb out
CVS commit: [netbsd-6] src/sys/arch/sparc/sparc
Module Name:src Committed By: snj Date: Sat Mar 3 20:47:24 UTC 2018 Modified Files: src/sys/arch/sparc/sparc [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by maya in ticket #1513): sys/arch/sparc/sparc/locore.s: 1.269 Avoid an instruction requiring a higher alignment than we are guaranteed Fixes PR port-sparc/52721: ddb errors on ps command Thanks to mlelstv. To generate a diff of this commit: cvs rdiff -u -r1.265 -r1.265.8.1 src/sys/arch/sparc/sparc/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: snj Date: Mon Feb 19 20:54:38 UTC 2018 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: machdep.c src/sys/arch/amd64/include [netbsd-6]: segments.h src/sys/arch/i386/i386 [netbsd-6]: machdep.c src/sys/arch/i386/include [netbsd-6]: segments.h src/sys/arch/x86/x86 [netbsd-6]: vm_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1517): sys/arch/amd64/amd64/machdep.c: 1.280 via patch sys/arch/amd64/include/segments.h: 1.34 via patch sys/arch/i386/i386/machdep.c: 1.800 sys/arch/i386/include/segments.h: 1.64 sys/arch/x86/x86/vm_machdep.c: 1.30 Fix a huge privilege separation vulnerability in Xen-amd64. On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL equals SEL_UPL. While Xen can make a distinction between usermode and kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes to read and write to the CPU ports. It is easy, then, to completely escalate privileges; by reprogramming the PIC, by reading the ATA disks, by intercepting the keyboard interrupts (keylogger), etc. Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use the ports but not userland. I didn't test this change on i386, but it seems fine enough. To generate a diff of this commit: cvs rdiff -u -r1.175.2.9 -r1.175.2.10 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/arch/amd64/include/segments.h cvs rdiff -u -r1.717.2.8 -r1.717.2.9 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.54 -r1.54.10.1 src/sys/arch/i386/include/segments.h cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/x86/x86/vm_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/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.175.2.9 src/sys/arch/amd64/amd64/machdep.c:1.175.2.10 --- src/sys/arch/amd64/amd64/machdep.c:1.175.2.9 Tue Aug 8 12:00:35 2017 +++ src/sys/arch/amd64/amd64/machdep.c Mon Feb 19 20:54:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.175.2.9 2017/08/08 12:00:35 martin Exp $ */ +/* $NetBSD: machdep.c,v 1.175.2.10 2018/02/19 20:54:37 snj Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -111,7 +111,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.9 2017/08/08 12:00:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.10 2018/02/19 20:54:37 snj Exp $"); /* #define XENDEBUG_LOW */ @@ -477,7 +477,7 @@ x86_64_proc0_tss_ldt_init(void) pcb->pcb_fs = 0; pcb->pcb_gs = 0; pcb->pcb_rsp0 = (uvm_lwp_getuarea(l) + KSTACK_SIZE - 16) & ~0xf; - pcb->pcb_iopl = SEL_KPL; + pcb->pcb_iopl = IOPL_KPL; pmap_kernel()->pm_ldt_sel = GSYSSEL(GLDT_SEL, SEL_KPL); pcb->pcb_cr0 = rcr0() & ~CR0_TS; Index: src/sys/arch/amd64/include/segments.h diff -u src/sys/arch/amd64/include/segments.h:1.22 src/sys/arch/amd64/include/segments.h:1.22.10.1 --- src/sys/arch/amd64/include/segments.h:1.22 Mon Feb 7 03:54:45 2011 +++ src/sys/arch/amd64/include/segments.h Mon Feb 19 20:54:37 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: segments.h,v 1.22 2011/02/07 03:54:45 chs Exp $ */ +/* $NetBSD: segments.h,v 1.22.10.1 2018/02/19 20:54:37 snj Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. @@ -107,6 +107,12 @@ #define ISLDT(s) ((s) & SEL_LDT) /* is it local or global */ #define SEL_LDT 4 /* local descriptor table */ +#ifdef XEN +#define IOPL_KPL 1 +#else +#define IOPL_KPL SEL_KPL +#endif + /* Dynamically allocated TSSs and LDTs start (byte offset) */ #define SYSSEL_START (NGDT_MEM << 3) #define DYNSEL_START (SYSSEL_START + (NGDT_SYS << 4)) Index: src/sys/arch/i386/i386/machdep.c diff -u src/sys/arch/i386/i386/machdep.c:1.717.2.8 src/sys/arch/i386/i386/machdep.c:1.717.2.9 --- src/sys/arch/i386/i386/machdep.c:1.717.2.8 Tue Aug 8 12:00:35 2017 +++ src/sys/arch/i386/i386/machdep.c Mon Feb 19 20:54:38 2018 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.717.2.8 2017/08/08 12:00:35 martin Exp $ */ +/* $NetBSD: machdep.c,v 1.717.2.9 2018/02/19 20:54:38 snj Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009 @@ -67,7 +67,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.8 2017/08/08 12:00:35 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.9 2018/02/19 20:54:38 snj Exp $"); #include "opt_beep.h" #include "opt_compat_ibcs2.h" @@ -509,7 +509,7 @@ i386_proc0_tss_ldt_init(void) pmap_kernel()->pm_ldt_sel = GSEL(GLDT_SEL, SEL_KPL); pcb->pcb_cr0 = rcr0() & ~CR0_TS; pcb->pcb_esp0 = uvm_lwp_getuarea(l) + KSTACK_SIZE - 16; - pcb->pcb_iopl = SEL_KPL; + pcb->pcb_iopl = IOPL_KPL; l->l_md.md_regs = (struct trapframe *)pcb->pcb_esp0 - 1; memcpy(>pcb_fsd, [GUDATA_SEL], sizeof(pcb->pcb_fsd));
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: snj Date: Mon Feb 19 20:54:38 UTC 2018 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: machdep.c src/sys/arch/amd64/include [netbsd-6]: segments.h src/sys/arch/i386/i386 [netbsd-6]: machdep.c src/sys/arch/i386/include [netbsd-6]: segments.h src/sys/arch/x86/x86 [netbsd-6]: vm_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1517): sys/arch/amd64/amd64/machdep.c: 1.280 via patch sys/arch/amd64/include/segments.h: 1.34 via patch sys/arch/i386/i386/machdep.c: 1.800 sys/arch/i386/include/segments.h: 1.64 sys/arch/x86/x86/vm_machdep.c: 1.30 Fix a huge privilege separation vulnerability in Xen-amd64. On amd64 the kernel runs in ring3, like userland, and therefore SEL_KPL equals SEL_UPL. While Xen can make a distinction between usermode and kernelmode in %cs, it can't when it comes to iopl. Since we set SEL_KPL in iopl, Xen sees SEL_UPL, and allows (unprivileged) userland processes to read and write to the CPU ports. It is easy, then, to completely escalate privileges; by reprogramming the PIC, by reading the ATA disks, by intercepting the keyboard interrupts (keylogger), etc. Declare IOPL_KPL, set to 1 on Xen-amd64, which allows the kernel to use the ports but not userland. I didn't test this change on i386, but it seems fine enough. To generate a diff of this commit: cvs rdiff -u -r1.175.2.9 -r1.175.2.10 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.22 -r1.22.10.1 src/sys/arch/amd64/include/segments.h cvs rdiff -u -r1.717.2.8 -r1.717.2.9 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.54 -r1.54.10.1 src/sys/arch/i386/include/segments.h cvs rdiff -u -r1.14 -r1.14.2.1 src/sys/arch/x86/x86/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/i386/i386
Module Name:src Committed By: snj Date: Fri Oct 13 08:03:04 UTC 2017 Modified Files: src/sys/arch/i386/i386 [netbsd-6]: vector.S Log Message: Pull up following revision(s) (requested by maxv in ticket #1505): sys/arch/i386/i386/i386_trap.S: revision 1.12 via patch Pfff, use %ss and not %ds. The latter is controlled by userland, the former contains the kernel value (flat); FreeBSD fixed this too a few weeks ago. As I said earlier, this dtrace code is complete bullshit. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.8.1 src/sys/arch/i386/i386/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/i386/i386/vector.S diff -u src/sys/arch/i386/i386/vector.S:1.59 src/sys/arch/i386/i386/vector.S:1.59.8.1 --- src/sys/arch/i386/i386/vector.S:1.59 Sun Jun 12 03:35:42 2011 +++ src/sys/arch/i386/i386/vector.S Fri Oct 13 08:03:03 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: vector.S,v 1.59 2011/06/12 03:35:42 rmind Exp $ */ +/* $NetBSD: vector.S,v 1.59.8.1 2017/10/13 08:03:03 snj Exp $ */ /* * Copyright 2002 (c) Wasabi Systems, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.59 2011/06/12 03:35:42 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vector.S,v 1.59.8.1 2017/10/13 08:03:03 snj Exp $"); #include "opt_ddb.h" #include "opt_multiprocessor.h" @@ -773,7 +773,7 @@ IDTVEC(trap05) SUPERALIGN_TEXT IDTVEC(trap06) /* Check if there is no DTrace hook registered. */ - cmpl $0,dtrace_invop_jump_addr + cmpl $0,%ss:dtrace_invop_jump_addr je norm_ill /* Check if this is a user fault. */
CVS commit: [netbsd-6] src/sys/arch/i386/i386
Module Name:src Committed By: snj Date: Fri Oct 13 08:03:04 UTC 2017 Modified Files: src/sys/arch/i386/i386 [netbsd-6]: vector.S Log Message: Pull up following revision(s) (requested by maxv in ticket #1505): sys/arch/i386/i386/i386_trap.S: revision 1.12 via patch Pfff, use %ss and not %ds. The latter is controlled by userland, the former contains the kernel value (flat); FreeBSD fixed this too a few weeks ago. As I said earlier, this dtrace code is complete bullshit. To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.8.1 src/sys/arch/i386/i386/vector.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Mon Sep 4 16:05:13 UTC 2017 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: compat_13_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1501): sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24 Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get kernel privileges on the hardware. ok martin To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.23.18.1 \ src/sys/arch/sparc64/sparc64/compat_13_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/sparc64/sparc64/compat_13_machdep.c diff -u src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23 src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23.18.1 --- src/sys/arch/sparc64/sparc64/compat_13_machdep.c:1.23 Sat Nov 21 04:16:52 2009 +++ src/sys/arch/sparc64/sparc64/compat_13_machdep.c Mon Sep 4 16:05:13 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $ */ +/* $NetBSD: compat_13_machdep.c,v 1.23.18.1 2017/09/04 16:05:13 snj Exp $ */ /*- * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23 2009/11/21 04:16:52 rmind Exp $"); +__KERNEL_RCSID(0, "$NetBSD: compat_13_machdep.c,v 1.23.18.1 2017/09/04 16:05:13 snj Exp $"); #ifdef _KERNEL_OPT #include "opt_ddb.h" @@ -129,7 +129,7 @@ compat_13_sys_sigreturn(struct lwp *l, c return (EINVAL); /* take only psr ICC field */ #ifdef __arch64__ - tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | scp->sc_tstate; + tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | (scp->sc_tstate & TSTATE_CCR); #else tf->tf_tstate = (int64_t)(tf->tf_tstate & ~TSTATE_CCR) | PSRCC_TO_TSTATE(scp->sc_psr); #endif
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Mon Sep 4 16:05:13 UTC 2017 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: compat_13_machdep.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1501): sys/arch/sparc64/sparc64/compat_13_machdep.c: revision 1.24 Apply only CCR. Otherwise userland could set PSTATE_PRIV in %pstate and get kernel privileges on the hardware. ok martin To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.23.18.1 \ src/sys/arch/sparc64/sparc64/compat_13_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: martin Date: Thu Aug 31 15:18:12 UTC 2017 Modified Files: src/sys/arch/evbmips/conf [netbsd-6]: MALTA MALTA32 MALTA64 src/sys/arch/mips/mips [netbsd-6]: bds_emul.S Log Message: Pull up following revision(s) (requested by mrg in ticket #1499): sys/arch/evbmips/conf/MALTA64: revision 1.8 sys/arch/evbmips/conf/MALTA32: revision 1.4 sys/arch/mips/mips/bds_emul.S: revision 1.9 sys/arch/evbmips/conf/MALTA: revision 1.88 Re-enable the NOFPU and (renamed) FPEMUL options. None of the Malta CPU daughter cards currently supported by NetBSD have an FPU. Detected on real hardware. gxemul wrongly supports an FPU on the 4Kc and 5Kc CPUs. Remove the NOFPU option. The main MALTA config file has this now. mips_emul_daddi and mips_emul_daddiu don't exist, but there are bcemul_daddi and bcemul_daddiu here that should be used. however, bcemul_daddi needed to be changed to use dadd not daddui. fixes FPEMUL and N64 kernels. ok simonb. To generate a diff of this commit: cvs rdiff -u -r1.65.2.1 -r1.65.2.2 src/sys/arch/evbmips/conf/MALTA cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/evbmips/conf/MALTA32 cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/arch/evbmips/conf/MALTA64 cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/mips/mips/bds_emul.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/evbmips/conf/MALTA diff -u src/sys/arch/evbmips/conf/MALTA:1.65.2.1 src/sys/arch/evbmips/conf/MALTA:1.65.2.2 --- src/sys/arch/evbmips/conf/MALTA:1.65.2.1 Mon Sep 17 18:40:12 2012 +++ src/sys/arch/evbmips/conf/MALTA Thu Aug 31 15:18:12 2017 @@ -1,17 +1,18 @@ -# $NetBSD: MALTA,v 1.65.2.1 2012/09/17 18:40:12 riz Exp $ +# $NetBSD: MALTA,v 1.65.2.2 2017/08/31 15:18:12 martin Exp $ include "arch/evbmips/conf/std.malta" #options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "MALTA-$Revision: 1.65.2.1 $" +#ident "MALTA-$Revision: 1.65.2.2 $" maxusers 32 options MIPS32 options MIPS64 -#options NOFPU # No FPU -#options FPEMUL # emulate FPU insn + +options NOFPU # No FPU +options FPEMUL # emulate FPU insn # Options for necessary to use MD # options MEMORY_DISK_HOOKS Index: src/sys/arch/evbmips/conf/MALTA32 diff -u src/sys/arch/evbmips/conf/MALTA32:1.3 src/sys/arch/evbmips/conf/MALTA32:1.3.2.1 --- src/sys/arch/evbmips/conf/MALTA32:1.3 Thu Feb 9 18:58:44 2012 +++ src/sys/arch/evbmips/conf/MALTA32 Thu Aug 31 15:18:12 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA32,v 1.3 2012/02/09 18:58:44 matt Exp $ +# $NetBSD: MALTA32,v 1.3.2.1 2017/08/31 15:18:12 martin Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="no" no options MIPS32 -options NOFPU # No FPU #options EXEC_ELF64 no ath* Index: src/sys/arch/evbmips/conf/MALTA64 diff -u src/sys/arch/evbmips/conf/MALTA64:1.5.2.1 src/sys/arch/evbmips/conf/MALTA64:1.5.2.2 --- src/sys/arch/evbmips/conf/MALTA64:1.5.2.1 Sat Oct 13 06:15:23 2012 +++ src/sys/arch/evbmips/conf/MALTA64 Thu Aug 31 15:18:12 2017 @@ -1,11 +1,10 @@ -# $NetBSD: MALTA64,v 1.5.2.1 2012/10/13 06:15:23 riz Exp $ +# $NetBSD: MALTA64,v 1.5.2.2 2017/08/31 15:18:12 martin Exp $ # include "arch/evbmips/conf/MALTA" makeoptions LP64="yes" no options MIPS32 -options NOFPU # No FPU options EXEC_ELF64 options COMPAT_NETBSD32 no options SYMTAB_SPACE Index: src/sys/arch/mips/mips/bds_emul.S diff -u src/sys/arch/mips/mips/bds_emul.S:1.6 src/sys/arch/mips/mips/bds_emul.S:1.6.2.1 --- src/sys/arch/mips/mips/bds_emul.S:1.6 Sun Dec 25 11:51:15 2011 +++ src/sys/arch/mips/mips/bds_emul.S Thu Aug 31 15:18:12 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: bds_emul.S,v 1.6 2011/12/25 11:51:15 kiyohara Exp $ */ +/* $NetBSD: bds_emul.S,v 1.6.2.1 2017/08/31 15:18:12 martin Exp $ */ /* * Copyright (c) 1992, 1993 @@ -101,8 +101,8 @@ bcemul_optbl: PTR_WORD bcemul_sigill # 030 LDL (*) PTR_WORD bcemul_sigill # 031 LDR (*) #else - PTR_WORD _C_LABEL(mips_emul_daddi) # 030 DADDI (*) - PTR_WORD _C_LABEL(mips_emul_daddiu) # 031 DADDIU (*) + PTR_WORD bcemul_daddi # 030 DADDI (*) + PTR_WORD bcemul_daddiu # 031 DADDIU (*) PTR_WORD _C_LABEL(mips_emul_ldl) # 032 LDL (*) PTR_WORD _C_LABEL(mips_emul_ldr) # 033 LDR (*) #endif @@ -191,7 +191,7 @@ bcemul_uimmed_prologue: #ifndef __mips_o32 bcemul_daddi: bal bcemul_immed_prologue - daddiu t0, v0, v1 + dadd t0, v0, v1 b bcemul_check_add_overflow #endif
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: martin Date: Thu Aug 31 15:18:12 UTC 2017 Modified Files: src/sys/arch/evbmips/conf [netbsd-6]: MALTA MALTA32 MALTA64 src/sys/arch/mips/mips [netbsd-6]: bds_emul.S Log Message: Pull up following revision(s) (requested by mrg in ticket #1499): sys/arch/evbmips/conf/MALTA64: revision 1.8 sys/arch/evbmips/conf/MALTA32: revision 1.4 sys/arch/mips/mips/bds_emul.S: revision 1.9 sys/arch/evbmips/conf/MALTA: revision 1.88 Re-enable the NOFPU and (renamed) FPEMUL options. None of the Malta CPU daughter cards currently supported by NetBSD have an FPU. Detected on real hardware. gxemul wrongly supports an FPU on the 4Kc and 5Kc CPUs. Remove the NOFPU option. The main MALTA config file has this now. mips_emul_daddi and mips_emul_daddiu don't exist, but there are bcemul_daddi and bcemul_daddiu here that should be used. however, bcemul_daddi needed to be changed to use dadd not daddui. fixes FPEMUL and N64 kernels. ok simonb. To generate a diff of this commit: cvs rdiff -u -r1.65.2.1 -r1.65.2.2 src/sys/arch/evbmips/conf/MALTA cvs rdiff -u -r1.3 -r1.3.2.1 src/sys/arch/evbmips/conf/MALTA32 cvs rdiff -u -r1.5.2.1 -r1.5.2.2 src/sys/arch/evbmips/conf/MALTA64 cvs rdiff -u -r1.6 -r1.6.2.1 src/sys/arch/mips/mips/bds_emul.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/i386/conf
Module Name:src Committed By: snj Date: Sat Aug 26 16:26:46 UTC 2017 Modified Files: src/sys/arch/i386/conf [netbsd-6]: GENERIC Log Message: Apply patch (requested by maxv in ticket #1466): Disable vm86 by default. The use case is limited, and the potential for damage is too high. To generate a diff of this commit: cvs rdiff -u -r1.1066.2.7 -r1.1066.2.8 src/sys/arch/i386/conf/GENERIC Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/i386/conf
Module Name:src Committed By: snj Date: Sat Aug 26 16:26:46 UTC 2017 Modified Files: src/sys/arch/i386/conf [netbsd-6]: GENERIC Log Message: Apply patch (requested by maxv in ticket #1466): Disable vm86 by default. The use case is limited, and the potential for damage is too high. To generate a diff of this commit: cvs rdiff -u -r1.1066.2.7 -r1.1066.2.8 src/sys/arch/i386/conf/GENERIC 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/i386/conf/GENERIC diff -u src/sys/arch/i386/conf/GENERIC:1.1066.2.7 src/sys/arch/i386/conf/GENERIC:1.1066.2.8 --- src/sys/arch/i386/conf/GENERIC:1.1066.2.7 Wed Aug 15 15:33:00 2012 +++ src/sys/arch/i386/conf/GENERIC Sat Aug 26 16:26:46 2017 @@ -1,4 +1,4 @@ -# $NetBSD: GENERIC,v 1.1066.2.7 2012/08/15 15:33:00 sborrill Exp $ +# $NetBSD: GENERIC,v 1.1066.2.8 2017/08/26 16:26:46 snj Exp $ # # GENERIC machine description file # @@ -22,12 +22,12 @@ include "arch/i386/conf/std.i386" options INCLUDE_CONFIG_FILE # embed config file in kernel binary -#ident "GENERIC-$Revision: 1.1066.2.7 $" +#ident "GENERIC-$Revision: 1.1066.2.8 $" maxusers 64 # estimated number of users # CPU-related options. -options VM86 # virtual 8086 emulation +#options VM86 # virtual 8086 emulation options USER_LDT # user-settable LDT; used by WINE #options PAE # PAE mode (36 bits physical addressing)
CVS commit: [netbsd-6] src/sys/arch/mac68k/nubus
Module Name:src Committed By: snj Date: Sat Aug 12 16:35:11 UTC 2017 Modified Files: src/sys/arch/mac68k/nubus [netbsd-6]: if_netdock_nubus.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1472): sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26 Avoid memory leak in netdock_get. If top is null, this is the first time through and nothing else will free m. >From Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.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/mac68k/nubus/if_netdock_nubus.c diff -u src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21 src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21.14.1 --- src/sys/arch/mac68k/nubus/if_netdock_nubus.c:1.21 Mon Apr 5 07:19:30 2010 +++ src/sys/arch/mac68k/nubus/if_netdock_nubus.c Sat Aug 12 16:35:11 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $ */ +/* $NetBSD: if_netdock_nubus.c,v 1.21.14.1 2017/08/12 16:35:11 snj Exp $ */ /* * Copyright (C) 2000,2002 Daishi Kato@@ -43,7 +43,7 @@ /***/ #include -__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21 2010/04/05 07:19:30 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_netdock_nubus.c,v 1.21.14.1 2017/08/12 16:35:11 snj Exp $"); #include #include @@ -803,6 +803,8 @@ netdock_get(struct netdock_softc *sc, in if ((m->m_flags & M_EXT) == 0) { if (top) m_freem(top); +else + m_freem(m); return (NULL); } len = MCLBYTES;
CVS commit: [netbsd-6] src/sys/arch/mac68k/nubus
Module Name:src Committed By: snj Date: Sat Aug 12 16:35:11 UTC 2017 Modified Files: src/sys/arch/mac68k/nubus [netbsd-6]: if_netdock_nubus.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1472): sys/arch/mac68k/nubus/if_netdock_nubus.c: revision 1.26 Avoid memory leak in netdock_get. If top is null, this is the first time through and nothing else will free m. >From Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.21 -r1.21.14.1 src/sys/arch/mac68k/nubus/if_netdock_nubus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/newsmips/apbus
Module Name:src Committed By: snj Date: Sat Aug 12 16:30:05 UTC 2017 Modified Files: src/sys/arch/newsmips/apbus [netbsd-6]: if_sn.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1471): sys/arch/newsmips/apbus/if_sn.c: revision 1.39 Avoid memory leak in sonic_get. If this is the first time around, top is null and nothing else will free m. >From Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.33.14.1 src/sys/arch/newsmips/apbus/if_sn.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/newsmips/apbus/if_sn.c diff -u src/sys/arch/newsmips/apbus/if_sn.c:1.33 src/sys/arch/newsmips/apbus/if_sn.c:1.33.14.1 --- src/sys/arch/newsmips/apbus/if_sn.c:1.33 Mon Apr 5 07:19:31 2010 +++ src/sys/arch/newsmips/apbus/if_sn.c Sat Aug 12 16:30:05 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $ */ +/* $NetBSD: if_sn.c,v 1.33.14.1 2017/08/12 16:30:05 snj Exp $ */ /* * National Semiconductor DP8393X SONIC Driver @@ -16,7 +16,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33 2010/04/05 07:19:31 joerg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_sn.c,v 1.33.14.1 2017/08/12 16:30:05 snj Exp $"); #include "opt_inet.h" @@ -1093,7 +1093,10 @@ sonic_get(struct sn_softc *sc, void *pkt if (datalen >= MINCLSIZE) { MCLGET(m, M_DONTWAIT); if ((m->m_flags & M_EXT) == 0) { -if (top) m_freem(top); +if (top) + m_freem(top); +else + m_freem(m); return 0; } len = MCLBYTES;
CVS commit: [netbsd-6] src/sys/arch/newsmips/apbus
Module Name:src Committed By: snj Date: Sat Aug 12 16:30:05 UTC 2017 Modified Files: src/sys/arch/newsmips/apbus [netbsd-6]: if_sn.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1471): sys/arch/newsmips/apbus/if_sn.c: revision 1.39 Avoid memory leak in sonic_get. If this is the first time around, top is null and nothing else will free m. >From Ilja Van Sprundel. To generate a diff of this commit: cvs rdiff -u -r1.33 -r1.33.14.1 src/sys/arch/newsmips/apbus/if_sn.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: martin Date: Tue Aug 8 12:00:35 UTC 2017 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: locore.S machdep.c trap.c src/sys/arch/i386/i386 [netbsd-6]: locore.S machdep.c trap.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1464): sys/arch/i386/i386/trap.c: revision 1.288 (patch) sys/arch/i386/i386/machdep.c: revision 1.783 (patch) sys/arch/i386/i386/locore.S: revision 1.146 (patch) sys/arch/amd64/amd64/locore.S: revision 1.122,1.124 (patch) sys/arch/amd64/amd64/machdep.c revision 1.254 (patch) sys/arch/amd64/amd64/trap.c: revision 1.95-1.96 (patch) Remove the osyscall call gate and emulate it. There is a one-instruction race in it that could panic the kernel. Restore the ability to run netbsd 1.0 32-bit executables by checking for the relevant lcall instruction in the trap handler and treating it as a syscall. To generate a diff of this commit: cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.175.2.8 -r1.175.2.9 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.69.2.2 -r1.69.2.3 src/sys/arch/amd64/amd64/trap.c cvs rdiff -u -r1.95.10.3 -r1.95.10.4 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.717.2.7 -r1.717.2.8 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.262.8.1 -r1.262.8.2 src/sys/arch/i386/i386/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/locore.S diff -u src/sys/arch/amd64/amd64/locore.S:1.66.2.1 src/sys/arch/amd64/amd64/locore.S:1.66.2.2 --- src/sys/arch/amd64/amd64/locore.S:1.66.2.1 Fri Apr 20 23:32:14 2012 +++ src/sys/arch/amd64/amd64/locore.S Tue Aug 8 12:00:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.S,v 1.66.2.1 2012/04/20 23:32:14 riz Exp $ */ +/* $NetBSD: locore.S,v 1.66.2.2 2017/08/08 12:00:35 martin Exp $ */ /* * Copyright-o-rama! @@ -1209,26 +1209,6 @@ NENTRY(child_trampoline) .globl _C_LABEL(osyscall_return) /* - * oosyscall() - * - * Old call gate entry for syscall. only needed if we're - * going to support running old i386 NetBSD 1.0 or ibcs2 binaries, etc, - * on NetBSD/amd64. - * The 64bit call gate can't request that arguments be copied from the - * user stack (which the i386 code uses to get a gap for the flags). - * push/pop are :: cycles. - */ -IDTVEC(oosyscall) - /* Set rflags in trap frame. */ - pushq (%rsp) # move user's %eip - pushq 16(%rsp) # and %cs - popq 8(%rsp) - pushfq - popq 16(%rsp) - pushq $7 # size of instruction for restart - jmp osyscall1 - -/* * osyscall() * * Trap gate entry for int $80 syscall, also used by sigreturn. @@ -1240,7 +1220,6 @@ IDTVEC(osyscall) addq $0x10,%rsp #endif pushq $2 # size of instruction for restart -osyscall1: pushq $T_ASTFLT # trap # for doing ASTs INTRENTRY STI(si) Index: src/sys/arch/amd64/amd64/machdep.c diff -u src/sys/arch/amd64/amd64/machdep.c:1.175.2.8 src/sys/arch/amd64/amd64/machdep.c:1.175.2.9 --- src/sys/arch/amd64/amd64/machdep.c:1.175.2.8 Sat Apr 20 09:59:39 2013 +++ src/sys/arch/amd64/amd64/machdep.c Tue Aug 8 12:00:35 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.175.2.8 2013/04/20 09:59:39 bouyer Exp $ */ +/* $NetBSD: machdep.c,v 1.175.2.9 2017/08/08 12:00:35 martin Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2000, 2006, 2007, 2008, 2011 @@ -111,7 +111,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.8 2013/04/20 09:59:39 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.175.2.9 2017/08/08 12:00:35 martin Exp $"); /* #define XENDEBUG_LOW */ @@ -1575,7 +1575,6 @@ typedef void (vector)(void); extern vector IDTVEC(syscall); extern vector IDTVEC(syscall32); extern vector IDTVEC(osyscall); -extern vector IDTVEC(oosyscall); extern vector *IDTVEC(exceptions)[]; static void @@ -1838,10 +1837,7 @@ init_x86_64(paddr_t first_avail) set_mem_segment(GDT_ADDR_MEM(gdtstore, GUDATA_SEL), 0, x86_btop(VM_MAXUSER_ADDRESS) - 1, SDT_MEMRWA, SEL_UPL, 1, 0, 1); - /* make ldt gates and memory segments */ - setgate((struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL), - (oosyscall), 0, SDT_SYS386CGT, SEL_UPL, - GSEL(GCODE_SEL, SEL_KPL)); + /* make ldt memory segments */ *(struct mem_segment_descriptor *)(ldtstore + LUCODE_SEL) = *GDT_ADDR_MEM(gdtstore, GUCODE_SEL); *(struct mem_segment_descriptor *)(ldtstore + LUDATA_SEL) = @@ -1873,16 +1869,6 @@ init_x86_64(paddr_t first_avail) set_mem_segment(ldt_segp, 0, x86_btop(VM_MAXUSER_ADDRESS32) - 1, SDT_MEMRWA, SEL_UPL, 1, 1, 0); - /* - * Other entries. - */ - memcpy((struct gate_descriptor *)(ldtstore + LSOL26CALLS_SEL), - (struct gate_descriptor *)(ldtstore + LSYS5CALLS_SEL), - sizeof (struct gate_descriptor)); - memcpy((struct gate_descriptor *)(ldtstore + LBSDICALLS_SEL), - (struct
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: martin Date: Tue Aug 8 12:00:35 UTC 2017 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: locore.S machdep.c trap.c src/sys/arch/i386/i386 [netbsd-6]: locore.S machdep.c trap.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1464): sys/arch/i386/i386/trap.c: revision 1.288 (patch) sys/arch/i386/i386/machdep.c: revision 1.783 (patch) sys/arch/i386/i386/locore.S: revision 1.146 (patch) sys/arch/amd64/amd64/locore.S: revision 1.122,1.124 (patch) sys/arch/amd64/amd64/machdep.c revision 1.254 (patch) sys/arch/amd64/amd64/trap.c: revision 1.95-1.96 (patch) Remove the osyscall call gate and emulate it. There is a one-instruction race in it that could panic the kernel. Restore the ability to run netbsd 1.0 32-bit executables by checking for the relevant lcall instruction in the trap handler and treating it as a syscall. To generate a diff of this commit: cvs rdiff -u -r1.66.2.1 -r1.66.2.2 src/sys/arch/amd64/amd64/locore.S cvs rdiff -u -r1.175.2.8 -r1.175.2.9 src/sys/arch/amd64/amd64/machdep.c cvs rdiff -u -r1.69.2.2 -r1.69.2.3 src/sys/arch/amd64/amd64/trap.c cvs rdiff -u -r1.95.10.3 -r1.95.10.4 src/sys/arch/i386/i386/locore.S cvs rdiff -u -r1.717.2.7 -r1.717.2.8 src/sys/arch/i386/i386/machdep.c cvs rdiff -u -r1.262.8.1 -r1.262.8.2 src/sys/arch/i386/i386/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/i386/stand/misc
Module Name:src Committed By: snj Date: Sat Jun 3 16:49:29 UTC 2017 Modified Files: src/sys/arch/i386/stand/misc [netbsd-6]: rawr32.exe.uue Log Message: Pull up following revision(s) (requested by martin in ticket #1454): sys/arch/i386/stand/misc/rawr32.exe.uue: revision 1.7 Update to rawrite32 1.0.5 (new signatures to avoid scary windows warnings) To generate a diff of this commit: cvs rdiff -u -r1.4.4.1 -r1.4.4.2 src/sys/arch/i386/stand/misc/rawr32.exe.uue Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/i386/stand/misc
Module Name:src Committed By: snj Date: Sat Jun 3 16:49:29 UTC 2017 Modified Files: src/sys/arch/i386/stand/misc [netbsd-6]: rawr32.exe.uue Log Message: Pull up following revision(s) (requested by martin in ticket #1454): sys/arch/i386/stand/misc/rawr32.exe.uue: revision 1.7 Update to rawrite32 1.0.5 (new signatures to avoid scary windows warnings) To generate a diff of this commit: cvs rdiff -u -r1.4.4.1 -r1.4.4.2 src/sys/arch/i386/stand/misc/rawr32.exe.uue 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: [netbsd-6] src/sys/arch
Module Name:src Committed By: snj Date: Sat Mar 25 17:18:25 UTC 2017 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: trap.c src/sys/arch/i386/i386 [netbsd-6]: trap.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1446): sys/arch/amd64/amd64/trap.c: revision 1.94 sys/arch/i386/i386/trap.c: revision 1.287 Mmh, allow iret to be handled when an #SS fault (T_STKFLT) happens. Even if the sdm is far from being clear, it appears that iret can trigger an #SS fault if %ss points to a writable but non-present segment; in which case the kernel would panic, thinking the fault was internal to it. In particular, userland can create a broken segment in the ldt with USER_LDT, update its %ss with setcontext and trigger the panic. I don't think amd64 is affected since USER_LDT does not exist there, and the changes on tf_ss seem correct - but I'm still adding T_STKFLT for safety. To generate a diff of this commit: cvs rdiff -u -r1.69.2.1 -r1.69.2.2 src/sys/arch/amd64/amd64/trap.c cvs rdiff -u -r1.262 -r1.262.8.1 src/sys/arch/i386/i386/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/trap.c diff -u src/sys/arch/amd64/amd64/trap.c:1.69.2.1 src/sys/arch/amd64/amd64/trap.c:1.69.2.2 --- src/sys/arch/amd64/amd64/trap.c:1.69.2.1 Sun Jun 3 21:45:10 2012 +++ src/sys/arch/amd64/amd64/trap.c Sat Mar 25 17:18:25 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.69.2.1 2012/06/03 21:45:10 jdc Exp $ */ +/* $NetBSD: trap.c,v 1.69.2.2 2017/03/25 17:18:25 snj Exp $ */ /*- * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.69.2.1 2012/06/03 21:45:10 jdc Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.69.2.2 2017/03/25 17:18:25 snj Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -294,6 +294,7 @@ trap(struct trapframe *frame) case T_PROTFLT: case T_SEGNPFLT: case T_ALIGNFLT: + case T_STKFLT: case T_TSSFLT: if (p == NULL) goto we_re_toast; Index: src/sys/arch/i386/i386/trap.c diff -u src/sys/arch/i386/i386/trap.c:1.262 src/sys/arch/i386/i386/trap.c:1.262.8.1 --- src/sys/arch/i386/i386/trap.c:1.262 Wed Sep 7 09:24:55 2011 +++ src/sys/arch/i386/i386/trap.c Sat Mar 25 17:18:25 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: trap.c,v 1.262 2011/09/07 09:24:55 reinoud Exp $ */ +/* $NetBSD: trap.c,v 1.262.8.1 2017/03/25 17:18:25 snj Exp $ */ /*- * Copyright (c) 1998, 2000, 2005, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.262 2011/09/07 09:24:55 reinoud Exp $"); +__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.262.8.1 2017/03/25 17:18:25 snj Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -405,6 +405,7 @@ trap(struct trapframe *frame) #endif case T_SEGNPFLT: case T_ALIGNFLT: + case T_STKFLT: case T_TSSFLT: if (p == NULL) goto we_re_toast;
CVS commit: [netbsd-6] src/sys/arch
Module Name:src Committed By: snj Date: Sat Mar 25 17:18:25 UTC 2017 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: trap.c src/sys/arch/i386/i386 [netbsd-6]: trap.c Log Message: Pull up following revision(s) (requested by maxv in ticket #1446): sys/arch/amd64/amd64/trap.c: revision 1.94 sys/arch/i386/i386/trap.c: revision 1.287 Mmh, allow iret to be handled when an #SS fault (T_STKFLT) happens. Even if the sdm is far from being clear, it appears that iret can trigger an #SS fault if %ss points to a writable but non-present segment; in which case the kernel would panic, thinking the fault was internal to it. In particular, userland can create a broken segment in the ldt with USER_LDT, update its %ss with setcontext and trigger the panic. I don't think amd64 is affected since USER_LDT does not exist there, and the changes on tf_ss seem correct - but I'm still adding T_STKFLT for safety. To generate a diff of this commit: cvs rdiff -u -r1.69.2.1 -r1.69.2.2 src/sys/arch/amd64/amd64/trap.c cvs rdiff -u -r1.262 -r1.262.8.1 src/sys/arch/i386/i386/trap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/x86
Module Name:src Committed By: snj Date: Mon Mar 6 08:18:44 UTC 2017 Modified Files: src/sys/arch/x86/include [netbsd-6]: pmap.h src/sys/arch/x86/x86 [netbsd-6]: pmap.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1441): sys/arch/x86/x86/pmap.c: revision 1.241 via patch sys/arch/x86/include/pmap.h: revision 1.63 via patch Should be PG_k, doesn't change anything. -- Remove PG_u from the kernel pages on Xen. Otherwise there is no privilege separation between the kernel and userland. On Xen-amd64, the kernel runs in ring3 just like userland, and the separation is guaranteed by the hypervisor - each syscall/trap is intercepted by Xen and sent manually to the kernel. Before that, the hypervisor modifies the page tables so that the kernel becomes accessible. Later, when returning to userland, the hypervisor removes the kernel pages and flushes the TLB. However, TLB flushes are costly, and in order to reduce the number of pages flushed Xen marks the userland pages as global, while keeping the kernel ones as local. This way, when returning to userland, only the kernel pages get flushed - which makes sense since they are the only ones that got removed from the mapping. Xen differentiates the userland pages by looking at their PG_u bit in the PTE; if a page has this bit then Xen tags it as global, otherwise Xen manually adds the bit but keeps the page as local. The thing is, since we set PG_u in the kernel pages, Xen believes our kernel pages are in fact userland pages, so it marks them as global. Therefore, when returning to userland, the kernel pages indeed get removed from the page tree, but are not flushed from the TLB. Which means that they are still accessible. With this - and depending on the DTLB size - userland has a small window where it can read/write to the last kernel pages accessed, which is enough to completely escalate privileges: the sysent structure systematically gets read when performing a syscall, and chances are that it will still be cached in the TLB. Userland can then use this to patch a chosen syscall, make it point to a userland function, retrieve %gs and compute the address of its credentials, and finally grant itself root privileges. To generate a diff of this commit: cvs rdiff -u -r1.49.2.2 -r1.49.2.3 src/sys/arch/x86/include/pmap.h cvs rdiff -u -r1.164.2.5 -r1.164.2.6 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/include/pmap.h diff -u src/sys/arch/x86/include/pmap.h:1.49.2.2 src/sys/arch/x86/include/pmap.h:1.49.2.3 --- src/sys/arch/x86/include/pmap.h:1.49.2.2 Wed May 9 03:22:52 2012 +++ src/sys/arch/x86/include/pmap.h Mon Mar 6 08:18:44 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.h,v 1.49.2.2 2012/05/09 03:22:52 riz Exp $ */ +/* $NetBSD: pmap.h,v 1.49.2.3 2017/03/06 08:18:44 snj Exp $ */ /* * Copyright (c) 1997 Charles D. Cranor and Washington University. @@ -182,15 +182,7 @@ struct pmap { ((pmap)->pm_pdirpa[0] + (index) * sizeof(pd_entry_t)) #endif -/* - * flag to be used for kernel mappings: PG_u on Xen/amd64, - * 0 otherwise. - */ -#if defined(XEN) && defined(__x86_64__) -#define PG_k PG_u -#else #define PG_k 0 -#endif /* * MD flags that we use for pmap_enter and pmap_kenter_pa: Index: src/sys/arch/x86/x86/pmap.c diff -u src/sys/arch/x86/x86/pmap.c:1.164.2.5 src/sys/arch/x86/x86/pmap.c:1.164.2.6 --- src/sys/arch/x86/x86/pmap.c:1.164.2.5 Thu Jul 14 07:05:34 2016 +++ src/sys/arch/x86/x86/pmap.c Mon Mar 6 08:18:44 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.164.2.5 2016/07/14 07:05:34 snj Exp $ */ +/* $NetBSD: pmap.c,v 1.164.2.6 2017/03/06 08:18:44 snj Exp $ */ /*- * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164.2.5 2016/07/14 07:05:34 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164.2.6 2017/03/06 08:18:44 snj Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -1467,7 +1467,7 @@ pmap_bootstrap(vaddr_t kva_start) memset((void *) (xen_dummy_user_pgd + KERNBASE), 0, PAGE_SIZE); /* Mark read-only */ HYPERVISOR_update_va_mapping(xen_dummy_user_pgd + KERNBASE, - pmap_pa2pte(xen_dummy_user_pgd) | PG_u | PG_V, UVMF_INVLPG); + pmap_pa2pte(xen_dummy_user_pgd) | PG_k | PG_V, UVMF_INVLPG); /* Pin as L4 */ xpq_queue_pin_l4_table(xpmap_ptom_masked(xen_dummy_user_pgd)); #endif /* __x86_64__ */ @@ -2064,7 +2064,7 @@ pmap_pdp_ctor(void *arg, void *v, int fl * this pdir will NEVER be active in kernel mode * so mark recursive entry invalid */ - pdir[PDIR_SLOT_PTE] = pmap_pa2pte(pdirpa) | PG_u; + pdir[PDIR_SLOT_PTE] = pmap_pa2pte(pdirpa) | PG_k; /* * PDP constructed this way won't be for kernel, * hence we don't put kernel mappings on Xen.
CVS commit: [netbsd-6] src/sys/arch/x86
Module Name:src Committed By: snj Date: Mon Mar 6 08:18:44 UTC 2017 Modified Files: src/sys/arch/x86/include [netbsd-6]: pmap.h src/sys/arch/x86/x86 [netbsd-6]: pmap.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1441): sys/arch/x86/x86/pmap.c: revision 1.241 via patch sys/arch/x86/include/pmap.h: revision 1.63 via patch Should be PG_k, doesn't change anything. -- Remove PG_u from the kernel pages on Xen. Otherwise there is no privilege separation between the kernel and userland. On Xen-amd64, the kernel runs in ring3 just like userland, and the separation is guaranteed by the hypervisor - each syscall/trap is intercepted by Xen and sent manually to the kernel. Before that, the hypervisor modifies the page tables so that the kernel becomes accessible. Later, when returning to userland, the hypervisor removes the kernel pages and flushes the TLB. However, TLB flushes are costly, and in order to reduce the number of pages flushed Xen marks the userland pages as global, while keeping the kernel ones as local. This way, when returning to userland, only the kernel pages get flushed - which makes sense since they are the only ones that got removed from the mapping. Xen differentiates the userland pages by looking at their PG_u bit in the PTE; if a page has this bit then Xen tags it as global, otherwise Xen manually adds the bit but keeps the page as local. The thing is, since we set PG_u in the kernel pages, Xen believes our kernel pages are in fact userland pages, so it marks them as global. Therefore, when returning to userland, the kernel pages indeed get removed from the page tree, but are not flushed from the TLB. Which means that they are still accessible. With this - and depending on the DTLB size - userland has a small window where it can read/write to the last kernel pages accessed, which is enough to completely escalate privileges: the sysent structure systematically gets read when performing a syscall, and chances are that it will still be cached in the TLB. Userland can then use this to patch a chosen syscall, make it point to a userland function, retrieve %gs and compute the address of its credentials, and finally grant itself root privileges. To generate a diff of this commit: cvs rdiff -u -r1.49.2.2 -r1.49.2.3 src/sys/arch/x86/include/pmap.h cvs rdiff -u -r1.164.2.5 -r1.164.2.6 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.
CVS commit: [netbsd-6] src/sys/arch/amd64/amd64
Module Name:src Committed By: snj Date: Sun Feb 5 06:01:05 UTC 2017 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: copy.S Log Message: Apply patch (requested by maxv in ticket #1431): suword: Don't allow 4 bytes to overflow beyond the userland space. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/arch/amd64/amd64/copy.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/copy.S diff -u src/sys/arch/amd64/amd64/copy.S:1.18 src/sys/arch/amd64/amd64/copy.S:1.18.14.1 --- src/sys/arch/amd64/amd64/copy.S:1.18 Wed Jul 7 01:13:29 2010 +++ src/sys/arch/amd64/amd64/copy.S Sun Feb 5 06:01:05 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: copy.S,v 1.18 2010/07/07 01:13:29 chs Exp $ */ +/* $NetBSD: copy.S,v 1.18.14.1 2017/02/05 06:01:05 snj Exp $ */ /* * Copyright (c) 2001 Wasabi Systems, Inc. @@ -413,7 +413,7 @@ ENTRY(fubyte) ENTRY(suword) DEFERRED_SWITCH_CHECK - movq $VM_MAXUSER_ADDRESS-4,%r11 + movq $VM_MAXUSER_ADDRESS-8,%r11 cmpq %r11,%rdi ja _C_LABEL(fusuaddrfault)
CVS commit: [netbsd-6] src/sys/arch/amd64/amd64
Module Name:src Committed By: snj Date: Sun Feb 5 06:01:05 UTC 2017 Modified Files: src/sys/arch/amd64/amd64 [netbsd-6]: copy.S Log Message: Apply patch (requested by maxv in ticket #1431): suword: Don't allow 4 bytes to overflow beyond the userland space. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.14.1 src/sys/arch/amd64/amd64/copy.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/alpha
Module Name:src Committed By: snj Date: Wed Nov 16 18:04:39 UTC 2016 Modified Files: src/sys/arch/alpha/alpha [netbsd-6]: machdep.c prom.c src/sys/arch/alpha/stand/common [netbsd-6]: booted_dev.c prom.c Log Message: Pull up following revision(s) (requested by flxd in ticket #1416): sys/arch/alpha/alpha/machdep.c: revision 1.347 sys/arch/alpha/alpha/prom.c: revision 1.49 sys/arch/alpha/stand/common/booted_dev.c: revision 1.4 sys/arch/alpha/stand/common/prom.c: revision 1.15 Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000. OK skrll@ To generate a diff of this commit: cvs rdiff -u -r1.337.2.1 -r1.337.2.2 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/alpha/alpha/prom.c cvs rdiff -u -r1.3 -r1.3.174.1 src/sys/arch/alpha/stand/common/booted_dev.c cvs rdiff -u -r1.14 -r1.14.18.1 src/sys/arch/alpha/stand/common/prom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/alpha
Module Name:src Committed By: snj Date: Wed Nov 16 18:04:39 UTC 2016 Modified Files: src/sys/arch/alpha/alpha [netbsd-6]: machdep.c prom.c src/sys/arch/alpha/stand/common [netbsd-6]: booted_dev.c prom.c Log Message: Pull up following revision(s) (requested by flxd in ticket #1416): sys/arch/alpha/alpha/machdep.c: revision 1.347 sys/arch/alpha/alpha/prom.c: revision 1.49 sys/arch/alpha/stand/common/booted_dev.c: revision 1.4 sys/arch/alpha/stand/common/prom.c: revision 1.15 Match the two prom_getenv() and fix buffer overflow causing wrong host controller SCSI ID for DEC 3000. OK skrll@ To generate a diff of this commit: cvs rdiff -u -r1.337.2.1 -r1.337.2.2 src/sys/arch/alpha/alpha/machdep.c cvs rdiff -u -r1.48 -r1.48.2.1 src/sys/arch/alpha/alpha/prom.c cvs rdiff -u -r1.3 -r1.3.174.1 src/sys/arch/alpha/stand/common/booted_dev.c cvs rdiff -u -r1.14 -r1.14.18.1 src/sys/arch/alpha/stand/common/prom.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/alpha/alpha/machdep.c diff -u src/sys/arch/alpha/alpha/machdep.c:1.337.2.1 src/sys/arch/alpha/alpha/machdep.c:1.337.2.2 --- src/sys/arch/alpha/alpha/machdep.c:1.337.2.1 Mon May 21 15:25:57 2012 +++ src/sys/arch/alpha/alpha/machdep.c Wed Nov 16 18:04:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: machdep.c,v 1.337.2.1 2012/05/21 15:25:57 riz Exp $ */ +/* $NetBSD: machdep.c,v 1.337.2.2 2016/11/16 18:04:39 snj Exp $ */ /*- * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc. @@ -68,7 +68,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.337.2.1 2012/05/21 15:25:57 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.337.2.2 2016/11/16 18:04:39 snj Exp $"); #include #include @@ -175,7 +175,7 @@ struct bootinfo_kernel bootinfo; /* For built-in TCDS */ #if defined(DEC_3000_300) || defined(DEC_3000_500) -uint8_t dec_3000_scsiid[2], dec_3000_scsifast[2]; +uint8_t dec_3000_scsiid[3], dec_3000_scsifast[3]; #endif struct platform platform; Index: src/sys/arch/alpha/alpha/prom.c diff -u src/sys/arch/alpha/alpha/prom.c:1.48 src/sys/arch/alpha/alpha/prom.c:1.48.2.1 --- src/sys/arch/alpha/alpha/prom.c:1.48 Mon Feb 6 02:14:12 2012 +++ src/sys/arch/alpha/alpha/prom.c Wed Nov 16 18:04:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.48 2012/02/06 02:14:12 matt Exp $ */ +/* $NetBSD: prom.c,v 1.48.2.1 2016/11/16 18:04:39 snj Exp $ */ /* * Copyright (c) 1992, 1994, 1995, 1996 Carnegie Mellon University @@ -27,7 +27,7 @@ #include /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.48 2012/02/06 02:14:12 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: prom.c,v 1.48.2.1 2016/11/16 18:04:39 snj Exp $"); #include "opt_multiprocessor.h" @@ -95,7 +95,7 @@ init_bootstrap_console(void) init_prom_interface(hwrpb); - prom_getenv(PROM_E_TTY_DEV, buf, 4); + prom_getenv(PROM_E_TTY_DEV, buf, sizeof(buf)); alpha_console = buf[0] - '0'; /* XXX fake out the console routines, for now */ @@ -238,14 +238,14 @@ prom_getenv(int id, char *buf, int len) prom_enter(); ret.bits = prom_getenv_disp(id, to, len); - memcpy(buf, to, len); - prom_leave(); - if (ret.u.status & 0x4) ret.u.retval = 0; - buf[ret.u.retval] = '\0'; + len = min(len - 1, ret.u.retval); + memcpy(buf, to, len); + buf[len] = '\0'; + prom_leave(); - return (ret.bits); + return len; } void Index: src/sys/arch/alpha/stand/common/booted_dev.c diff -u src/sys/arch/alpha/stand/common/booted_dev.c:1.3 src/sys/arch/alpha/stand/common/booted_dev.c:1.3.174.1 --- src/sys/arch/alpha/stand/common/booted_dev.c:1.3 Sat Nov 13 21:38:20 1999 +++ src/sys/arch/alpha/stand/common/booted_dev.c Wed Nov 16 18:04:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: booted_dev.c,v 1.3 1999/11/13 21:38:20 thorpej Exp $ */ +/* $NetBSD: booted_dev.c,v 1.3.174.1 2016/11/16 18:04:39 snj Exp $ */ /* * Copyright (c) 1999 Christopher G. Demetriou. All rights reserved. @@ -53,9 +53,8 @@ booted_dev_open(void) * We don't know what device names look like yet, * so we can't change them. */ - ret.bits = prom_getenv(PROM_E_BOOTED_DEV, booted_dev_name, + devlen = prom_getenv(PROM_E_BOOTED_DEV, booted_dev_name, sizeof(booted_dev_name)); - devlen = ret.u.retval; ret.bits = prom_open(booted_dev_name, devlen); Index: src/sys/arch/alpha/stand/common/prom.c diff -u src/sys/arch/alpha/stand/common/prom.c:1.14 src/sys/arch/alpha/stand/common/prom.c:1.14.18.1 --- src/sys/arch/alpha/stand/common/prom.c:1.14 Wed Mar 18 10:22:22 2009 +++ src/sys/arch/alpha/stand/common/prom.c Wed Nov 16 18:04:39 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: prom.c,v 1.14 2009/03/18 10:22:22 cegger Exp $ */ +/* $NetBSD: prom.c,v 1.14.18.1 2016/11/16 18:04:39 snj Exp $ */ /* * Mach Operating System @@ -57,7 +57,7 @@ init_prom_calls(void) prom_dispatch_v.routine = c->crb_v_dispatch->entry_va; /* Look
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:18:43 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1408): sys/arch/sparc64/sparc64/locore.s: revision 1.401 Fix RAS for 32-bit kernels. trapframe is always 64-bit. To generate a diff of this commit: cvs rdiff -u -r1.338.8.7 -r1.338.8.8 src/sys/arch/sparc64/sparc64/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:18:43 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1408): sys/arch/sparc64/sparc64/locore.s: revision 1.401 Fix RAS for 32-bit kernels. trapframe is always 64-bit. To generate a diff of this commit: cvs rdiff -u -r1.338.8.7 -r1.338.8.8 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.7 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.8 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.7 Sun Nov 15 21:02:13 2015 +++ src/sys/arch/sparc64/sparc64/locore.s Sat Sep 24 13:18:43 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.7 2015/11/15 21:02:13 bouyer Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.8 2016/09/24 13:18:43 bouyer Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -5202,12 +5202,12 @@ ENTRY(cpu_switchto) brz,pt %o1, Lsw_noras ! no, skip RAS check LDPTR [%i1 + L_TF], %l3 ! pointer to trap frame call _C_LABEL(ras_lookup) - LDPTR [%l3 + TF_PC], %o1 + ldx [%l3 + TF_PC], %o1 cmp %o0, -1 - be,pt %xcc, Lsw_noras + be,pt CCCR, Lsw_noras add %o0, 4, %o1 - STPTR %o0, [%l3 + TF_PC] ! store rewound %pc - STPTR %o1, [%l3 + TF_NPC] ! and %npc + stx %o0, [%l3 + TF_PC] ! store rewound %pc + stx %o1, [%l3 + TF_NPC] ! and %npc Lsw_noras:
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:06:41 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: kobj_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1405): sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5 sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6 Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c. The target of the OLO10 relocation is the simd13 field of the instruction, so use a 13 bit target mask. Fixes PR kern/51436 (I broke this myself in rev 1.4) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/arch/sparc64/sparc64/kobj_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sat Sep 24 13:06:41 UTC 2016 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: kobj_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1405): sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.5 sys/arch/sparc64/sparc64/kobj_machdep.c: revision 1.6 Follow rev. 1.54, 1.55 of libexec/ld.elf_so/arch/sparc64/mdreloc.c. The target of the OLO10 relocation is the simd13 field of the instruction, so use a 13 bit target mask. Fixes PR kern/51436 (I broke this myself in rev 1.4) To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.14.1 src/sys/arch/sparc64/sparc64/kobj_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/sparc64/sparc64/kobj_machdep.c diff -u src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.4 src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.4.14.1 --- src/sys/arch/sparc64/sparc64/kobj_machdep.c:1.4 Sun May 2 11:43:30 2010 +++ src/sys/arch/sparc64/sparc64/kobj_machdep.c Sat Sep 24 13:06:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: kobj_machdep.c,v 1.4 2010/05/02 11:43:30 martin Exp $ */ +/* $NetBSD: kobj_machdep.c,v 1.4.14.1 2016/09/24 13:06:41 bouyer Exp $ */ /*- * Copyright (c) 2001 Jake Burkholder. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4 2010/05/02 11:43:30 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kobj_machdep.c,v 1.4.14.1 2016/09/24 13:06:41 bouyer Exp $"); #define ELFSIZE ARCH_ELFSIZE @@ -164,15 +164,15 @@ static const long reloc_target_bitmask[] _BM(22), _BM(10), /* _HIPLT22, LOPLT10 */ _BM(32), _BM(22), _BM(10), /* _PCPLT32, _PCPLT22, _PCPLT10 */ _BM(10), _BM(11), -1, /* _10, _11, _64 */ - _BM(10), _BM(22), /* _OLO10, _HH22 */ + _BM(13), _BM(22), /* _OLO10, _HH22 */ _BM(10), _BM(22), /* _HM10, _LM22 */ _BM(22), _BM(10), _BM(22), /* _PC_HH22, _PC_HM10, _PC_LM22 */ _BM(16), _BM(19), /* _WDISP16, _WDISP19 */ -1,/* GLOB_JMP */ - _BM(7), _BM(5), _BM(6) /* _7, _5, _6 */ + _BM(7), _BM(5), _BM(6), /* _7, _5, _6 */ -1, -1,/* DISP64, PLT64 */ _BM(22), _BM(13), /* HIX22, LOX10 */ - _BM(22), _BM(10), _BM(13), /* H44, M44, L44 */ + _BM(22), _BM(10), _BM(12), /* H44, M44, L44 */ -1, -1, _BM(16), /* REGISTER, UA64, UA16 */ #undef _BM };
CVS commit: [netbsd-6] src/sys/arch/i386/stand/misc
Module Name:src Committed By: bouyer Date: Sun Aug 28 10:38:29 UTC 2016 Modified Files: src/sys/arch/i386/stand/misc [netbsd-6]: rawr32.exe.uue Log Message: Pull up following revision(s) (requested by martin in ticket #1385): sys/arch/i386/stand/misc/rawr32.exe.uue: sync to revision 1.6 New Rawrite32 release To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/arch/i386/stand/misc/rawr32.exe.uue Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/i386/stand/misc
Module Name:src Committed By: bouyer Date: Sun Aug 28 10:38:29 UTC 2016 Modified Files: src/sys/arch/i386/stand/misc [netbsd-6]: rawr32.exe.uue Log Message: Pull up following revision(s) (requested by martin in ticket #1385): sys/arch/i386/stand/misc/rawr32.exe.uue: sync to revision 1.6 New Rawrite32 release To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.4.4.1 src/sys/arch/i386/stand/misc/rawr32.exe.uue 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: [netbsd-6] src/sys/arch/evbppc/conf
Module Name:src Committed By: bouyer Date: Sat Aug 27 14:44:11 UTC 2016 Modified Files: src/sys/arch/evbppc/conf [netbsd-6]: Makefile.ev64260.inc Makefile.obs405.inc Makefile.walnut.inc Log Message: Pull up following revision(s) (requested by maya in ticket #1396): sys/arch/evbppc/conf/Makefile.walnut.inc: revision 1.9 sys/arch/evbppc/conf/Makefile.obs405.inc: revision 1.13 sys/arch/evbppc/conf/Makefile.ev64260.inc: revision 1.8 Fix typo in Makefile which resulted in kernel image not being generated >From Rin Okuyama in PR/51369 To generate a diff of this commit: cvs rdiff -u -r1.5.14.1 -r1.5.14.2 \ src/sys/arch/evbppc/conf/Makefile.ev64260.inc cvs rdiff -u -r1.6.14.1 -r1.6.14.2 \ src/sys/arch/evbppc/conf/Makefile.obs405.inc cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/arch/evbppc/conf/Makefile.walnut.inc 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/evbppc/conf/Makefile.ev64260.inc diff -u src/sys/arch/evbppc/conf/Makefile.ev64260.inc:1.5.14.1 src/sys/arch/evbppc/conf/Makefile.ev64260.inc:1.5.14.2 --- src/sys/arch/evbppc/conf/Makefile.ev64260.inc:1.5.14.1 Fri Apr 11 08:31:56 2014 +++ src/sys/arch/evbppc/conf/Makefile.ev64260.inc Sat Aug 27 14:44:10 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.ev64260.inc,v 1.5.14.1 2014/04/11 08:31:56 msaitoh Exp $ +# $NetBSD: Makefile.ev64260.inc,v 1.5.14.2 2016/08/27 14:44:10 bouyer Exp $ MKIMG?= ${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh @@ -9,5 +9,5 @@ SYSTEM_FIRST_SFILE= ${THISPPC}/${BOARDTY SYSTEM_LD_TAIL_EXTRA+=; \ echo ${MKIMG} $@ $@.img ; \ - OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \ + OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \ export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img Index: src/sys/arch/evbppc/conf/Makefile.obs405.inc diff -u src/sys/arch/evbppc/conf/Makefile.obs405.inc:1.6.14.1 src/sys/arch/evbppc/conf/Makefile.obs405.inc:1.6.14.2 --- src/sys/arch/evbppc/conf/Makefile.obs405.inc:1.6.14.1 Fri Apr 11 08:31:56 2014 +++ src/sys/arch/evbppc/conf/Makefile.obs405.inc Sat Aug 27 14:44:10 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.obs405.inc,v 1.6.14.1 2014/04/11 08:31:56 msaitoh Exp $ +# $NetBSD: Makefile.obs405.inc,v 1.6.14.2 2016/08/27 14:44:10 bouyer Exp $ CFLAGS+=-mcpu=405 AFLAGS+=-mcpu=405 @@ -15,7 +15,7 @@ SYSTEM_FIRST_SFILE= ${THISPPC}/obs405/ob SYSTEM_LD_TAIL_EXTRA+=; \ echo ${MKIMG} $@ $@.img ; \ - OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \ + OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \ export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img @@ -30,7 +30,7 @@ SYSTEM_FIRST_SFILE= ${POWERPC}/${PPCDIR} SYSTEM_LD_TAIL_EXTRA+=; \ echo ${MKIMG} $@ $@.img ; \ - OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \ + OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \ export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img Index: src/sys/arch/evbppc/conf/Makefile.walnut.inc diff -u src/sys/arch/evbppc/conf/Makefile.walnut.inc:1.6.2.1 src/sys/arch/evbppc/conf/Makefile.walnut.inc:1.6.2.2 --- src/sys/arch/evbppc/conf/Makefile.walnut.inc:1.6.2.1 Fri Apr 11 08:31:56 2014 +++ src/sys/arch/evbppc/conf/Makefile.walnut.inc Sat Aug 27 14:44:10 2016 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile.walnut.inc,v 1.6.2.1 2014/04/11 08:31:56 msaitoh Exp $ +# $NetBSD: Makefile.walnut.inc,v 1.6.2.2 2016/08/27 14:44:10 bouyer Exp $ MKIMG?= ${HOST_SH} ${THISPPC}/compile/walnut-mkimg.sh CFLAGS+=-mcpu=403 @@ -10,5 +10,5 @@ SYSTEM_FIRST_SFILE= ${THISPPC}/walnut/wa SYSTEM_LD_TAIL_EXTRA_EXTRA+=; \ echo ${MKIMG} $@ $@.img ; \ - OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT]; \ + OBJDUMP=${OBJDUMP}; OBJCOPY=${OBJCOPY}; STAT=${TOOL_STAT}; \ export OBJDUMP OBJCOPY STAT; ${MKIMG} $@ $@.img
CVS commit: [netbsd-6] src/sys/arch/evbppc/conf
Module Name:src Committed By: bouyer Date: Sat Aug 27 14:44:11 UTC 2016 Modified Files: src/sys/arch/evbppc/conf [netbsd-6]: Makefile.ev64260.inc Makefile.obs405.inc Makefile.walnut.inc Log Message: Pull up following revision(s) (requested by maya in ticket #1396): sys/arch/evbppc/conf/Makefile.walnut.inc: revision 1.9 sys/arch/evbppc/conf/Makefile.obs405.inc: revision 1.13 sys/arch/evbppc/conf/Makefile.ev64260.inc: revision 1.8 Fix typo in Makefile which resulted in kernel image not being generated >From Rin Okuyama in PR/51369 To generate a diff of this commit: cvs rdiff -u -r1.5.14.1 -r1.5.14.2 \ src/sys/arch/evbppc/conf/Makefile.ev64260.inc cvs rdiff -u -r1.6.14.1 -r1.6.14.2 \ src/sys/arch/evbppc/conf/Makefile.obs405.inc cvs rdiff -u -r1.6.2.1 -r1.6.2.2 src/sys/arch/evbppc/conf/Makefile.walnut.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/mips/mips
Module Name:src Committed By: bouyer Date: Sat Aug 27 14:34:55 UTC 2016 Modified Files: src/sys/arch/mips/mips [netbsd-6]: pmap.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1390): sys/arch/mips/mips/pmap.c: revision 1.221 sys/arch/mips/mips/pmap.c: revision 1.222 sys/arch/mips/mips/pmap.c: revision 1.223 Fix a bug introduced by me in 1.214 where unmanaged mappings would be affected by calls to pmap_page_protect which is wrong. Now PV_KENTER mappings are left intact. Thanks to chuq for spotting my mistake and reviewing this diff. Thanks to everyone who tested it as well. Fix PR/51288 reproducable panic on evbmips64-eb (erlite) pmap_page_remove from the previous change neglected to terminate the pv list correctly when it started with an initial unmanaged mapping and subsequent managed mappings. Fix this. Fix MIPS3_NO_PV_UNCACHED alias handling by looping through the pv_list looking for bad aliases and removing the bad entries. That is, revert to the code before the matt-mips64 merge. Additionally, fix the pmap_update call to not use the (recently removed/freed) pv for the pmap_t. Fixes the following two PRs PR/49903: Panic during installation on WorkPad Z50 (hpcmips) whilst uncompressing base.tgz PR/51226: Install bug for hpcmips NetBSD V7 using FTP Full installation To generate a diff of this commit: cvs rdiff -u -r1.207.2.3 -r1.207.2.4 src/sys/arch/mips/mips/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/mips/mips/pmap.c diff -u src/sys/arch/mips/mips/pmap.c:1.207.2.3 src/sys/arch/mips/mips/pmap.c:1.207.2.4 --- src/sys/arch/mips/mips/pmap.c:1.207.2.3 Wed Jun 11 15:38:05 2014 +++ src/sys/arch/mips/mips/pmap.c Sat Aug 27 14:34:55 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.207.2.3 2014/06/11 15:38:05 msaitoh Exp $ */ +/* $NetBSD: pmap.c,v 1.207.2.4 2016/08/27 14:34:55 bouyer Exp $ */ /*- * Copyright (c) 1998, 2001 The NetBSD Foundation, Inc. @@ -67,7 +67,7 @@ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.3 2014/06/11 15:38:05 msaitoh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.207.2.4 2016/08/27 14:34:55 bouyer Exp $"); /* * Manages physical address maps. @@ -316,6 +316,7 @@ u_int pmap_page_colormask; (pm) == curlwp->l_proc->p_vmspace->vm_map.pmap) /* Forward function declarations */ +void pmap_page_remove(struct vm_page *); void pmap_remove_pv(pmap_t, vaddr_t, struct vm_page *, bool); void pmap_enter_pv(pmap_t, vaddr_t, struct vm_page *, u_int *, int); pt_entry_t *pmap_pte(pmap_t, vaddr_t); @@ -1063,6 +1064,10 @@ pmap_page_protect(struct vm_page *pg, vm while (pv != NULL) { const pmap_t pmap = pv->pv_pmap; const uint16_t gen = PG_MD_PVLIST_GEN(md); +if (pv->pv_va & PV_KENTER) { + pv = pv->pv_next; + continue; +} va = trunc_page(pv->pv_va); PG_MD_PVLIST_UNLOCK(md); pmap_protect(pmap, va, va + PAGE_SIZE, prot); @@ -1087,17 +1092,7 @@ pmap_page_protect(struct vm_page *pg, vm if (pmap_clear_mdpage_attributes(md, PG_MD_EXECPAGE)) { PMAP_COUNT(exec_uncached_page_protect); } - (void)PG_MD_PVLIST_LOCK(md, false); - pv = >pvh_first; - while (pv->pv_pmap != NULL) { - const pmap_t pmap = pv->pv_pmap; - va = trunc_page(pv->pv_va); - PG_MD_PVLIST_UNLOCK(md); - pmap_remove(pmap, va, va + PAGE_SIZE); - pmap_update(pmap); - (void)PG_MD_PVLIST_LOCK(md, false); - } - PG_MD_PVLIST_UNLOCK(md); + pmap_page_remove(pg); } } @@ -2069,6 +2064,32 @@ pmap_set_modified(paddr_t pa) / pv_entry management / static void +pmap_check_alias(struct vm_page *pg) +{ +#ifdef MIPS3_PLUS /* XXX mmu XXX */ +#ifndef MIPS3_NO_PV_UNCACHED + struct vm_page_md * const md = VM_PAGE_TO_MD(pg); + + if (MIPS_HAS_R4K_MMU && PG_MD_UNCACHED_P(md)) { + /* + * Page is currently uncached, check if alias mapping has been + * removed. If it was, then reenable caching. + */ + pv_entry_t pv = >pvh_first; + pv_entry_t pv0 = pv->pv_next; + + for (; pv0; pv0 = pv0->pv_next) { + if (mips_cache_badalias(pv->pv_va, pv0->pv_va)) +break; + } + if (pv0 == NULL) + pmap_page_cache(pg, true); + } +#endif +#endif /* MIPS3_PLUS */ +} + +static void pmap_check_pvlist(struct vm_page_md *md) { #ifdef PARANOIADIAG @@ -2155,12 +2176,12 @@ again: * be mapped with one index at any given time. */ - if (mips_cache_badalias(pv->pv_va, va)) { -for (npv = pv; npv; npv = npv->pv_next) { - vaddr_t nva = trunc_page(npv->pv_va); - pmap_remove(npv->pv_pmap, nva, - nva + PAGE_SIZE); - pmap_update(npv->pv_pmap); + for (npv = pv; npv; npv = npv->pv_next) { +vaddr_t nva = trunc_page(npv->pv_va); +pmap_t npm = npv->pv_pmap; +if (mips_cache_badalias(nva, va)) { + pmap_remove(npm, nva, nva + PAGE_SIZE); + pmap_update(npm); goto again; } } @@ -2283,6
CVS commit: [netbsd-6] src/sys/arch/mips/mips
Module Name:src Committed By: bouyer Date: Sat Aug 27 14:34:55 UTC 2016 Modified Files: src/sys/arch/mips/mips [netbsd-6]: pmap.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1390): sys/arch/mips/mips/pmap.c: revision 1.221 sys/arch/mips/mips/pmap.c: revision 1.222 sys/arch/mips/mips/pmap.c: revision 1.223 Fix a bug introduced by me in 1.214 where unmanaged mappings would be affected by calls to pmap_page_protect which is wrong. Now PV_KENTER mappings are left intact. Thanks to chuq for spotting my mistake and reviewing this diff. Thanks to everyone who tested it as well. Fix PR/51288 reproducable panic on evbmips64-eb (erlite) pmap_page_remove from the previous change neglected to terminate the pv list correctly when it started with an initial unmanaged mapping and subsequent managed mappings. Fix this. Fix MIPS3_NO_PV_UNCACHED alias handling by looping through the pv_list looking for bad aliases and removing the bad entries. That is, revert to the code before the matt-mips64 merge. Additionally, fix the pmap_update call to not use the (recently removed/freed) pv for the pmap_t. Fixes the following two PRs PR/49903: Panic during installation on WorkPad Z50 (hpcmips) whilst uncompressing base.tgz PR/51226: Install bug for hpcmips NetBSD V7 using FTP Full installation To generate a diff of this commit: cvs rdiff -u -r1.207.2.3 -r1.207.2.4 src/sys/arch/mips/mips/pmap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: snj Date: Thu Jul 14 07:05:34 UTC 2016 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: pmap.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1365): sys/arch/x86/x86/pmap.c: revision 1.190 Operation pmap_pp_clear_attrs() may remove the "used" attribute from a page that is still cached in the TLB of other CPUs. Call pmap_tlb_shootnow() here before enabling preemption to clear the TLB entries on other CPUs. Should prevent tmpfs data corruption under load. Ok: Chuck Silvers To generate a diff of this commit: cvs rdiff -u -r1.164.2.4 -r1.164.2.5 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.164.2.4 src/sys/arch/x86/x86/pmap.c:1.164.2.5 --- src/sys/arch/x86/x86/pmap.c:1.164.2.4 Wed May 9 03:22:53 2012 +++ src/sys/arch/x86/x86/pmap.c Thu Jul 14 07:05:34 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pmap.c,v 1.164.2.4 2012/05/09 03:22:53 riz Exp $ */ +/* $NetBSD: pmap.c,v 1.164.2.5 2016/07/14 07:05:34 snj Exp $ */ /*- * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc. @@ -171,7 +171,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164.2.4 2012/05/09 03:22:53 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164.2.5 2016/07/14 07:05:34 snj Exp $"); #include "opt_user_ldt.h" #include "opt_lockdebug.h" @@ -3717,6 +3717,7 @@ startover: } result = pp->pp_attrs & clearbits; pp->pp_attrs &= ~clearbits; + pmap_tlb_shootnow(); kpreempt_enable(); return result != 0;
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: snj Date: Thu Jul 14 07:05:34 UTC 2016 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: pmap.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1365): sys/arch/x86/x86/pmap.c: revision 1.190 Operation pmap_pp_clear_attrs() may remove the "used" attribute from a page that is still cached in the TLB of other CPUs. Call pmap_tlb_shootnow() here before enabling preemption to clear the TLB entries on other CPUs. Should prevent tmpfs data corruption under load. Ok: Chuck Silvers To generate a diff of this commit: cvs rdiff -u -r1.164.2.4 -r1.164.2.5 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.
CVS commit: [netbsd-6] src/sys/arch/x86
Module Name:src Committed By: snj Date: Thu Jul 14 06:51:03 UTC 2016 Modified Files: src/sys/arch/x86/include [netbsd-6]: cpufunc.h src/sys/arch/x86/x86 [netbsd-6]: errata.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1361): sys/arch/x86/include/cpufunc.h: revision 1.19 sys/arch/x86/x86/errata.c: revision 1.23 Adapt prototypes and usage of rdmsr_locked() and wrmsr_locked() to their implementation. Both functions don't take the passcode as argument. As wrmsr_locked() no longer writes the passcode to the msr the erratum 721 on my Opteron 2356 really gets patched and cc1 no longer crashes with SIGSEGV. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.13.8.1 src/sys/arch/x86/include/cpufunc.h cvs rdiff -u -r1.19.14.1 -r1.19.14.2 src/sys/arch/x86/x86/errata.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/include/cpufunc.h diff -u src/sys/arch/x86/include/cpufunc.h:1.13 src/sys/arch/x86/include/cpufunc.h:1.13.8.1 --- src/sys/arch/x86/include/cpufunc.h:1.13 Sat Sep 24 10:32:52 2011 +++ src/sys/arch/x86/include/cpufunc.h Thu Jul 14 06:51:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.h,v 1.13 2011/09/24 10:32:52 jym Exp $ */ +/* $NetBSD: cpufunc.h,v 1.13.8.1 2016/07/14 06:51:03 snj Exp $ */ /*- * Copyright (c) 1998, 2007 The NetBSD Foundation, Inc. @@ -117,12 +117,12 @@ void x86_reset(void); #define OPTERON_MSR_PASSCODE 0x9c5a203aU uint64_t rdmsr(u_int); -uint64_t rdmsr_locked(u_int, u_int); +uint64_t rdmsr_locked(u_int); int rdmsr_safe(u_int, uint64_t *); uint64_t rdtsc(void); uint64_t rdpmc(u_int); void wrmsr(u_int, uint64_t); -void wrmsr_locked(u_int, u_int, uint64_t); +void wrmsr_locked(u_int, uint64_t); void setfs(int); void setusergs(int); Index: src/sys/arch/x86/x86/errata.c diff -u src/sys/arch/x86/x86/errata.c:1.19.14.1 src/sys/arch/x86/x86/errata.c:1.19.14.2 --- src/sys/arch/x86/x86/errata.c:1.19.14.1 Mon Apr 9 18:02:25 2012 +++ src/sys/arch/x86/x86/errata.c Thu Jul 14 06:51:03 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: errata.c,v 1.19.14.1 2012/04/09 18:02:25 riz Exp $ */ +/* $NetBSD: errata.c,v 1.19.14.2 2016/07/14 06:51:03 snj Exp $ */ /*- * Copyright (c) 2007 The NetBSD Foundation, Inc. @@ -45,7 +45,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.19.14.1 2012/04/09 18:02:25 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: errata.c,v 1.19.14.2 2016/07/14 06:51:03 snj Exp $"); #include #include @@ -294,7 +294,7 @@ x86_errata_testmsr(struct cpu_info *ci, (void)ci; - val = rdmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE); + val = rdmsr_locked(e->e_data1); if ((val & e->e_data2) != 0) return FALSE; @@ -309,10 +309,10 @@ x86_errata_setmsr(struct cpu_info *ci, e (void)ci; - val = rdmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE); + val = rdmsr_locked(e->e_data1); if ((val & e->e_data2) != 0) return FALSE; - wrmsr_locked(e->e_data1, OPTERON_MSR_PASSCODE, val | e->e_data2); + wrmsr_locked(e->e_data1, val | e->e_data2); aprint_debug_dev(ci->ci_dev, "erratum %d patched\n", e->e_num);
CVS commit: [netbsd-6] src/sys/arch/x86
Module Name:src Committed By: snj Date: Thu Jul 14 06:51:03 UTC 2016 Modified Files: src/sys/arch/x86/include [netbsd-6]: cpufunc.h src/sys/arch/x86/x86 [netbsd-6]: errata.c Log Message: Pull up following revision(s) (requested by hannken in ticket #1361): sys/arch/x86/include/cpufunc.h: revision 1.19 sys/arch/x86/x86/errata.c: revision 1.23 Adapt prototypes and usage of rdmsr_locked() and wrmsr_locked() to their implementation. Both functions don't take the passcode as argument. As wrmsr_locked() no longer writes the passcode to the msr the erratum 721 on my Opteron 2356 really gets patched and cc1 no longer crashes with SIGSEGV. To generate a diff of this commit: cvs rdiff -u -r1.13 -r1.13.8.1 src/sys/arch/x86/include/cpufunc.h cvs rdiff -u -r1.19.14.1 -r1.19.14.2 src/sys/arch/x86/x86/errata.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/hppa/include
Module Name:src Committed By: snj Date: Wed Jul 13 08:25:44 UTC 2016 Modified Files: src/sys/arch/hppa/include [netbsd-6]: db_machdep.h Log Message: Pull up following revision(s) (requested by skrll in ticket #1360): sys/arch/hppa/include/db_machdep.h: revision 1.13 PR port-hppa/50642: src/sys/arch/hppa/include/db_machdep.h:118: bad if test ? Correct the test for rfir and add one for rfi while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/hppa/include/db_machdep.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/hppa/include
Module Name:src Committed By: snj Date: Wed Jul 13 08:25:44 UTC 2016 Modified Files: src/sys/arch/hppa/include [netbsd-6]: db_machdep.h Log Message: Pull up following revision(s) (requested by skrll in ticket #1360): sys/arch/hppa/include/db_machdep.h: revision 1.13 PR port-hppa/50642: src/sys/arch/hppa/include/db_machdep.h:118: bad if test ? Correct the test for rfir and add one for rfi while I'm here. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.2.1 src/sys/arch/hppa/include/db_machdep.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/hppa/include/db_machdep.h diff -u src/sys/arch/hppa/include/db_machdep.h:1.12 src/sys/arch/hppa/include/db_machdep.h:1.12.2.1 --- src/sys/arch/hppa/include/db_machdep.h:1.12 Wed Jan 18 09:35:48 2012 +++ src/sys/arch/hppa/include/db_machdep.h Wed Jul 13 08:25:44 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.h,v 1.12 2012/01/18 09:35:48 skrll Exp $ */ +/* $NetBSD: db_machdep.h,v 1.12.2.1 2016/07/13 08:25:44 snj Exp $ */ /* $OpenBSD: db_machdep.h,v 1.5 2001/02/16 19:20:13 mickey Exp $ */ @@ -115,7 +115,8 @@ static __inline int inst_return(u_int in (ins & 0xfc00) == 0xe000; } static __inline int inst_trap_return(u_int ins) { - return (ins & 0xfc001fc0) == 0x0ca0; + return (ins & 0xfc001fe0) == 0x0c00 || + (ins & 0xfc001fe0) == 0x0ca0; } #define db_clear_single_step(r) ((r)->tf_ipsw &= ~PSW_R)
CVS commit: [netbsd-6] src/sys/arch/arm/arm
Module Name:src Committed By: snj Date: Wed Jul 13 08:20:45 UTC 2016 Modified Files: src/sys/arch/arm/arm [netbsd-6]: cpufunc.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1354): sys/arch/arm/arm/cpufunc.c: revision 1.159 PR port-arm/50512: Source code condition impossible Fix condition which broke ARM1136 function selection when ARM1176 support was added To generate a diff of this commit: cvs rdiff -u -r1.104.2.2 -r1.104.2.3 src/sys/arch/arm/arm/cpufunc.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/arm/arm/cpufunc.c diff -u src/sys/arch/arm/arm/cpufunc.c:1.104.2.2 src/sys/arch/arm/arm/cpufunc.c:1.104.2.3 --- src/sys/arch/arm/arm/cpufunc.c:1.104.2.2 Mon Jan 7 16:42:51 2013 +++ src/sys/arch/arm/arm/cpufunc.c Wed Jul 13 08:20:45 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: cpufunc.c,v 1.104.2.2 2013/01/07 16:42:51 riz Exp $ */ +/* $NetBSD: cpufunc.c,v 1.104.2.3 2016/07/13 08:20:45 snj Exp $ */ /* * arm7tdmi support code Copyright (c) 2001 John Fremlin @@ -49,7 +49,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.104.2.2 2013/01/07 16:42:51 riz Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cpufunc.c,v 1.104.2.3 2016/07/13 08:20:45 snj Exp $"); #include "opt_compat_netbsd.h" #include "opt_cpuoptions.h" @@ -1708,7 +1708,7 @@ set_cpufuncs(void) cputype == CPU_ID_ARM1176JZS) { cpufuncs = arm11_cpufuncs; #if defined(CPU_ARM1136) - if (cputype == CPU_ID_ARM1136JS && + if (cputype == CPU_ID_ARM1136JS || cputype == CPU_ID_ARM1136JSR1) { cpufuncs = arm1136_cpufuncs; if (cputype == CPU_ID_ARM1136JS)
CVS commit: [netbsd-6] src/sys/arch/arm/arm
Module Name:src Committed By: snj Date: Wed Jul 13 08:20:45 UTC 2016 Modified Files: src/sys/arch/arm/arm [netbsd-6]: cpufunc.c Log Message: Pull up following revision(s) (requested by skrll in ticket #1354): sys/arch/arm/arm/cpufunc.c: revision 1.159 PR port-arm/50512: Source code condition impossible Fix condition which broke ARM1136 function selection when ARM1176 support was added To generate a diff of this commit: cvs rdiff -u -r1.104.2.2 -r1.104.2.3 src/sys/arch/arm/arm/cpufunc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: martin Date: Wed May 18 08:44:42 UTC 2016 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: oea_machdep.c Log Message: Pull up following revision(s) (requested by matt in ticket #1310): sys/arch/powerpc/include/userret.h: revision 1.29-1.30 sys/arch/powerpc/include/psl.h: revision 1.20 sys/arch/powerpc/oea/oea_machdep.c: revision 1.72 (via patch) Add a check to make sure that if PSL_FP is set, we own the FPU. Don't clear PSL_FP/PSL_VEC Remove PSL_SPV from BOOKE PSL_USERMOD Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext. To generate a diff of this commit: cvs rdiff -u -r1.18.8.3 -r1.18.8.4 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.4 -r1.22.8.5 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.63.2.3 -r1.63.2.4 src/sys/arch/powerpc/oea/oea_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/powerpc/include/psl.h diff -u src/sys/arch/powerpc/include/psl.h:1.18.8.3 src/sys/arch/powerpc/include/psl.h:1.18.8.4 --- src/sys/arch/powerpc/include/psl.h:1.18.8.3 Thu Nov 19 08:50:05 2015 +++ src/sys/arch/powerpc/include/psl.h Wed May 18 08:44:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.18.8.3 2015/11/19 08:50:05 bouyer Exp $ */ +/* $NetBSD: psl.h,v 1.18.8.4 2016/05/18 08:44:41 martin Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -111,7 +111,7 @@ extern register_t cpu_psluserset, cpu_ps #elif defined(PPC_BOOKE) #define PSL_USERSET (PSL_EE | PSL_PR | PSL_IS | PSL_DS | PSL_ME | PSL_CE | PSL_DE) #define PSL_USERMASK (PSL_SPV | PSL_CE | 0x) -#define PSL_USERMOD (PSL_SPV) +#define PSL_USERMOD (0) #else /* PPC_IBM4XX */ #ifdef PPC_IBM403 #define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_ME) Index: src/sys/arch/powerpc/include/userret.h diff -u src/sys/arch/powerpc/include/userret.h:1.22.8.4 src/sys/arch/powerpc/include/userret.h:1.22.8.5 --- src/sys/arch/powerpc/include/userret.h:1.22.8.4 Thu Nov 19 08:50:05 2015 +++ src/sys/arch/powerpc/include/userret.h Wed May 18 08:44:41 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.22.8.4 2015/11/19 08:50:05 bouyer Exp $ */ +/* $NetBSD: userret.h,v 1.22.8.5 2016/05/18 08:44:41 martin Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -58,7 +58,13 @@ userret(struct lwp *l, struct trapframe /* Invoke MI userret code */ mi_userret(l); - tf->tf_srr1 &= PSL_USERSRR1; /* clear SRR1 status bits */ + KASSERTMSG((tf->tf_srr1 & PSL_FP) == 0 + || l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU] == l, + "tf=%p: srr1 (%#lx): PSL_FP set but FPU curlwp %p is not curlwp %p!", + tf, tf->tf_srr1, l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU], l); + + /* clear SRR1 status bits */ + tf->tf_srr1 &= (PSL_USERSRR1|PSL_FP|PSL_VEC); #ifdef ALTIVEC /* Index: src/sys/arch/powerpc/oea/oea_machdep.c diff -u src/sys/arch/powerpc/oea/oea_machdep.c:1.63.2.3 src/sys/arch/powerpc/oea/oea_machdep.c:1.63.2.4 --- src/sys/arch/powerpc/oea/oea_machdep.c:1.63.2.3 Thu Nov 19 08:50:05 2015 +++ src/sys/arch/powerpc/oea/oea_machdep.c Wed May 18 08:44:42 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: oea_machdep.c,v 1.63.2.3 2015/11/19 08:50:05 bouyer Exp $ */ +/* $NetBSD: oea_machdep.c,v 1.63.2.4 2016/05/18 08:44:42 martin Exp $ */ /* * Copyright (C) 2002 Matt Thomas @@ -33,7 +33,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.63.2.3 2015/11/19 08:50:05 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: oea_machdep.c,v 1.63.2.4 2016/05/18 08:44:42 martin Exp $"); #include "opt_ppcarch.h" #include "opt_compat_netbsd.h" @@ -391,19 +391,16 @@ oea_init(void (*handler)(void)) /* * Configure a PSL user mask matching this processor. + * Don't allow to set PSL_FP/PSL_VEC, since that will affect PCU. */ cpu_psluserset = PSL_EE | PSL_PR | PSL_ME | PSL_IR | PSL_DR | PSL_RI; - cpu_pslusermod = PSL_FP | PSL_FE0 | PSL_FE1 | PSL_LE | PSL_SE | PSL_BE; + cpu_pslusermod = PSL_FE0 | PSL_FE1 | PSL_LE | PSL_SE | PSL_BE; #ifdef PPC_OEA601 if (cpuvers == MPC601) { cpu_psluserset &= PSL_601_MASK; cpu_pslusermod &= PSL_601_MASK; } #endif -#ifdef ALTIVEC - if (cpu_altivec) - cpu_pslusermod |= PSL_VEC; -#endif #ifdef PPC_HIGH_VEC cpu_psluserset |= PSL_IP; /* XXX ok? */ #endif
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: martin Date: Wed May 18 08:44:42 UTC 2016 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: oea_machdep.c Log Message: Pull up following revision(s) (requested by matt in ticket #1310): sys/arch/powerpc/include/userret.h: revision 1.29-1.30 sys/arch/powerpc/include/psl.h: revision 1.20 sys/arch/powerpc/oea/oea_machdep.c: revision 1.72 (via patch) Add a check to make sure that if PSL_FP is set, we own the FPU. Don't clear PSL_FP/PSL_VEC Remove PSL_SPV from BOOKE PSL_USERMOD Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext. To generate a diff of this commit: cvs rdiff -u -r1.18.8.3 -r1.18.8.4 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.4 -r1.22.8.5 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.63.2.3 -r1.63.2.4 src/sys/arch/powerpc/oea/oea_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/xen
Module Name:src Committed By: snj Date: Fri Jan 8 21:26:15 UTC 2016 Modified Files: src/sys/arch/xen/include/xen-public/io [netbsd-6]: ring.h src/sys/arch/xen/xen [netbsd-6]: pciback.c xbdback_xenbus.c xennetback_xenbus.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1358): sys/arch/xen/include/xen-public/io/ring.h: revision 1.3 via patch sys/arch/xen/xen/pciback.c: revision 1.10 via patch sys/arch/xen/xen/xbdback_xenbus.c: revision 1.62 via patch sys/arch/xen/xen/xennetback_xenbus.c: revision 1.54 via patch Apply patch from xsa155: make sure that the backend won't read parts of the request again (possibly because of compiler optimisations), by using copies and barrier. >From XSA155: The compiler can emit optimizations in the PV backend drivers which can lead to double fetch vulnerabilities. Specifically the shared memory between the frontend and backend can be fetched twice (during which time the frontend can alter the contents) possibly leading to arbitrary code execution in backend. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/arch/xen/include/xen-public/io/ring.h cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/arch/xen/xen/pciback.c cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/arch/xen/xen/xbdback_xenbus.c cvs rdiff -u -r1.47 -r1.47.8.1 src/sys/arch/xen/xen/xennetback_xenbus.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/xen/include/xen-public/io/ring.h diff -u src/sys/arch/xen/include/xen-public/io/ring.h:1.2 src/sys/arch/xen/include/xen-public/io/ring.h:1.2.2.1 --- src/sys/arch/xen/include/xen-public/io/ring.h:1.2 Wed Dec 7 15:40:15 2011 +++ src/sys/arch/xen/include/xen-public/io/ring.h Fri Jan 8 21:26:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: ring.h,v 1.2 2011/12/07 15:40:15 cegger Exp $ */ +/* $NetBSD: ring.h,v 1.2.2.1 2016/01/08 21:26:15 snj Exp $ */ /** * ring.h * @@ -236,6 +236,20 @@ typedef struct __name##_back_ring __name #define RING_GET_REQUEST(_r, _idx) \ (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].req)) +/* + * Get a local copy of a request. + * + * Use this in preference to RING_GET_REQUEST() so all processing is + * done on a local copy that cannot be modified by the other end. + * + * Note that https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145 may cause this + * to be ineffective where _req is a struct which consists of only bitfields. + */ +#define RING_COPY_REQUEST(_r, _idx, _req) do {\ + /* Use volatile to force the copy into _req. */ \ + *(_req) = *(volatile typeof(_req))RING_GET_REQUEST(_r, _idx); \ +} while (0) + #define RING_GET_RESPONSE(_r, _idx) \ (&((_r)->sring->ring[((_idx) & (RING_SIZE(_r) - 1))].rsp)) Index: src/sys/arch/xen/xen/pciback.c diff -u src/sys/arch/xen/xen/pciback.c:1.7 src/sys/arch/xen/xen/pciback.c:1.7.2.1 --- src/sys/arch/xen/xen/pciback.c:1.7 Thu Feb 2 19:43:01 2012 +++ src/sys/arch/xen/xen/pciback.c Fri Jan 8 21:26:15 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: pciback.c,v 1.7 2012/02/02 19:43:01 tls Exp $ */ +/* $NetBSD: pciback.c,v 1.7.2.1 2016/01/08 21:26:15 snj Exp $ */ /* * Copyright (c) 2009 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.7 2012/02/02 19:43:01 tls Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pciback.c,v 1.7.2.1 2016/01/08 21:26:15 snj Exp $"); #include "opt_xen.h" @@ -188,6 +188,7 @@ struct pb_xenbus_instance { /* communication with the domU */ unsigned int pbx_evtchn; /* our even channel */ struct xen_pci_sharedinfo *pbx_sh_info; +struct xen_pci_op op; grant_handle_t pbx_shinfo_handle; /* to unmap shared page */ }; @@ -712,13 +713,16 @@ pciback_xenbus_evthandler(void * arg) { struct pb_xenbus_instance *pbxi = arg; struct pciback_pci_dev *pbd; - struct xen_pci_op *op = >pbx_sh_info->op; + struct xen_pci_op *op = >op; u_int bus, dev, func; hypervisor_clear_event(pbxi->pbx_evtchn); if (xen_atomic_test_bit(>pbx_sh_info->flags, _XEN_PCIF_active) == 0) return 0; + + memcpy(op, >pbx_sh_info->op, sizeof (struct xen_pci_op)); + __insn_barrier(); if (op->domain != 0) { aprint_error("pciback: domain %d != 0", op->domain); op->err = XEN_PCI_ERR_dev_not_found; @@ -785,6 +789,8 @@ pciback_xenbus_evthandler(void * arg) aprint_error("pciback: unknown cmd %d\n", op->cmd); op->err = XEN_PCI_ERR_not_implemented; } + pbxi->pbx_sh_info->op.value = op->value; + pbxi->pbx_sh_info->op.err = op->err; end: xen_atomic_clear_bit(>pbx_sh_info->flags, _XEN_PCIF_active); hypervisor_notify_via_evtchn(pbxi->pbx_evtchn); Index: src/sys/arch/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.55.2.3
CVS commit: [netbsd-6] src/sys/arch/xen
Module Name:src Committed By: snj Date: Fri Jan 8 21:26:15 UTC 2016 Modified Files: src/sys/arch/xen/include/xen-public/io [netbsd-6]: ring.h src/sys/arch/xen/xen [netbsd-6]: pciback.c xbdback_xenbus.c xennetback_xenbus.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1358): sys/arch/xen/include/xen-public/io/ring.h: revision 1.3 via patch sys/arch/xen/xen/pciback.c: revision 1.10 via patch sys/arch/xen/xen/xbdback_xenbus.c: revision 1.62 via patch sys/arch/xen/xen/xennetback_xenbus.c: revision 1.54 via patch Apply patch from xsa155: make sure that the backend won't read parts of the request again (possibly because of compiler optimisations), by using copies and barrier. >From XSA155: The compiler can emit optimizations in the PV backend drivers which can lead to double fetch vulnerabilities. Specifically the shared memory between the frontend and backend can be fetched twice (during which time the frontend can alter the contents) possibly leading to arbitrary code execution in backend. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.2.2.1 src/sys/arch/xen/include/xen-public/io/ring.h cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/arch/xen/xen/pciback.c cvs rdiff -u -r1.55.2.3 -r1.55.2.4 src/sys/arch/xen/xen/xbdback_xenbus.c cvs rdiff -u -r1.47 -r1.47.8.1 src/sys/arch/xen/xen/xennetback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: bouyer Date: Thu Nov 19 08:50:05 UTC 2015 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c Log Message: Revert ticket 1310 (second try): > sys/arch/powerpc/include/psl.h1.20 > sys/arch/powerpc/include/userret.h1.29, 1.30 > sys/arch/powerpc/oea/altivec.c1.30 > sys/arch/powerpc/oea/oea_machdep.c1.72 > sys/arch/powerpc/powerpc/fpu.c1.36 > > powerpc PCU fixes because it breaks the build: http://releng.netbsd.org/builds/netbsd-6/201511152000Z/ To generate a diff of this commit: cvs rdiff -u -r1.18.8.2 -r1.18.8.3 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.3 -r1.22.8.4 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.25.8.2 -r1.25.8.3 src/sys/arch/powerpc/oea/altivec.c cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sys/arch/powerpc/oea/oea_machdep.c cvs rdiff -u -r1.31.8.2 -r1.31.8.3 src/sys/arch/powerpc/powerpc/fpu.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/powerpc/include/psl.h diff -u src/sys/arch/powerpc/include/psl.h:1.18.8.2 src/sys/arch/powerpc/include/psl.h:1.18.8.3 --- src/sys/arch/powerpc/include/psl.h:1.18.8.2 Mon Nov 16 09:00:01 2015 +++ src/sys/arch/powerpc/include/psl.h Thu Nov 19 08:50:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.18.8.2 2015/11/16 09:00:01 bouyer Exp $ */ +/* $NetBSD: psl.h,v 1.18.8.3 2015/11/19 08:50:05 bouyer Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -102,8 +102,7 @@ #include "opt_ppcarch.h" #endif /* _KERNEL_OPT */ -#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined (PPC_OEA64) \ -|| defined(_MODULE) +#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined(_MODULE) extern register_t cpu_psluserset, cpu_pslusermod, cpu_pslusermask; #define PSL_USERSET cpu_psluserset @@ -112,7 +111,7 @@ extern register_t cpu_psluserset, cpu_ps #elif defined(PPC_BOOKE) #define PSL_USERSET (PSL_EE | PSL_PR | PSL_IS | PSL_DS | PSL_ME | PSL_CE | PSL_DE) #define PSL_USERMASK (PSL_SPV | PSL_CE | 0x) -#define PSL_USERMOD (0) +#define PSL_USERMOD (PSL_SPV) #else /* PPC_IBM4XX */ #ifdef PPC_IBM403 #define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_ME) Index: src/sys/arch/powerpc/include/userret.h diff -u src/sys/arch/powerpc/include/userret.h:1.22.8.3 src/sys/arch/powerpc/include/userret.h:1.22.8.4 --- src/sys/arch/powerpc/include/userret.h:1.22.8.3 Mon Nov 16 09:00:01 2015 +++ src/sys/arch/powerpc/include/userret.h Thu Nov 19 08:50:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.22.8.3 2015/11/16 09:00:01 bouyer Exp $ */ +/* $NetBSD: userret.h,v 1.22.8.4 2015/11/19 08:50:05 bouyer Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -58,16 +58,7 @@ userret(struct lwp *l, struct trapframe /* Invoke MI userret code */ mi_userret(l); - KASSERTMSG((tf->tf_srr1 & PSL_PR) != 0, - "tf=%p: srr1 (%#lx): PSL_PR isn't set!", - tf, tf->tf_srr1); - KASSERTMSG((tf->tf_srr1 & PSL_FP) == 0 - || l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU] == l, - "tf=%p: srr1 (%#lx): PSL_FP set but FPU curlwp %p is not curlwp %p!", - tf, tf->tf_srr1, l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU], l); - - /* clear SRR1 status bits */ - tf->tf_srr1 &= (PSL_USERSRR1|PSL_FP|PSL_VEC); + tf->tf_srr1 &= PSL_USERSRR1; /* clear SRR1 status bits */ #ifdef ALTIVEC /* @@ -79,12 +70,12 @@ userret(struct lwp *l, struct trapframe #endif #ifdef PPC_BOOKE /* - * BookE doesn't have PSL_SE but it does have a debug instruction - * completion exception but it needs PSL_DE to fire. Instead we - * use IAC1/IAC2 to match the next PC. + * BookE doesn't PSL_SE but it does have a debug instruction completion + * exception but it needs PSL_DE to fire. Since we don't want it to + * happen in the kernel, we must disable PSL_DE and let it get + * restored by rfi/rfci. */ if (__predict_false(tf->tf_srr1 & PSL_SE)) { - tf->tf_srr1 &= ~PSL_SE; extern void booke_sstep(struct trapframe *); /* ugly */ booke_sstep(tf); } Index: src/sys/arch/powerpc/oea/altivec.c diff -u src/sys/arch/powerpc/oea/altivec.c:1.25.8.2 src/sys/arch/powerpc/oea/altivec.c:1.25.8.3 --- src/sys/arch/powerpc/oea/altivec.c:1.25.8.2 Mon Nov 16 09:00:01 2015 +++ src/sys/arch/powerpc/oea/altivec.c Thu Nov 19 08:50:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: altivec.c,v 1.25.8.2 2015/11/16 09:00:01 bouyer Exp $ */ +/* $NetBSD: altivec.c,v 1.25.8.3 2015/11/19 08:50:05 bouyer Exp $ */ /* * Copyright (C) 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.2 2015/11/16 09:00:01 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.3 2015/11/19 08:50:05 bouyer Exp $");
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: bouyer Date: Thu Nov 19 08:50:05 UTC 2015 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c Log Message: Revert ticket 1310 (second try): > sys/arch/powerpc/include/psl.h1.20 > sys/arch/powerpc/include/userret.h1.29, 1.30 > sys/arch/powerpc/oea/altivec.c1.30 > sys/arch/powerpc/oea/oea_machdep.c1.72 > sys/arch/powerpc/powerpc/fpu.c1.36 > > powerpc PCU fixes because it breaks the build: http://releng.netbsd.org/builds/netbsd-6/201511152000Z/ To generate a diff of this commit: cvs rdiff -u -r1.18.8.2 -r1.18.8.3 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.3 -r1.22.8.4 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.25.8.2 -r1.25.8.3 src/sys/arch/powerpc/oea/altivec.c cvs rdiff -u -r1.63.2.2 -r1.63.2.3 src/sys/arch/powerpc/oea/oea_machdep.c cvs rdiff -u -r1.31.8.2 -r1.31.8.3 src/sys/arch/powerpc/powerpc/fpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: bouyer Date: Mon Nov 16 09:00:01 UTC 2015 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c Log Message: Revert ticket 1310: > sys/arch/powerpc/include/psl.h1.20 > sys/arch/powerpc/include/userret.h1.29, 1.30 > sys/arch/powerpc/oea/altivec.c1.30 > sys/arch/powerpc/oea/oea_machdep.c1.72 > sys/arch/powerpc/powerpc/fpu.c1.36 > > powerpc PCU fixes because it breaks the build: http://releng.netbsd.org/builds/netbsd-6/201511152000Z/ To generate a diff of this commit: cvs rdiff -u -r1.18.8.1 -r1.18.8.2 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.2 -r1.22.8.3 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.25.8.1 -r1.25.8.2 src/sys/arch/powerpc/oea/altivec.c cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/arch/powerpc/oea/oea_machdep.c cvs rdiff -u -r1.31.8.1 -r1.31.8.2 src/sys/arch/powerpc/powerpc/fpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: bouyer Date: Mon Nov 16 09:00:01 UTC 2015 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c Log Message: Revert ticket 1310: > sys/arch/powerpc/include/psl.h1.20 > sys/arch/powerpc/include/userret.h1.29, 1.30 > sys/arch/powerpc/oea/altivec.c1.30 > sys/arch/powerpc/oea/oea_machdep.c1.72 > sys/arch/powerpc/powerpc/fpu.c1.36 > > powerpc PCU fixes because it breaks the build: http://releng.netbsd.org/builds/netbsd-6/201511152000Z/ To generate a diff of this commit: cvs rdiff -u -r1.18.8.1 -r1.18.8.2 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.2 -r1.22.8.3 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.25.8.1 -r1.25.8.2 src/sys/arch/powerpc/oea/altivec.c cvs rdiff -u -r1.63.2.1 -r1.63.2.2 src/sys/arch/powerpc/oea/oea_machdep.c cvs rdiff -u -r1.31.8.1 -r1.31.8.2 src/sys/arch/powerpc/powerpc/fpu.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/powerpc/include/psl.h diff -u src/sys/arch/powerpc/include/psl.h:1.18.8.1 src/sys/arch/powerpc/include/psl.h:1.18.8.2 --- src/sys/arch/powerpc/include/psl.h:1.18.8.1 Sun Nov 15 16:36:57 2015 +++ src/sys/arch/powerpc/include/psl.h Mon Nov 16 09:00:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.18.8.1 2015/11/15 16:36:57 bouyer Exp $ */ +/* $NetBSD: psl.h,v 1.18.8.2 2015/11/16 09:00:01 bouyer Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -102,7 +102,8 @@ #include "opt_ppcarch.h" #endif /* _KERNEL_OPT */ -#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined(_MODULE) +#if defined(PPC_OEA) || defined (PPC_OEA64_BRIDGE) || defined (PPC_OEA64) \ +|| defined(_MODULE) extern register_t cpu_psluserset, cpu_pslusermod, cpu_pslusermask; #define PSL_USERSET cpu_psluserset Index: src/sys/arch/powerpc/include/userret.h diff -u src/sys/arch/powerpc/include/userret.h:1.22.8.2 src/sys/arch/powerpc/include/userret.h:1.22.8.3 --- src/sys/arch/powerpc/include/userret.h:1.22.8.2 Sun Nov 15 16:36:57 2015 +++ src/sys/arch/powerpc/include/userret.h Mon Nov 16 09:00:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.22.8.2 2015/11/15 16:36:57 bouyer Exp $ */ +/* $NetBSD: userret.h,v 1.22.8.3 2015/11/16 09:00:01 bouyer Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -58,6 +58,14 @@ userret(struct lwp *l, struct trapframe /* Invoke MI userret code */ mi_userret(l); + KASSERTMSG((tf->tf_srr1 & PSL_PR) != 0, + "tf=%p: srr1 (%#lx): PSL_PR isn't set!", + tf, tf->tf_srr1); + KASSERTMSG((tf->tf_srr1 & PSL_FP) == 0 + || l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU] == l, + "tf=%p: srr1 (%#lx): PSL_FP set but FPU curlwp %p is not curlwp %p!", + tf, tf->tf_srr1, l->l_cpu->ci_data.cpu_pcu_curlwp[PCU_FPU], l); + /* clear SRR1 status bits */ tf->tf_srr1 &= (PSL_USERSRR1|PSL_FP|PSL_VEC); @@ -71,12 +79,12 @@ userret(struct lwp *l, struct trapframe #endif #ifdef PPC_BOOKE /* - * BookE doesn't PSL_SE but it does have a debug instruction completion - * exception but it needs PSL_DE to fire. Since we don't want it to - * happen in the kernel, we must disable PSL_DE and let it get - * restored by rfi/rfci. + * BookE doesn't have PSL_SE but it does have a debug instruction + * completion exception but it needs PSL_DE to fire. Instead we + * use IAC1/IAC2 to match the next PC. */ if (__predict_false(tf->tf_srr1 & PSL_SE)) { + tf->tf_srr1 &= ~PSL_SE; extern void booke_sstep(struct trapframe *); /* ugly */ booke_sstep(tf); } Index: src/sys/arch/powerpc/oea/altivec.c diff -u src/sys/arch/powerpc/oea/altivec.c:1.25.8.1 src/sys/arch/powerpc/oea/altivec.c:1.25.8.2 --- src/sys/arch/powerpc/oea/altivec.c:1.25.8.1 Sun Nov 15 16:36:57 2015 +++ src/sys/arch/powerpc/oea/altivec.c Mon Nov 16 09:00:01 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: altivec.c,v 1.25.8.1 2015/11/15 16:36:57 bouyer Exp $ */ +/* $NetBSD: altivec.c,v 1.25.8.2 2015/11/16 09:00:01 bouyer Exp $ */ /* * Copyright (C) 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.1 2015/11/15 16:36:57 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.2 2015/11/16 09:00:01 bouyer Exp $"); #include "opt_multiprocessor.h" @@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: altivec.c,v #include #include -static void vec_state_load(lwp_t *, bool); +static void vec_state_load(lwp_t *, u_int); static void vec_state_save(lwp_t *); static void vec_state_release(lwp_t *); @@ -63,21 +63,21 @@ const pcu_ops_t vec_ops = { bool vec_used_p(lwp_t *l) { - return (l->l_md.md_flags & MDLWP_USEDVEC) != 0; + return pcu_valid_p(_ops); } void vec_mark_used(lwp_t *l) { -
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: bouyer Date: Sun Nov 15 16:36:57 UTC 2015 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c Log Message: Pull up following revision(s) (requested by matt in ticket #1310): sys/arch/powerpc/include/userret.h: revision 1.30 sys/arch/powerpc/powerpc/fpu.c: revision 1.36 sys/arch/powerpc/include/psl.h: revision 1.20 sys/arch/powerpc/include/userret.h: revision 1.29 sys/arch/powerpc/oea/oea_machdep.c: revision 1.72 sys/arch/powerpc/oea/altivec.c: revision 1.30 Add a check to make sure that if PSL_FP is set, we own the FPU. Don't clear PSL_FP/PSL_VEC Don't reload if just re-enabling Don't reload the FPU register if this is just a re-enable. Remove PSL_SPV from BOOKE PSL_USERMOD Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.1 -r1.22.8.2 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/powerpc/oea/altivec.c cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/arch/powerpc/oea/oea_machdep.c cvs rdiff -u -r1.31 -r1.31.8.1 src/sys/arch/powerpc/powerpc/fpu.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/powerpc/include/psl.h diff -u src/sys/arch/powerpc/include/psl.h:1.18 src/sys/arch/powerpc/include/psl.h:1.18.8.1 --- src/sys/arch/powerpc/include/psl.h:1.18 Mon Jun 20 07:23:36 2011 +++ src/sys/arch/powerpc/include/psl.h Sun Nov 15 16:36:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: psl.h,v 1.18 2011/06/20 07:23:36 matt Exp $ */ +/* $NetBSD: psl.h,v 1.18.8.1 2015/11/15 16:36:57 bouyer Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -111,7 +111,7 @@ extern register_t cpu_psluserset, cpu_ps #elif defined(PPC_BOOKE) #define PSL_USERSET (PSL_EE | PSL_PR | PSL_IS | PSL_DS | PSL_ME | PSL_CE | PSL_DE) #define PSL_USERMASK (PSL_SPV | PSL_CE | 0x) -#define PSL_USERMOD (PSL_SPV) +#define PSL_USERMOD (0) #else /* PPC_IBM4XX */ #ifdef PPC_IBM403 #define PSL_USERSET (PSL_EE | PSL_PR | PSL_IR | PSL_DR | PSL_ME) Index: src/sys/arch/powerpc/include/userret.h diff -u src/sys/arch/powerpc/include/userret.h:1.22.8.1 src/sys/arch/powerpc/include/userret.h:1.22.8.2 --- src/sys/arch/powerpc/include/userret.h:1.22.8.1 Wed Jun 13 19:44:11 2012 +++ src/sys/arch/powerpc/include/userret.h Sun Nov 15 16:36:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: userret.h,v 1.22.8.1 2012/06/13 19:44:11 riz Exp $ */ +/* $NetBSD: userret.h,v 1.22.8.2 2015/11/15 16:36:57 bouyer Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -58,7 +58,8 @@ userret(struct lwp *l, struct trapframe /* Invoke MI userret code */ mi_userret(l); - tf->tf_srr1 &= PSL_USERSRR1; /* clear SRR1 status bits */ + /* clear SRR1 status bits */ + tf->tf_srr1 &= (PSL_USERSRR1|PSL_FP|PSL_VEC); #ifdef ALTIVEC /* Index: src/sys/arch/powerpc/oea/altivec.c diff -u src/sys/arch/powerpc/oea/altivec.c:1.25 src/sys/arch/powerpc/oea/altivec.c:1.25.8.1 --- src/sys/arch/powerpc/oea/altivec.c:1.25 Tue Jun 7 01:01:43 2011 +++ src/sys/arch/powerpc/oea/altivec.c Sun Nov 15 16:36:57 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: altivec.c,v 1.25 2011/06/07 01:01:43 matt Exp $ */ +/* $NetBSD: altivec.c,v 1.25.8.1 2015/11/15 16:36:57 bouyer Exp $ */ /* * Copyright (C) 1996 Wolfgang Solfrank. @@ -32,7 +32,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25 2011/06/07 01:01:43 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: altivec.c,v 1.25.8.1 2015/11/15 16:36:57 bouyer Exp $"); #include "opt_multiprocessor.h" @@ -82,18 +82,26 @@ vec_state_load(lwp_t *l, bool used) vec_mark_used(l); } - /* - * Enable AltiVec temporarily (and disable interrupts). - */ - const register_t msr = mfmsr(); - mtmsr((msr & ~PSL_EE) | PSL_VEC); - __asm volatile ("isync"); - - /* - * Load the vector unit from vreg which is best done in - * assembly. - */ - vec_load_from_vreg(>pcb_vr); + if ((flags & PCU_REENABLE) == 0) { + /* + * Enable AltiVec temporarily (and disable interrupts). + */ + const register_t msr = mfmsr(); + mtmsr((msr & ~PSL_EE) | PSL_VEC); + __asm volatile ("isync"); + + /* + * Load the vector unit from vreg which is best done in + * assembly. + */ + vec_load_from_vreg(>pcb_vr); + + /* + * Restore MSR (turn off AltiVec) + */ + mtmsr(msr); + __asm volatile ("isync"); + } /* * VRSAVE will be restored when trap frame returns @@ -101,12 +109,6 @@ vec_state_load(lwp_t *l, bool used) l->l_md.md_utf->tf_vrsave = pcb->pcb_vr.vrsave; /* - * Restore MSR (turn off AltiVec) - */ - mtmsr(msr); - __asm volatile ("isync"); - - /* * Mark vector registers as modified. */ l->l_md.md_flags |= MDLWP_USEDVEC|PSL_VEC; Index:
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sun Nov 15 20:52:03 UTC 2015 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: bus_dma.c Log Message: Pull up following revision(s) (requested by christos in ticket #1339): sys/arch/x86/x86/bus_dma.c: revision 1.72 sys/arch/x86/x86/bus_dma.c: revision 1.73 sys/arch/x86/x86/bus_dma.c: revision 1.74 - If we succeeded allocating a buffer that did not need bouncing before, but the buffer in the previous mapping did, clear the bounce bit. Fixes the ld_virtio.c bug with machines 8GB and dd if=/dev/zero of=crash bs=1g count=4. - Allocate with M_ZERO instead of doing memset - The panic string can take a format, use it. - When checking for the bounce buffer boundary check addr + len < limit, not addr < limit. make sure we have a cookie before we try to clear it. fix operator precedence. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.8.1 src/sys/arch/x86/x86/bus_dma.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/bus_dma.c diff -u src/sys/arch/x86/x86/bus_dma.c:1.68 src/sys/arch/x86/x86/bus_dma.c:1.68.8.1 --- src/sys/arch/x86/x86/bus_dma.c:1.68 Fri Oct 14 18:28:04 2011 +++ src/sys/arch/x86/x86/bus_dma.c Sun Nov 15 20:52:03 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.68 2011/10/14 18:28:04 bouyer Exp $ */ +/* $NetBSD: bus_dma.c,v 1.68.8.1 2015/11/15 20:52:03 bouyer Exp $ */ /*- * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.68 2011/10/14 18:28:04 bouyer Exp $"); +__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.68.8.1 2015/11/15 20:52:03 bouyer Exp $"); /* * The following is included because _bus_dma_uiomove is derived from @@ -283,11 +283,10 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_ error = 0; mapsize = sizeof(struct x86_bus_dmamap) + (sizeof(bus_dma_segment_t) * (nsegments - 1)); - if ((mapstore = malloc(mapsize, M_DMAMAP, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) + if ((mapstore = malloc(mapsize, M_DMAMAP, M_ZERO | + ((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK))) == NULL) return (ENOMEM); - memset(mapstore, 0, mapsize); map = (struct x86_bus_dmamap *)mapstore; map->_dm_size = size; map->_dm_segcnt = nsegments; @@ -323,12 +322,11 @@ _bus_dmamap_create(bus_dma_tag_t t, bus_ /* * Allocate our cookie. */ - if ((cookiestore = malloc(cookiesize, M_DMAMAP, - (flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL) { + if ((cookiestore = malloc(cookiesize, M_DMAMAP, M_ZERO | + ((flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK))) == NULL) { error = ENOMEM; goto out; } - memset(cookiestore, 0, cookiesize); cookie = (struct x86_bus_dma_cookie *)cookiestore; cookie->id_flags = cookieflags; map->_dm_cookie = cookie; @@ -391,6 +389,8 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm } error = _bus_dmamap_load_buffer(t, map, buf, buflen, vm, flags); if (error == 0) { + if (cookie != NULL) + cookie->id_flags &= ~X86_DMA_IS_BOUNCING; map->dm_mapsize = buflen; return 0; } @@ -789,7 +789,7 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm */ if ((ops & (BUS_DMASYNC_PREREAD|BUS_DMASYNC_PREWRITE)) != 0 && (ops & (BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE)) != 0) - panic("_bus_dmamap_sync: mix PRE and POST"); + panic("%s: mix PRE and POST", __func__); #ifdef DIAGNOSTIC if ((ops & (BUS_DMASYNC_PREWRITE|BUS_DMASYNC_POSTREAD)) != 0) { @@ -916,16 +916,17 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm } case X86_DMA_BUFTYPE_RAW: - panic("_bus_dmamap_sync: X86_DMA_BUFTYPE_RAW"); + panic("%s: X86_DMA_BUFTYPE_RAW", __func__); break; case X86_DMA_BUFTYPE_INVALID: - panic("_bus_dmamap_sync: X86_DMA_BUFTYPE_INVALID"); + panic("%s: X86_DMA_BUFTYPE_INVALID", __func__); break; default: - printf("unknown buffer type %d\n", cookie->id_buftype); - panic("_bus_dmamap_sync"); + panic("%s: unknown buffer type %d", __func__, + cookie->id_buftype); + break; } end: if (ops & (BUS_DMASYNC_PREWRITE|BUS_DMASYNC_POSTWRITE)) { @@ -1233,19 +1234,20 @@ _bus_dmamap_load_buffer(bus_dma_tag_t t, curaddr = _BUS_VIRT_TO_BUS(pmap, vaddr); /* + * Compute the segment size, and adjust counts. + */ + sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET); + if (buflen < sgsize) + sgsize = buflen; + + /* * If we're beyond the bounce threshold, notify * the caller. */ if (map->_dm_bounce_thresh != 0 && - curaddr >= map->_dm_bounce_thresh) + curaddr + sgsize >= map->_dm_bounce_thresh) return (EINVAL); - /* - * Compute the segment size, and adjust counts. - */ - sgsize = PAGE_SIZE - ((u_long)vaddr & PGOFSET); - if (buflen < sgsize) - sgsize = buflen; error = _bus_dmamap_load_busaddr(t, map, curaddr, sgsize); if (error)
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sun Nov 15 20:52:03 UTC 2015 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: bus_dma.c Log Message: Pull up following revision(s) (requested by christos in ticket #1339): sys/arch/x86/x86/bus_dma.c: revision 1.72 sys/arch/x86/x86/bus_dma.c: revision 1.73 sys/arch/x86/x86/bus_dma.c: revision 1.74 - If we succeeded allocating a buffer that did not need bouncing before, but the buffer in the previous mapping did, clear the bounce bit. Fixes the ld_virtio.c bug with machines 8GB and dd if=/dev/zero of=crash bs=1g count=4. - Allocate with M_ZERO instead of doing memset - The panic string can take a format, use it. - When checking for the bounce buffer boundary check addr + len < limit, not addr < limit. make sure we have a cookie before we try to clear it. fix operator precedence. To generate a diff of this commit: cvs rdiff -u -r1.68 -r1.68.8.1 src/sys/arch/x86/x86/bus_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sun Nov 15 20:57:03 UTC 2015 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: sys_machdep.c Log Message: Pull up following revision(s) (requested by christos in ticket #1341): sys/arch/x86/x86/sys_machdep.c: revision 1.29 fix broken error handling; error was used uninitialized. Changing the compilation flags broke all threaded programs for me. XXX: pullup-7 To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/x86/x86/sys_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/x86/x86/sys_machdep.c diff -u src/sys/arch/x86/x86/sys_machdep.c:1.25 src/sys/arch/x86/x86/sys_machdep.c:1.25.8.1 --- src/sys/arch/x86/x86/sys_machdep.c:1.25 Mon Oct 10 15:15:28 2011 +++ src/sys/arch/x86/x86/sys_machdep.c Sun Nov 15 20:57:03 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_machdep.c,v 1.25 2011/10/10 15:15:28 jakllsch Exp $ */ +/* $NetBSD: sys_machdep.c,v 1.25.8.1 2015/11/15 20:57:03 bouyer Exp $ */ /*- * Copyright (c) 1998, 2007, 2009 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.25 2011/10/10 15:15:28 jakllsch Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_machdep.c,v 1.25.8.1 2015/11/15 20:57:03 bouyer Exp $"); #include "opt_mtrr.h" #include "opt_perfctrs.h" @@ -657,7 +657,6 @@ x86_set_sdbase(void *arg, char which, lw #else struct pcb *pcb; vaddr_t base; - int error; if (l->l_proc->p_flag & PK_32) { return x86_set_sdbase32(arg, which, l, direct); @@ -666,7 +665,7 @@ x86_set_sdbase(void *arg, char which, lw if (direct) { base = (vaddr_t)arg; } else { - error = copyin(arg, , sizeof(base)); + int error = copyin(arg, , sizeof(base)); if (error != 0) return error; } @@ -674,10 +673,6 @@ x86_set_sdbase(void *arg, char which, lw if (base >= VM_MAXUSER_ADDRESS) return EINVAL; - if (error) { - return error; - } - pcb = lwp_getpcb(l); kpreempt_disable(); @@ -697,7 +692,7 @@ x86_set_sdbase(void *arg, char which, lw } kpreempt_enable(); - return error; + return 0; #endif }
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: bouyer Date: Sun Nov 15 20:57:03 UTC 2015 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: sys_machdep.c Log Message: Pull up following revision(s) (requested by christos in ticket #1341): sys/arch/x86/x86/sys_machdep.c: revision 1.29 fix broken error handling; error was used uninitialized. Changing the compilation flags broke all threaded programs for me. XXX: pullup-7 To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/x86/x86/sys_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sun Nov 15 21:02:13 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s netbsd32_machdep.c vm_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1343): sys/arch/sparc64/sparc64/locore.s: revision 1.386 sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106 Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c: Remove special case handling for userland lwps from cpu_lwp_fork, instead do it in lwp_trampoline when we first return to userland. which was a stupid idea - since we did now set all fork child's %tstate (and thus %pstate when back in userland) to the current kernel's userland default. This meant we lost the address mask bit for 32bit processes and all memory model details for 64bit ones. Move it back to cpu_lwp_fork and fix the condition to only do it once when forking init. Fix kmem_free() size mismatch Convert siginfo to 32bit version before copying it out to 32bit userland. To generate a diff of this commit: cvs rdiff -u -r1.338.8.6 -r1.338.8.7 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.96.2.1 -r1.96.2.2 \ src/sys/arch/sparc64/sparc64/netbsd32_machdep.c cvs rdiff -u -r1.98 -r1.98.8.1 src/sys/arch/sparc64/sparc64/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: bouyer Date: Sun Nov 15 21:02:13 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s netbsd32_machdep.c vm_machdep.c Log Message: Pull up following revision(s) (requested by martin in ticket #1343): sys/arch/sparc64/sparc64/locore.s: revision 1.386 sys/arch/sparc64/sparc64/vm_machdep.c: revision 1.101 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.105 sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.106 Basically revert r1.246 of locore.s and r1.73 of vm_machdep.c: Remove special case handling for userland lwps from cpu_lwp_fork, instead do it in lwp_trampoline when we first return to userland. which was a stupid idea - since we did now set all fork child's %tstate (and thus %pstate when back in userland) to the current kernel's userland default. This meant we lost the address mask bit for 32bit processes and all memory model details for 64bit ones. Move it back to cpu_lwp_fork and fix the condition to only do it once when forking init. Fix kmem_free() size mismatch Convert siginfo to 32bit version before copying it out to 32bit userland. To generate a diff of this commit: cvs rdiff -u -r1.338.8.6 -r1.338.8.7 src/sys/arch/sparc64/sparc64/locore.s cvs rdiff -u -r1.96.2.1 -r1.96.2.2 \ src/sys/arch/sparc64/sparc64/netbsd32_machdep.c cvs rdiff -u -r1.98 -r1.98.8.1 src/sys/arch/sparc64/sparc64/vm_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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.6 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.7 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.6 Tue Mar 24 08:51:14 2015 +++ src/sys/arch/sparc64/sparc64/locore.s Sun Nov 15 21:02:13 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.6 2015/03/24 08:51:14 snj Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.7 2015/11/15 21:02:13 bouyer Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -5368,12 +5368,6 @@ ENTRY(lwp_trampoline) mov %l1, %o0 /* - * Going to userland - set proper tstate in trap frame - */ - set (ASI_PRIMARY_NO_FAULT<ksi_signo; ucontext32_t uc; struct sparc32_sigframe_siginfo *fp; + siginfo32_t si32; netbsd32_intptr_t catcher; struct trapframe64 *tf = l->l_md.md_tf; struct rwindow32 *oldsp, *newsp; @@ -342,15 +343,16 @@ netbsd32_sendsig_siginfo(const ksiginfo_ else fp = (struct sparc32_sigframe_siginfo *)oldsp; fp = (struct sparc32_sigframe_siginfo*)((u_long)(fp - 1) & ~7); + /* * Build the signal context to be used by sigreturn. */ + memset(, 0, sizeof uc); uc.uc_flags = _UC_SIGMASK | ((l->l_sigstk.ss_flags & SS_ONSTACK) ? _UC_SETSTACK : _UC_CLRSTACK); uc.uc_sigmask = *mask; uc.uc_link = (uint32_t)(uintptr_t)l->l_ctxlink; - memset(_stack, 0, sizeof(uc.uc_stack)); sendsig_reset(l, sig); @@ -365,9 +367,10 @@ netbsd32_sendsig_siginfo(const ksiginfo_ */ mutex_exit(p->p_lock); cpu_getmcontext32(l, _mcontext, _flags); + netbsd32_si_to_si32(, (const siginfo_t *)>ksi_info); ucsz = (int)(intptr_t)__uc_pad - (int)(intptr_t) newsp = (struct rwindow32*)((intptr_t)fp - sizeof(struct frame32)); - error = (copyout(>ksi_info, >sf_si, sizeof ksi->ksi_info) || + error = (copyout(, >sf_si, sizeof si32) || copyout(, >sf_uc, ucsz) || suword(>rw_in[6], (intptr_t)oldsp)); mutex_enter(p->p_lock); @@ -1367,7 +1370,8 @@ startlwp32(void *arg) error = cpu_setmcontext32(l, >uc_mcontext, uc->uc_flags); KASSERT(error == 0); - kmem_free(uc, sizeof(ucontext32_t)); + /* Note: we are freeing ucontext_t, not ucontext32_t. */ + kmem_free(arg, sizeof(ucontext_t)); userret(l, 0, 0); } Index: src/sys/arch/sparc64/sparc64/vm_machdep.c diff -u
CVS commit: [netbsd-6] src/sys/arch/xen/xen
Module Name:src Committed By: msaitoh Date: Mon Nov 16 07:51:13 UTC 2015 Modified Files: src/sys/arch/xen/xen [netbsd-6]: xbdback_xenbus.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1347): sys/arch/xen/xen/xbdback_xenbus.c: revision 1.61 Fix typo which caused the kenrel thread to be created with a 0 priority. This would cause the thread to be almost never scheduled when a userland process could use all CPU. Should fix the problem reported by Torbj?rn Granlund on port-xen@ To generate a diff of this commit: cvs rdiff -u -r1.55.2.2 -r1.55.2.3 src/sys/arch/xen/xen/xbdback_xenbus.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/xen/xen/xbdback_xenbus.c diff -u src/sys/arch/xen/xen/xbdback_xenbus.c:1.55.2.2 src/sys/arch/xen/xen/xbdback_xenbus.c:1.55.2.3 --- src/sys/arch/xen/xen/xbdback_xenbus.c:1.55.2.2 Thu Nov 7 20:16:48 2013 +++ src/sys/arch/xen/xen/xbdback_xenbus.c Mon Nov 16 07:51:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: xbdback_xenbus.c,v 1.55.2.2 2013/11/07 20:16:48 snj Exp $ */ +/* $NetBSD: xbdback_xenbus.c,v 1.55.2.3 2015/11/16 07:51:12 msaitoh Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.55.2.2 2013/11/07 20:16:48 snj Exp $"); +__KERNEL_RCSID(0, "$NetBSD: xbdback_xenbus.c,v 1.55.2.3 2015/11/16 07:51:12 msaitoh Exp $"); #include #include @@ -648,7 +648,7 @@ xbdback_connect(struct xbdback_instance hypervisor_enable_event(xbdi->xbdi_evtchn); hypervisor_notify_via_evtchn(xbdi->xbdi_evtchn); - if (kthread_create(IPL_NONE, KTHREAD_MPSAFE, NULL, + if (kthread_create(PRI_NONE, KTHREAD_MPSAFE, NULL, xbdback_thread, xbdi, NULL, "%s", xbdi->xbdi_name) == 0) return 0;
CVS commit: [netbsd-6] src/sys/arch/xen/xen
Module Name:src Committed By: msaitoh Date: Mon Nov 16 07:51:13 UTC 2015 Modified Files: src/sys/arch/xen/xen [netbsd-6]: xbdback_xenbus.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1347): sys/arch/xen/xen/xbdback_xenbus.c: revision 1.61 Fix typo which caused the kenrel thread to be created with a 0 priority. This would cause the thread to be almost never scheduled when a userland process could use all CPU. Should fix the problem reported by Torbj?rn Granlund on port-xen@ To generate a diff of this commit: cvs rdiff -u -r1.55.2.2 -r1.55.2.3 src/sys/arch/xen/xen/xbdback_xenbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/powerpc
Module Name:src Committed By: bouyer Date: Sun Nov 15 16:36:57 UTC 2015 Modified Files: src/sys/arch/powerpc/include [netbsd-6]: psl.h userret.h src/sys/arch/powerpc/oea [netbsd-6]: altivec.c oea_machdep.c src/sys/arch/powerpc/powerpc [netbsd-6]: fpu.c Log Message: Pull up following revision(s) (requested by matt in ticket #1310): sys/arch/powerpc/include/userret.h: revision 1.30 sys/arch/powerpc/powerpc/fpu.c: revision 1.36 sys/arch/powerpc/include/psl.h: revision 1.20 sys/arch/powerpc/include/userret.h: revision 1.29 sys/arch/powerpc/oea/oea_machdep.c: revision 1.72 sys/arch/powerpc/oea/altivec.c: revision 1.30 Add a check to make sure that if PSL_FP is set, we own the FPU. Don't clear PSL_FP/PSL_VEC Don't reload if just re-enabling Don't reload the FPU register if this is just a re-enable. Remove PSL_SPV from BOOKE PSL_USERMOD Don't preserve PSL_FP/PSL_VEC in cpu_setmcontext. To generate a diff of this commit: cvs rdiff -u -r1.18 -r1.18.8.1 src/sys/arch/powerpc/include/psl.h cvs rdiff -u -r1.22.8.1 -r1.22.8.2 src/sys/arch/powerpc/include/userret.h cvs rdiff -u -r1.25 -r1.25.8.1 src/sys/arch/powerpc/oea/altivec.c cvs rdiff -u -r1.63 -r1.63.2.1 src/sys/arch/powerpc/oea/oea_machdep.c cvs rdiff -u -r1.31 -r1.31.8.1 src/sys/arch/powerpc/powerpc/fpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/vax/vsa
Module Name:src Committed By: snj Date: Fri Jun 19 17:23:12 UTC 2015 Modified Files: src/sys/arch/vax/vsa [netbsd-6]: vsbus.c Log Message: Pull up following revision(s) (requested by abs in ticket #1303): sys/arch/vax/vsa/vsbus.c: revision 1.61 Add missing break - from Felix Deichmann in PR port-vax/49935 To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.14.1 src/sys/arch/vax/vsa/vsbus.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/vax/vsa/vsbus.c diff -u src/sys/arch/vax/vsa/vsbus.c:1.59 src/sys/arch/vax/vsa/vsbus.c:1.59.14.1 --- src/sys/arch/vax/vsa/vsbus.c:1.59 Tue Dec 14 23:31:17 2010 +++ src/sys/arch/vax/vsa/vsbus.c Fri Jun 19 17:23:12 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: vsbus.c,v 1.59 2010/12/14 23:31:17 matt Exp $ */ +/* $NetBSD: vsbus.c,v 1.59.14.1 2015/06/19 17:23:12 snj Exp $ */ /* * Copyright (c) 1996, 1999 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -33,7 +33,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: vsbus.c,v 1.59 2010/12/14 23:31:17 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: vsbus.c,v 1.59.14.1 2015/06/19 17:23:12 snj Exp $); #include opt_cputype.h @@ -138,6 +138,7 @@ vsbus_attach(device_t parent, device_t s sc-sc_intclr = (char *)sc-sc_vsregs + 15; sc-sc_intmsk = (char *)sc-sc_vsregs + 12; vsbus_dma_init(sc, 32768); + break; #endif default:
CVS commit: [netbsd-6] src/sys/arch/vax/vsa
Module Name:src Committed By: snj Date: Fri Jun 19 17:23:12 UTC 2015 Modified Files: src/sys/arch/vax/vsa [netbsd-6]: vsbus.c Log Message: Pull up following revision(s) (requested by abs in ticket #1303): sys/arch/vax/vsa/vsbus.c: revision 1.61 Add missing break - from Felix Deichmann in PR port-vax/49935 To generate a diff of this commit: cvs rdiff -u -r1.59 -r1.59.14.1 src/sys/arch/vax/vsa/vsbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/xen/xen
Module Name:src Committed By: msaitoh Date: Wed May 27 05:54:44 UTC 2015 Modified Files: src/sys/arch/xen/xen [netbsd-6]: xenevt.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1299): sys/arch/xen/xen/xenevt.c: revision 1.42 Fix off by one error, pointed out by Wei Liu in port-xen/49919 To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/xen/xen/xenevt.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/xen/xen/xenevt.c diff -u src/sys/arch/xen/xen/xenevt.c:1.39 src/sys/arch/xen/xen/xenevt.c:1.39.4.1 --- src/sys/arch/xen/xen/xenevt.c:1.39 Sat Dec 3 22:41:40 2011 +++ src/sys/arch/xen/xen/xenevt.c Wed May 27 05:54:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: xenevt.c,v 1.39 2011/12/03 22:41:40 bouyer Exp $ */ +/* $NetBSD: xenevt.c,v 1.39.4.1 2015/05/27 05:54:44 msaitoh Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.39 2011/12/03 22:41:40 bouyer Exp $); +__KERNEL_RCSID(0, $NetBSD: xenevt.c,v 1.39.4.1 2015/05/27 05:54:44 msaitoh Exp $); #include opt_xen.h #include sys/param.h @@ -479,7 +479,7 @@ xenevt_fwrite(struct file *fp, off_t *of if (uio-uio_resid == 0) return (0); nentries = uio-uio_resid / sizeof(uint16_t); - if (nentries NR_EVENT_CHANNELS) + if (nentries = NR_EVENT_CHANNELS) return EMSGSIZE; chans = kmem_alloc(nentries * sizeof(uint16_t), KM_SLEEP); if (chans == NULL) @@ -572,7 +572,7 @@ xenevt_fioctl(struct file *fp, u_long cm { struct ioctl_evtchn_unbind *unbind = addr; - if (unbind-port NR_EVENT_CHANNELS) + if (unbind-port = NR_EVENT_CHANNELS) return EINVAL; mutex_enter(devevent_lock); if (devevent[unbind-port] != d) { @@ -593,7 +593,7 @@ xenevt_fioctl(struct file *fp, u_long cm { struct ioctl_evtchn_notify *notify = addr; - if (notify-port NR_EVENT_CHANNELS) + if (notify-port = NR_EVENT_CHANNELS) return EINVAL; mutex_enter(devevent_lock); if (devevent[notify-port] != d) {
CVS commit: [netbsd-6] src/sys/arch/xen/xen
Module Name:src Committed By: msaitoh Date: Wed May 27 05:54:44 UTC 2015 Modified Files: src/sys/arch/xen/xen [netbsd-6]: xenevt.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1299): sys/arch/xen/xen/xenevt.c: revision 1.42 Fix off by one error, pointed out by Wei Liu in port-xen/49919 To generate a diff of this commit: cvs rdiff -u -r1.39 -r1.39.4.1 src/sys/arch/xen/xen/xenevt.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/vax/vax
Module Name:src Committed By: snj Date: Tue May 19 05:43:50 UTC 2015 Modified Files: src/sys/arch/vax/vax [netbsd-6]: ka660.c Log Message: Pull up following revision(s) (requested by ragge in ticket #1298): sys/arch/vax/vax/ka660.c: revision 1.11 PR port-vax/49884 Fixes bug introduced in earlier cleanup. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.14.1 src/sys/arch/vax/vax/ka660.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/vax/vax
Module Name:src Committed By: snj Date: Tue May 19 05:43:50 UTC 2015 Modified Files: src/sys/arch/vax/vax [netbsd-6]: ka660.c Log Message: Pull up following revision(s) (requested by ragge in ticket #1298): sys/arch/vax/vax/ka660.c: revision 1.11 PR port-vax/49884 Fixes bug introduced in earlier cleanup. To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.10.14.1 src/sys/arch/vax/vax/ka660.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/vax/vax/ka660.c diff -u src/sys/arch/vax/vax/ka660.c:1.10 src/sys/arch/vax/vax/ka660.c:1.10.14.1 --- src/sys/arch/vax/vax/ka660.c:1.10 Tue Dec 14 23:44:49 2010 +++ src/sys/arch/vax/vax/ka660.c Tue May 19 05:43:50 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ka660.c,v 1.10 2010/12/14 23:44:49 matt Exp $ */ +/* $NetBSD: ka660.c,v 1.10.14.1 2015/05/19 05:43:50 snj Exp $ */ /* * Copyright (c) 2000 Ludd, University of Lule}, Sweden. * All rights reserved. @@ -31,7 +31,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ka660.c,v 1.10 2010/12/14 23:44:49 matt Exp $); +__KERNEL_RCSID(0, $NetBSD: ka660.c,v 1.10.14.1 2015/05/19 05:43:50 snj Exp $); #include sys/param.h #include sys/systm.h @@ -61,7 +61,7 @@ static void ka660_cache_enable(void); static void ka660_attach_cpu(device_t); static int ka660_mchk(void *); -static const char * const ka660_devs[] = { cpu, sgec, vsbus, NULL }; +static const char * const ka660_devs[] = { cpu, sgec, shac, uba, NULL }; /* * Declaration of 660-specific calls. @@ -92,7 +92,7 @@ void ka660_attach_cpu(device_t self) { aprint_normal( - : %s, Rigel (ucode rev. %d), 2KB L1 cache, 128KB L2 cache\n, + : %s, SOC (ucode rev. %d), 6KB L1 cache\n, KA660, vax_cpudata 0377); }
CVS commit: [netbsd-6] src/sys/arch/sparc/stand/ofwboot
Module Name:src Committed By: msaitoh Date: Thu Apr 16 08:56:11 UTC 2015 Modified Files: src/sys/arch/sparc/stand/ofwboot [netbsd-6]: Locore.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #1285): sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14 Fix kernel loading failures from partitions started from over first 4GB of disks on sparc64. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/arch/sparc/stand/ofwboot/Locore.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc/stand/ofwboot
Module Name:src Committed By: msaitoh Date: Thu Apr 16 08:56:11 UTC 2015 Modified Files: src/sys/arch/sparc/stand/ofwboot [netbsd-6]: Locore.c Log Message: Pull up following revision(s) (requested by nakayama in ticket #1285): sys/arch/sparc/stand/ofwboot/Locore.c: revision 1.14 Fix kernel loading failures from partitions started from over first 4GB of disks on sparc64. To generate a diff of this commit: cvs rdiff -u -r1.12 -r1.12.10.1 src/sys/arch/sparc/stand/ofwboot/Locore.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/sparc/stand/ofwboot/Locore.c diff -u src/sys/arch/sparc/stand/ofwboot/Locore.c:1.12 src/sys/arch/sparc/stand/ofwboot/Locore.c:1.12.10.1 --- src/sys/arch/sparc/stand/ofwboot/Locore.c:1.12 Sat May 21 15:50:42 2011 +++ src/sys/arch/sparc/stand/ofwboot/Locore.c Thu Apr 16 08:56:11 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: Locore.c,v 1.12 2011/05/21 15:50:42 tsutsui Exp $ */ +/* $NetBSD: Locore.c,v 1.12.10.1 2015/04/16 08:56:11 msaitoh Exp $ */ /* * Copyright (C) 1995, 1996 Wolfgang Solfrank. @@ -302,8 +302,8 @@ OF_seek(int handle, u_quad_t pos) args.nargs = 3; args.nreturns = 1; args.handle = HDL2CELL(handle); - args.poshi = HDL2CELL(pos 32); - args.poslo = HDL2CELL(pos); + args.poshi = HDQ2CELL_HI(pos); + args.poslo = HDQ2CELL_LO(pos); if (openfirmware(args) == -1) { return -1; }
CVS commit: [netbsd-6] src/sys/arch/xen
Module Name:src Committed By: msaitoh Date: Tue Apr 14 14:59:11 UTC 2015 Modified Files: src/sys/arch/xen/include [netbsd-6]: evtchn.h src/sys/arch/xen/xen [netbsd-6]: evtchn.c pci_intr_machdep.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1278): sys/arch/xen/include/evtchn.h: revision 1.23 sys/arch/xen/xen/evtchn.c: revision 1.71 sys/arch/xen/xen/pci_intr_machdep.c: revision 1.17 Properly implemement pci_intr_disestablish(9), so that interrupt handlers stop being called when the device has been detached. Should fix PR port-xen/47720 (which turns out to not be related to raidframe). While there fix possible races in event_remove_handler() and pirq_establish(). To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.8.1 src/sys/arch/xen/include/evtchn.h cvs rdiff -u -r1.62.2.1 -r1.62.2.2 src/sys/arch/xen/xen/evtchn.c cvs rdiff -u -r1.15 -r1.15.8.1 src/sys/arch/xen/xen/pci_intr_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/xen/include/evtchn.h diff -u src/sys/arch/xen/include/evtchn.h:1.20 src/sys/arch/xen/include/evtchn.h:1.20.8.1 --- src/sys/arch/xen/include/evtchn.h:1.20 Tue Sep 20 00:12:23 2011 +++ src/sys/arch/xen/include/evtchn.h Tue Apr 14 14:59:11 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.h,v 1.20 2011/09/20 00:12:23 jym Exp $ */ +/* $NetBSD: evtchn.h,v 1.20.8.1 2015/04/14 14:59:11 msaitoh Exp $ */ /* * @@ -67,5 +67,6 @@ struct pintrhand { struct pintrhand *pirq_establish(int, int, int (*)(void *), void *, int, const char *); +void pirq_disestablish(struct pintrhand *); #endif /* _XEN_EVENTS_H_ */ Index: src/sys/arch/xen/xen/evtchn.c diff -u src/sys/arch/xen/xen/evtchn.c:1.62.2.1 src/sys/arch/xen/xen/evtchn.c:1.62.2.2 --- src/sys/arch/xen/xen/evtchn.c:1.62.2.1 Tue Dec 17 22:39:17 2013 +++ src/sys/arch/xen/xen/evtchn.c Tue Apr 14 14:59:11 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: evtchn.c,v 1.62.2.1 2013/12/17 22:39:17 riz Exp $ */ +/* $NetBSD: evtchn.c,v 1.62.2.2 2015/04/14 14:59:11 msaitoh Exp $ */ /* * Copyright (c) 2006 Manuel Bouyer. @@ -54,7 +54,7 @@ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.62.2.1 2013/12/17 22:39:17 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: evtchn.c,v 1.62.2.2 2015/04/14 14:59:11 msaitoh Exp $); #include opt_xen.h #include isa.h @@ -554,16 +554,16 @@ pirq_establish(int pirq, int evtch, int return NULL; } - if (event_set_handler(evtch, pirq_interrupt, ih, level, evname) != 0) { - kmem_free(ih, sizeof(struct pintrhand)); - return NULL; - } - ih-pirq = pirq; ih-evtch = evtch; ih-func = func; ih-arg = arg; + if (event_set_handler(evtch, pirq_interrupt, ih, level, evname) != 0) { + kmem_free(ih, sizeof(struct pintrhand)); + return NULL; + } + physdev_op.cmd = PHYSDEVOP_IRQ_STATUS_QUERY; physdev_op.u.irq_status_query.irq = pirq; if (HYPERVISOR_physdev_op(physdev_op) 0) @@ -579,6 +579,17 @@ pirq_establish(int pirq, int evtch, int return ih; } +void +pirq_disestablish(struct pintrhand *ih) +{ + int error = event_remove_handler(ih-evtch, pirq_interrupt, ih); + if (error) { + printf(pirq_disestablish(%p): %d\n, ih, error); + return; + } + kmem_free(ih, sizeof(struct pintrhand)); +} + int pirq_interrupt(void *arg) { @@ -776,7 +787,6 @@ event_remove_handler(int evtch, int (*fu } ci = ih-ih_cpu; *ihp = ih-ih_evt_next; - mutex_spin_exit(evtlock[evtch]); ipls = ci-ci_isources[ih-ih_level]; for (ihp = ipls-ipl_handlers, ih = ipls-ipl_handlers; @@ -788,6 +798,7 @@ event_remove_handler(int evtch, int (*fu if (ih == NULL) panic(event_remove_handler); *ihp = ih-ih_ipl_next; + mutex_spin_exit(evtlock[evtch]); kmem_free(ih, sizeof (struct intrhand)); if (evts-ev_handlers == NULL) { xen_atomic_clear_bit(ci-ci_evtmask[0], evtch); Index: src/sys/arch/xen/xen/pci_intr_machdep.c diff -u src/sys/arch/xen/xen/pci_intr_machdep.c:1.15 src/sys/arch/xen/xen/pci_intr_machdep.c:1.15.8.1 --- src/sys/arch/xen/xen/pci_intr_machdep.c:1.15 Fri Jul 1 18:36:45 2011 +++ src/sys/arch/xen/xen/pci_intr_machdep.c Tue Apr 14 14:59:11 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: pci_intr_machdep.c,v 1.15 2011/07/01 18:36:45 dyoung Exp $ */ +/* $NetBSD: pci_intr_machdep.c,v 1.15.8.1 2015/04/14 14:59:11 msaitoh Exp $ */ /* * Copyright (c) 2005 Manuel Bouyer. @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: pci_intr_machdep.c,v 1.15 2011/07/01 18:36:45 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: pci_intr_machdep.c,v 1.15.8.1 2015/04/14 14:59:11 msaitoh Exp $); #include sys/types.h #include sys/param.h @@ -221,4 +221,5 @@ pci_intr_establish(pci_chipset_tag_t pci void pci_intr_disestablish(pci_chipset_tag_t pcitag, void *cookie) { + pirq_disestablish(cookie); }
CVS commit: [netbsd-6] src/sys/arch/xen
Module Name:src Committed By: msaitoh Date: Tue Apr 14 14:59:11 UTC 2015 Modified Files: src/sys/arch/xen/include [netbsd-6]: evtchn.h src/sys/arch/xen/xen [netbsd-6]: evtchn.c pci_intr_machdep.c Log Message: Pull up following revision(s) (requested by bouyer in ticket #1278): sys/arch/xen/include/evtchn.h: revision 1.23 sys/arch/xen/xen/evtchn.c: revision 1.71 sys/arch/xen/xen/pci_intr_machdep.c: revision 1.17 Properly implemement pci_intr_disestablish(9), so that interrupt handlers stop being called when the device has been detached. Should fix PR port-xen/47720 (which turns out to not be related to raidframe). While there fix possible races in event_remove_handler() and pirq_establish(). To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.20.8.1 src/sys/arch/xen/include/evtchn.h cvs rdiff -u -r1.62.2.1 -r1.62.2.2 src/sys/arch/xen/xen/evtchn.c cvs rdiff -u -r1.15 -r1.15.8.1 src/sys/arch/xen/xen/pci_intr_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Tue Mar 24 08:51:14 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1265): sys/arch/sparc64/sparc64/locore.s: revision 1.380 PANICSTACK is a pointer itself, not a pointer to pointer. To generate a diff of this commit: cvs rdiff -u -r1.338.8.5 -r1.338.8.6 src/sys/arch/sparc64/sparc64/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/sparc64/sparc64/locore.s diff -u src/sys/arch/sparc64/sparc64/locore.s:1.338.8.5 src/sys/arch/sparc64/sparc64/locore.s:1.338.8.6 --- src/sys/arch/sparc64/sparc64/locore.s:1.338.8.5 Sat Dec 14 19:33:28 2013 +++ src/sys/arch/sparc64/sparc64/locore.s Tue Mar 24 08:51:14 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: locore.s,v 1.338.8.5 2013/12/14 19:33:28 bouyer Exp $ */ +/* $NetBSD: locore.s,v 1.338.8.6 2015/03/24 08:51:14 snj Exp $ */ /* * Copyright (c) 2006-2010 Matthew R. Green @@ -1890,9 +1890,7 @@ winfixspill: wrpr %g0, 0, %otherwin or %lo(2f), %o0, %o0 wrpr %g0, WSTATE_KERN, %wstate - sethi %hi(PANICSTACK), %sp - LDPTR [%sp + %lo(PANICSTACK)], %sp - add %sp, -CC64FSZ-STKB, %sp + set PANICSTACK-CC64FSZ-STKB, %sp ta 1; nop ! This helps out traptrace. call _C_LABEL(panic)! This needs to be fixed properly but we should panic here mov %g1, %o1 @@ -2570,9 +2568,7 @@ slowtrap: cmp %g7, WSTATE_KERN bnz,pt %icc, 1f ! User stack -- we'll blow it away nop - sethi %hi(PANICSTACK), %sp - LDPTR [%sp + %lo(PANICSTACK)], %sp - add %sp, -CC64FSZ-STKB, %sp + set PANICSTACK-CC64FSZ-STKB, %sp 1: #endif rdpr %tt, %g4
CVS commit: [netbsd-6] src/sys/arch/sparc64/sparc64
Module Name:src Committed By: snj Date: Tue Mar 24 08:51:14 UTC 2015 Modified Files: src/sys/arch/sparc64/sparc64 [netbsd-6]: locore.s Log Message: Pull up following revision(s) (requested by nakayama in ticket #1265): sys/arch/sparc64/sparc64/locore.s: revision 1.380 PANICSTACK is a pointer itself, not a pointer to pointer. To generate a diff of this commit: cvs rdiff -u -r1.338.8.5 -r1.338.8.6 src/sys/arch/sparc64/sparc64/locore.s Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sh3/sh3
Module Name:src Committed By: martin Date: Mon Feb 16 08:14:34 UTC 2015 Modified Files: src/sys/arch/sh3/sh3 [netbsd-6]: locore_subr.S Log Message: Pull up following revision(s) (requested by skrll in ticket #1254): sys/arch/sh3/sh3/locore_subr.S: revision 1.55 port-sh3/49613: errno does not set by some systemcall at error case Branch to correct point when error detected. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.54.10.1 src/sys/arch/sh3/sh3/locore_subr.S Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/sh3/sh3
Module Name:src Committed By: martin Date: Mon Feb 16 08:14:34 UTC 2015 Modified Files: src/sys/arch/sh3/sh3 [netbsd-6]: locore_subr.S Log Message: Pull up following revision(s) (requested by skrll in ticket #1254): sys/arch/sh3/sh3/locore_subr.S: revision 1.55 port-sh3/49613: errno does not set by some systemcall at error case Branch to correct point when error detected. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.54.10.1 src/sys/arch/sh3/sh3/locore_subr.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/sh3/sh3/locore_subr.S diff -u src/sys/arch/sh3/sh3/locore_subr.S:1.54 src/sys/arch/sh3/sh3/locore_subr.S:1.54.10.1 --- src/sys/arch/sh3/sh3/locore_subr.S:1.54 Tue Feb 1 01:54:14 2011 +++ src/sys/arch/sh3/sh3/locore_subr.S Mon Feb 16 08:14:34 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $ */ +/* $NetBSD: locore_subr.S,v 1.54.10.1 2015/02/16 08:14:34 martin Exp $ */ /*- * Copyright (c) 2002 The NetBSD Foundation, Inc. @@ -40,7 +40,7 @@ #include sh3/mmu_sh3.h #include sh3/mmu_sh4.h -__KERNEL_RCSID(0, $NetBSD: locore_subr.S,v 1.54 2011/02/01 01:54:14 uwe Exp $) +__KERNEL_RCSID(0, $NetBSD: locore_subr.S,v 1.54.10.1 2015/02/16 08:14:34 martin Exp $) /* @@ -645,7 +645,7 @@ ENTRY(copyinstr) mov.l .L_copyinstr_VM_MAXUSER_ADDRESS, r3 cmp/hi r3, r4 /* bomb if usrc isn't in user space */ - bt 4f + bt 5f mov r3, r0 sub r4, r0 cmp/hi r6, r0 /* don't beyond user space */
CVS commit: [netbsd-6] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Mon Jan 26 13:43:44 UTC 2015 Modified Files: src/sys/arch/x86/pci [netbsd-6]: ichlpcib.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1239): sys/arch/x86/pci/ichlpcib.c: revision 1.46 The PMBASE and GPIOBASE registers are not compatible with the PCI spec and the map sizes are fixed to 128bytes. The pci_mapreg_submap() function has a code to check the range of the BAR. The PCI_MAPREG_IO_SIZE() macro returns lower than 128bytes on some machines. This makes it impossible to use pci_mapreg_submap(). Use pci_conf_read() and bus_space_map() directly. To generate a diff of this commit: cvs rdiff -u -r1.34.6.1 -r1.34.6.2 src/sys/arch/x86/pci/ichlpcib.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/pci/ichlpcib.c diff -u src/sys/arch/x86/pci/ichlpcib.c:1.34.6.1 src/sys/arch/x86/pci/ichlpcib.c:1.34.6.2 --- src/sys/arch/x86/pci/ichlpcib.c:1.34.6.1 Fri Jan 16 08:22:25 2015 +++ src/sys/arch/x86/pci/ichlpcib.c Mon Jan 26 13:43:44 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: ichlpcib.c,v 1.34.6.1 2015/01/16 08:22:25 snj Exp $ */ +/* $NetBSD: ichlpcib.c,v 1.34.6.2 2015/01/26 13:43:44 martin Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -39,7 +39,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: ichlpcib.c,v 1.34.6.1 2015/01/16 08:22:25 snj Exp $); +__KERNEL_RCSID(0, $NetBSD: ichlpcib.c,v 1.34.6.2 2015/01/26 13:43:44 martin Exp $); #include sys/types.h #include sys/param.h @@ -260,6 +260,7 @@ lpcibattach(device_t parent, device_t se struct pci_attach_args *pa = aux; struct lpcib_softc *sc = device_private(self); struct lpcib_device *lpcib_dev; + pcireg_t pmbase; sc-sc_pa = *pa; @@ -281,12 +282,16 @@ lpcibattach(device_t parent, device_t se * * The PMBASE register is alike PCI BAR but not completely compatible * with it. The PMBASE define the base address and the type but - * not describe the size. + * not describe the size. The value of the register may be lower + * than LPCIB_PCI_PM_SIZE. It makes impossible to use + * pci_mapreg_submap() because the function does range check. */ - if (pci_mapreg_submap(pa, LPCIB_PCI_PMBASE, PCI_MAPREG_TYPE_IO, 0, - LPCIB_PCI_PM_SIZE, 0, sc-sc_iot, sc-sc_ioh, NULL, - sc-sc_iosize)) { - aprint_error_dev(self, can't map power management i/o space\n); + sc-sc_iot = pa-pa_iot; + pmbase = pci_conf_read(pa-pa_pc, pa-pa_tag, LPCIB_PCI_PMBASE); + if (bus_space_map(sc-sc_iot, PCI_MAPREG_IO_ADDR(pmbase), + LPCIB_PCI_PM_SIZE, 0, sc-sc_ioh) != 0) { + aprint_error_dev(self, + can't map power management i/o space\n); return; } @@ -1039,11 +1044,14 @@ lpcib_gpio_configure(device_t self) /* * The GPIO_BASE register is alike PCI BAR but not completely * compatible with it. The PMBASE define the base address and the type - * but not describe the size. + * but not describe the size. The value of the register may be lower + * than LPCIB_PCI_GPIO_SIZE. It makes impossible to use + * pci_mapreg_submap() because the function does range check. */ - rv = pci_mapreg_submap(sc-sc_pa, base_reg, PCI_MAPREG_TYPE_IO, 0, - LPCIB_PCI_GPIO_SIZE, 0, sc-sc_gpio_iot, sc-sc_gpio_ioh, - NULL, sc-sc_gpio_ios); + sc-sc_gpio_iot = sc-sc_pa.pa_iot; + reg = pci_conf_read(sc-sc_pa.pa_pc, sc-sc_pa.pa_tag, base_reg); + rv = bus_space_map(sc-sc_gpio_iot, PCI_MAPREG_IO_ADDR(reg), + LPCIB_PCI_GPIO_SIZE, 0, sc-sc_gpio_ioh); if (rv != 0) { aprint_error_dev(self, can't map general purpose i/o space(rv = %d)\n, rv); return;
CVS commit: [netbsd-6] src/sys/arch/x86/pci
Module Name:src Committed By: martin Date: Mon Jan 26 13:43:44 UTC 2015 Modified Files: src/sys/arch/x86/pci [netbsd-6]: ichlpcib.c Log Message: Pull up following revision(s) (requested by msaitoh in ticket #1239): sys/arch/x86/pci/ichlpcib.c: revision 1.46 The PMBASE and GPIOBASE registers are not compatible with the PCI spec and the map sizes are fixed to 128bytes. The pci_mapreg_submap() function has a code to check the range of the BAR. The PCI_MAPREG_IO_SIZE() macro returns lower than 128bytes on some machines. This makes it impossible to use pci_mapreg_submap(). Use pci_conf_read() and bus_space_map() directly. To generate a diff of this commit: cvs rdiff -u -r1.34.6.1 -r1.34.6.2 src/sys/arch/x86/pci/ichlpcib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/x86/include
Module Name:src Committed By: martin Date: Mon Jan 26 13:58:05 UTC 2015 Modified Files: src/sys/arch/x86/include [netbsd-6]: specialreg.h Log Message: Pull up the following, requested by msaitoh in ticket #1240: sys/arch/x86/include/specialreg.h 1.72 via patch Add CPUID_TO_*() macros to avoid bug. Old macros are kept for compatibility. See http://mail-index.netbsd.org/port-amd64/2013/11/12/msg001978.html To generate a diff of this commit: cvs rdiff -u -r1.55.2.4 -r1.55.2.5 src/sys/arch/x86/include/specialreg.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/x86/include/specialreg.h diff -u src/sys/arch/x86/include/specialreg.h:1.55.2.4 src/sys/arch/x86/include/specialreg.h:1.55.2.5 --- src/sys/arch/x86/include/specialreg.h:1.55.2.4 Mon Dec 29 15:31:06 2014 +++ src/sys/arch/x86/include/specialreg.h Mon Jan 26 13:58:05 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: specialreg.h,v 1.55.2.4 2014/12/29 15:31:06 martin Exp $ */ +/* $NetBSD: specialreg.h,v 1.55.2.5 2015/01/26 13:58:05 martin Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -221,19 +221,39 @@ \31 DEADLINE \32 AES \33 XSAVE \34 OSXSAVE \ \35 AVX \36 F16C \37 RDRAND \40 RAZ -#define CPUID2FAMILY(cpuid) (((cpuid) 8) 0xf) -#define CPUID2MODEL(cpuid) (((cpuid) 4) 0xf) -#define CPUID2STEPPING(cpuid) ((cpuid) 0xf) +/* CPUID Fn0001 %eax */ + +#define CPUID_TO_BASEFAMILY(cpuid) (((cpuid) 8) 0xf) +#define CPUID_TO_BASEMODEL(cpuid) (((cpuid) 4) 0xf) +#define CPUID_TO_STEPPING(cpuid) ((cpuid) 0xf) + +/* Old macros for compatibility */ +#define CPUID2FAMILY(cpuid) CPUID_TO_BASEFAMILY(cpuid) +#define CPUID2MODEL(cpuid) CPUID_TO_BASEMODEL(cpuid) +#define CPUID2STEPPING(cpuid) CPUID_TO_STEPPING(cpuid) /* - * The Extended family bits should only be inspected when CPUID2FAMILY() + * The Extended family bits should only be inspected when CPUID_TO_BASEFAMILY() * returns 15. They are use to encode family value 16 to 270 (add 15). - * The Extended model hits are the high 4 bits of the model. + * The Extended model bits are the high 4 bits of the model. * They are only valid for family = 15 or family 6 (intel, but all amd * family 6 are documented to return zero bits for them). */ -#define CPUID2EXTFAMILY(cpuid) (((cpuid) 20) 0xff) -#define CPUID2EXTMODEL(cpuid) (((cpuid) 16) 0xf) +#define CPUID_TO_EXTFAMILY(cpuid) (((cpuid) 20) 0xff) +#define CPUID_TO_EXTMODEL(cpuid) (((cpuid) 16) 0xf) + +/* Old macros for compatibility */ +#define CPUID2EXTFAMILY(cpuid) CPUID_TO_EXTFAMILY(cpuid) +#define CPUID2EXTMODEL(cpuid) CPUID_TO_EXTMODEL(cpuid) + +/* The macros for the Display Family and the Display Model */ +#define CPUID_TO_FAMILY(cpuid) (CPUID_TO_BASEFAMILY(cpuid) \ + + ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f) \ + ? 0 : CPUID_TO_EXTFAMILY(cpuid))) +#define CPUID_TO_MODEL(cpuid) (CPUID_TO_BASEMODEL(cpuid) \ + | ((CPUID_TO_BASEFAMILY(cpuid) != 0x0f) \ + (CPUID_TO_BASEFAMILY(cpuid) != 0x06) \ + ? 0 : (CPUID_TO_EXTMODEL(cpuid) 4))) /* * Intel Deterministic Cache Parameter Leaf
CVS commit: [netbsd-6] src/sys/arch/x86/include
Module Name:src Committed By: martin Date: Mon Jan 26 13:58:05 UTC 2015 Modified Files: src/sys/arch/x86/include [netbsd-6]: specialreg.h Log Message: Pull up the following, requested by msaitoh in ticket #1240: sys/arch/x86/include/specialreg.h 1.72 via patch Add CPUID_TO_*() macros to avoid bug. Old macros are kept for compatibility. See http://mail-index.netbsd.org/port-amd64/2013/11/12/msg001978.html To generate a diff of this commit: cvs rdiff -u -r1.55.2.4 -r1.55.2.5 src/sys/arch/x86/include/specialreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: martin Date: Mon Jan 26 14:02:40 UTC 2015 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: identcpu.c Log Message: Pull up the following, requested by msaitoh in ticket #1241: sys/arch/x86/x86/identcpu.c 1.35-1.39 - Check cpuid leaf 4 for newer Intel CPU to know the cache information. This code might improve performance because it changes the number of page colors. - Fix calculation of the cpu model (display model) in cpu_probe_amd_cache(). - CPUID leaf 2 and 4 are only for Intel processors. To generate a diff of this commit: cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/arch/x86/x86/identcpu.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/identcpu.c diff -u src/sys/arch/x86/x86/identcpu.c:1.29.2.2 src/sys/arch/x86/x86/identcpu.c:1.29.2.3 --- src/sys/arch/x86/x86/identcpu.c:1.29.2.2 Mon May 7 16:37:19 2012 +++ src/sys/arch/x86/x86/identcpu.c Mon Jan 26 14:02:40 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: identcpu.c,v 1.29.2.2 2012/05/07 16:37:19 riz Exp $ */ +/* $NetBSD: identcpu.c,v 1.29.2.3 2015/01/26 14:02:40 martin Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2006, 2007, 2008 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.29.2.2 2012/05/07 16:37:19 riz Exp $); +__KERNEL_RCSID(0, $NetBSD: identcpu.c,v 1.29.2.3 2015/01/26 14:02:40 martin Exp $); #include opt_xen.h @@ -97,6 +97,103 @@ cache_info_lookup(const struct x86_cache return (NULL); } +static void +cpu_probe_intel_cache(struct cpu_info *ci) +{ + const struct x86_cache_info *cai; + u_int descs[4]; + int iterations, i, j; + uint8_t desc; + + if (cpuid_level = 2) { + /* Parse the cache info from `cpuid leaf 2', if we have it. */ + x86_cpuid(2, descs); + iterations = descs[0] 0xff; + while (iterations-- 0) { + for (i = 0; i 4; i++) { +if (descs[i] 0x8000) + continue; +for (j = 0; j 4; j++) { + if (i == 0 j == 0) + continue; + desc = (descs[i] (j * 8)) 0xff; + if (desc == 0) + continue; + cai = cache_info_lookup( + intel_cpuid_cache_info, desc); + if (cai != NULL) { + ci-ci_cinfo[cai-cai_index] = + *cai; + } +} + } + } + } + + if (cpuid_level = 4) { + int type, level; + int ways, partitions, linesize, sets; + int caitype = -1; + int totalsize; + + /* Parse the cache info from `cpuid leaf 4', if we have it. */ + for (i = 0; ; i++) { + x86_cpuid2(4, i, descs); + type = __SHIFTOUT(descs[0], CPUID_DCP_CACHETYPE); + if (type == CPUID_DCP_CACHETYPE_N) +break; + level = __SHIFTOUT(descs[0], CPUID_DCP_CACHELEVEL); + switch (level) { + case 1: +if (type == CPUID_DCP_CACHETYPE_I) + caitype = CAI_ICACHE; +else if (type == CPUID_DCP_CACHETYPE_D) + caitype = CAI_DCACHE; +else + caitype = -1; +break; + case 2: +if (type == CPUID_DCP_CACHETYPE_U) + caitype = CAI_L2CACHE; +else + caitype = -1; +break; + case 3: +if (type == CPUID_DCP_CACHETYPE_U) + caitype = CAI_L3CACHE; +else + caitype = -1; +break; + default: +caitype = -1; +break; + } + if (caitype == -1) +continue; + + ways = __SHIFTOUT(descs[1], CPUID_DCP_WAYS) + 1; + partitions =__SHIFTOUT(descs[1], CPUID_DCP_PARTITIONS) + + 1; + linesize = __SHIFTOUT(descs[1], CPUID_DCP_LINESIZE) + + 1; + sets = descs[2] + 1; + totalsize = ways * partitions * linesize * sets; + ci-ci_cinfo[caitype].cai_totalsize = totalsize; + ci-ci_cinfo[caitype].cai_associativity = ways; + ci-ci_cinfo[caitype].cai_linesize = linesize; + } + } +} + +static void +cpu_probe_intel(struct cpu_info *ci) +{ + + if (cpu_vendor != CPUVENDOR_INTEL) + return; + + cpu_probe_intel_cache(ci); +} static void cpu_probe_amd_cache(struct cpu_info *ci) @@ -107,8 +204,8 @@ cpu_probe_amd_cache(struct cpu_info *ci) u_int descs[4]; u_int lfunc; - family = CPUID2FAMILY(ci-ci_signature); - model = CPUID2MODEL(ci-ci_signature); + family = CPUID_TO_FAMILY(ci-ci_signature); + model = CPUID_TO_MODEL(ci-ci_signature); /* * K5 model 0 has none of this info. @@ -117,14 +214,6 @@ cpu_probe_amd_cache(struct cpu_info *ci) return; /* - * Get extended values for K8 and up. - */ - if (family == 0xf) { - family += CPUID2EXTFAMILY(ci-ci_signature); - model += CPUID2EXTMODEL(ci-ci_signature); - } - - /* * Determine the largest extended function value. */ x86_cpuid(0x8000, descs); @@ -248,10 +337,10 @@ cpu_probe_k5(struct cpu_info *ci) int flag; if (cpu_vendor != CPUVENDOR_AMD || - CPUID2FAMILY(ci-ci_signature) != 5) + CPUID_TO_FAMILY(ci-ci_signature) != 5) return; - if (CPUID2MODEL(ci-ci_signature) == 0) { + if (CPUID_TO_MODEL(ci-ci_signature) == 0) { /* * According to the AMD Processor Recognition App Note,
CVS commit: [netbsd-6] src/sys/arch/x86/x86
Module Name:src Committed By: martin Date: Mon Jan 26 14:02:40 UTC 2015 Modified Files: src/sys/arch/x86/x86 [netbsd-6]: identcpu.c Log Message: Pull up the following, requested by msaitoh in ticket #1241: sys/arch/x86/x86/identcpu.c 1.35-1.39 - Check cpuid leaf 4 for newer Intel CPU to know the cache information. This code might improve performance because it changes the number of page colors. - Fix calculation of the cpu model (display model) in cpu_probe_amd_cache(). - CPUID leaf 2 and 4 are only for Intel processors. To generate a diff of this commit: cvs rdiff -u -r1.29.2.2 -r1.29.2.3 src/sys/arch/x86/x86/identcpu.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/evbsh3/evbsh3
Module Name:src Committed By: martin Date: Sat Jan 24 13:45:46 UTC 2015 Modified Files: src/sys/arch/evbsh3/evbsh3 [netbsd-6]: bus_dma.c Log Message: Pull up following revision(s) (requested by nonaka in ticket #1237): sys/arch/evbsh3/evbsh3/bus_dma.c: revision 1.4 Sync with sys/arch/landisk/landisk/bus_dma.c rev.1.15. Don't call sh_dcache_inv_range() on BUS_DMASYNC_POSTREAD ops as other mips and arm ports. All cached data is cared on BUS_DMASYNC_PREREAD and invalidating cache without writeback could cause unexpected data loss if specified sync region is not cacheline aligned. This may fix ffs_alloccg: map corrupted panic on acardide IDE disks, which didn't happen on USB HDD. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/evbsh3/evbsh3/bus_dma.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: [netbsd-6] src/sys/arch/evbsh3/evbsh3
Module Name:src Committed By: martin Date: Sat Jan 24 13:45:46 UTC 2015 Modified Files: src/sys/arch/evbsh3/evbsh3 [netbsd-6]: bus_dma.c Log Message: Pull up following revision(s) (requested by nonaka in ticket #1237): sys/arch/evbsh3/evbsh3/bus_dma.c: revision 1.4 Sync with sys/arch/landisk/landisk/bus_dma.c rev.1.15. Don't call sh_dcache_inv_range() on BUS_DMASYNC_POSTREAD ops as other mips and arm ports. All cached data is cared on BUS_DMASYNC_PREREAD and invalidating cache without writeback could cause unexpected data loss if specified sync region is not cacheline aligned. This may fix ffs_alloccg: map corrupted panic on acardide IDE disks, which didn't happen on USB HDD. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.3.8.1 src/sys/arch/evbsh3/evbsh3/bus_dma.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/evbsh3/evbsh3/bus_dma.c diff -u src/sys/arch/evbsh3/evbsh3/bus_dma.c:1.3 src/sys/arch/evbsh3/evbsh3/bus_dma.c:1.3.8.1 --- src/sys/arch/evbsh3/evbsh3/bus_dma.c:1.3 Tue Jul 19 15:44:52 2011 +++ src/sys/arch/evbsh3/evbsh3/bus_dma.c Sat Jan 24 13:45:46 2015 @@ -1,4 +1,4 @@ -/* $NetBSD: bus_dma.c,v 1.3 2011/07/19 15:44:52 dyoung Exp $ */ +/* $NetBSD: bus_dma.c,v 1.3.8.1 2015/01/24 13:45:46 martin Exp $ */ /* * Copyright (c) 2005 NONAKA Kimihiro non...@netbsd.org @@ -26,7 +26,7 @@ */ #include sys/cdefs.h -__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.3 2011/07/19 15:44:52 dyoung Exp $); +__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.3.8.1 2015/01/24 13:45:46 martin Exp $); #include sys/param.h #include sys/systm.h @@ -545,11 +545,6 @@ _bus_dmamap_sync(bus_dma_tag_t t, bus_dm if (SH_HAS_WRITEBACK_CACHE) sh_dcache_wb_range(naddr, minlen); break; - - case BUS_DMASYNC_POSTREAD: - case BUS_DMASYNC_POSTREAD|BUS_DMASYNC_POSTWRITE: - sh_dcache_inv_range(naddr, minlen); - break; } offset = 0; len -= minlen;