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

2018-10-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Oct 10 04:16:58 UTC 2018

Modified Files:
src/sys/arch/xen/include: xen.h

Log Message:
In  xen_atomic_test_and_clear_bit()

Use the appropriate sized variable for inline assembler.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/arch/xen/include/xen.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/xen/include/xen.h
diff -u src/sys/arch/xen/include/xen.h:1.40 src/sys/arch/xen/include/xen.h:1.41
--- src/sys/arch/xen/include/xen.h:1.40	Sun Oct  7 11:25:55 2018
+++ src/sys/arch/xen/include/xen.h	Wed Oct 10 04:16:58 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: xen.h,v 1.40 2018/10/07 11:25:55 mlelstv Exp $	*/
+/*	$NetBSD: xen.h,v 1.41 2018/10/10 04:16:58 cherry Exp $	*/
 
 /*
  *
@@ -248,7 +248,7 @@ xen_atomic_clearbits_l (volatile XATOMIC
 static __inline XATOMIC_T
 xen_atomic_test_and_clear_bit(volatile void *ptr, unsigned long bitno)
 {
-	int result;
+	long result;
 
 	__asm volatile(__LOCK_PREFIX
 #ifdef __x86_64__



CVS commit: src/sys/arch/xen/xen

2018-10-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Oct 10 03:54:54 UTC 2018

Modified Files:
src/sys/arch/xen/xen: xenevt.c

Log Message:
Do not re-expose the innards of evtchn.c, now that we have a way
to register interrupts via intr.c:intr_establish_xname()

evtchn.c is going to get refactored soon, so use the latter method.


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 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.48 src/sys/arch/xen/xen/xenevt.c:1.49
--- src/sys/arch/xen/xen/xenevt.c:1.48	Thu Nov 30 20:25:54 2017
+++ src/sys/arch/xen/xen/xenevt.c	Wed Oct 10 03:54:54 2018
@@ -1,4 +1,4 @@
-/*  $NetBSD: xenevt.c,v 1.48 2017/11/30 20:25:54 christos Exp $  */
+/*  $NetBSD: xenevt.c,v 1.49 2018/10/10 03:54:54 cherry Exp $  */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.48 2017/11/30 20:25:54 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xenevt.c,v 1.49 2018/10/10 03:54:54 cherry Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -145,15 +145,28 @@ long xenevt_ev1;
 long xenevt_ev2[NR_EVENT_CHANNELS];
 static int xenevt_processevt(void *);
 
+static evtchn_port_t xenevt_alloc_event(void)
+{
+	evtchn_op_t op;
+	op.cmd = EVTCHNOP_alloc_unbound;
+	op.u.alloc_unbound.dom = DOMID_SELF;
+	op.u.alloc_unbound.remote_dom = DOMID_SELF;
+	if (HYPERVISOR_event_channel_op() != 0)
+		panic("%s: Failed to allocate loopback event\n", __func__);	
+
+	return op.u.alloc_unbound.port;
+}
+
 /* called at boot time */
 void
 xenevtattach(int n)
 {
 	struct intrhand *ih;
-	int s;
 	int level = IPL_HIGH;
 #ifdef MULTIPROCESSOR
 	bool mpsafe = (level != IPL_VM);
+#else
+	bool mpsafe = false;
 #endif /* MULTIPROCESSOR */
 
 	mutex_init(_lock, MUTEX_DEFAULT, IPL_HIGH);
@@ -165,26 +178,19 @@ xenevtattach(int n)
 	xenevt_ev1 = 0;
 	memset(xenevt_ev2, 0, sizeof(xenevt_ev2));
 
-	/* register a handler at splhigh, so that spllower() will call us */
-	ih = malloc(sizeof (struct intrhand), M_DEVBUF,
-	 M_WAITOK|M_ZERO);
-	if (ih == NULL)
-		panic("can't allocate xenevt interrupt source");
-	ih->ih_level = level;
-	ih->ih_fun = ih->ih_realfun = xenevt_processevt;
-	ih->ih_arg = ih->ih_realarg = NULL;
-	ih->ih_next = NULL;
-	ih->ih_cpu = _info_primary;
-#ifdef MULTIPROCESSOR
-	if (!mpsafe) {
-		ih->ih_fun = xen_intr_biglock_wrapper;
-		ih->ih_arg = ih;
-	}
-#endif /* MULTIPROCESSOR */
+	/*
+	 * Allocate a loopback event port.
+	 * This helps us massage xenevt_processevt() into the
+	 * callchain at the appropriate level using only
+	 * intr_establish_xname().
+	 */
+	evtchn_port_t evtchn = xenevt_alloc_event();
+
+	/* The real objective here is to wiggle into the ih callchain for IPL level */
+	ih = intr_establish_xname(0, _pic, evtchn,  IST_LEVEL, level,
+	xenevt_processevt, NULL, mpsafe, "xenevt");
 
-	s = splhigh();
-	event_set_iplhandler(ih->ih_cpu, ih, level);
-	splx(s);
+	KASSERT(ih != NULL);
 }
 
 /* register pending event - always called with interrupt disabled */



CVS commit: src/sys/arch/xen

2018-10-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Oct 10 02:34:08 UTC 2018

Modified Files:
src/sys/arch/xen/include: intr.h
src/sys/arch/xen/x86: pintr.c

Log Message:
Do not export the 'irq<->vector' abstraction outside of pintr.c
anymore. We now think of them as a unified thing called 'gsi',
which is generated by mpacpi/mpbios


To generate a diff of this commit:
cvs rdiff -u -r1.48 -r1.49 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/xen/x86/pintr.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/intr.h
diff -u src/sys/arch/xen/include/intr.h:1.48 src/sys/arch/xen/include/intr.h:1.49
--- src/sys/arch/xen/include/intr.h:1.48	Sun Oct  7 05:23:01 2018
+++ src/sys/arch/xen/include/intr.h	Wed Oct 10 02:34:08 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.h,v 1.48 2018/10/07 05:23:01 cherry Exp $	*/
+/*	$NetBSD: intr.h,v 1.49 2018/10/10 02:34:08 cherry Exp $	*/
 /*	NetBSD intr.h,v 1.15 2004/10/31 10:39:34 yamt Exp	*/
 
 /*-
@@ -62,8 +62,6 @@ struct evtsource {
 };
 
 extern struct intrstub xenev_stubs[];
-extern int irq2vect[256];
-extern int vect2irq[256];
 extern int irq2port[NR_EVENT_CHANNELS]; /* actually port + 1, so that 0 is invaid */
 
 #ifdef MULTIPROCESSOR

Index: src/sys/arch/xen/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.8 src/sys/arch/xen/x86/pintr.c:1.9
--- src/sys/arch/xen/x86/pintr.c:1.8	Wed Oct 10 02:16:34 2018
+++ src/sys/arch/xen/x86/pintr.c	Wed Oct 10 02:34:08 2018
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.8 2018/10/10 02:16:34 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.9 2018/10/10 02:34:08 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -143,8 +143,8 @@ struct intrstub x2apic_edge_stubs[MAX_IN
 struct intrstub x2apic_level_stubs[MAX_INTR_SOURCES] = {{0,0}};
 #include 
 int irq2port[NR_EVENT_CHANNELS] = {0}; /* actually port + 1, so that 0 is invaid */
-int irq2vect[256] = {0};
-int vect2irq[256] = {0};
+static int irq2vect[256] = {0};
+static int vect2irq[256] = {0};
 #endif /* NIOAPIC */
 #if NACPICA > 0
 #include 



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

2018-10-09 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Wed Oct 10 02:16:34 UTC 2018

Modified Files:
src/sys/arch/xen/x86: pintr.c

Log Message:
Since GSIs are invented by the mpbios/mpacpi interrupt routing probe code,
it's possible for shared GSIs to popup even outside the original
legacy_irq range.

Relax this latter, older assumption.

Thanks to Brad Spencer for extensive trialing on interesting hardware.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/xen/x86/pintr.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/x86/pintr.c
diff -u src/sys/arch/xen/x86/pintr.c:1.7 src/sys/arch/xen/x86/pintr.c:1.8
--- src/sys/arch/xen/x86/pintr.c:1.7	Sun Oct  7 05:23:01 2018
+++ src/sys/arch/xen/x86/pintr.c	Wed Oct 10 02:16:34 2018
@@ -103,7 +103,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.7 2018/10/07 05:23:01 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pintr.c,v 1.8 2018/10/10 02:16:34 cherry Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_xen.h"
@@ -176,8 +176,7 @@ xen_vec_alloc(int gsi)
 			irq2vect[gsi] == op.u.irq_op.vector);
 		irq2vect[gsi] = op.u.irq_op.vector;
 		KASSERT(vect2irq[op.u.irq_op.vector] == 0 ||
-			(gsi > 0 && gsi < 16 &&
-			 vect2irq[op.u.irq_op.vector] == gsi));
+			 vect2irq[op.u.irq_op.vector] == gsi);
 		vect2irq[op.u.irq_op.vector] = gsi;
 	}
 



CVS commit: src/crypto/external/bsd/openssl/include/openssl

2018-10-09 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Oct 10 01:29:25 UTC 2018

Modified Files:
src/crypto/external/bsd/openssl/include/openssl: opensslconf.h

Log Message:
enable OPENSSL_NO_EC_NISTP_64_GCC_128, requested by wiz


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/openssl/include/openssl/opensslconf.h

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

Modified files:

Index: src/crypto/external/bsd/openssl/include/openssl/opensslconf.h
diff -u src/crypto/external/bsd/openssl/include/openssl/opensslconf.h:1.2 src/crypto/external/bsd/openssl/include/openssl/opensslconf.h:1.3
--- src/crypto/external/bsd/openssl/include/openssl/opensslconf.h:1.2	Sun Sep 23 09:33:04 2018
+++ src/crypto/external/bsd/openssl/include/openssl/opensslconf.h	Tue Oct  9 21:29:25 2018
@@ -48,9 +48,6 @@ extern "C" {
 #ifndef OPENSSL_NO_DEVCRYPTOENG
 # define OPENSSL_NO_DEVCRYPTOENG
 #endif
-#ifndef OPENSSL_NO_EC_NISTP_64_GCC_128
-# define OPENSSL_NO_EC_NISTP_64_GCC_128
-#endif
 #ifndef OPENSSL_NO_EGD
 # define OPENSSL_NO_EGD
 #endif



CVS commit: [netbsd-7] src/doc

2018-10-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Oct  9 15:54:57 UTC 2018

Modified Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
1636


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.1 -r1.1.2.2 src/doc/CHANGES-7.3

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

Modified files:

Index: src/doc/CHANGES-7.3
diff -u src/doc/CHANGES-7.3:1.1.2.1 src/doc/CHANGES-7.3:1.1.2.2
--- src/doc/CHANGES-7.3:1.1.2.1	Tue Oct  9 15:50:03 2018
+++ src/doc/CHANGES-7.3	Tue Oct  9 15:54:57 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.3,v 1.1.2.1 2018/10/09 15:50:03 snj Exp $
+# $NetBSD: CHANGES-7.3,v 1.1.2.2 2018/10/09 15:54:57 snj Exp $
 
 A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
 release:
@@ -10,3 +10,61 @@ sys/sys/param.h	patched by hand
 	Welcome to 7.2_STABLE.
 	[snj]
 
+sys/arch/x86/include/cacheinfo.h		1.23-1.26
+sys/arch/x86/include/cpu.h			1.70
+sys/arch/x86/include/specialreg.h		1.91-1.93,1.98,1.100,1.102-1.124,1.126,1.130 via patch
+sys/arch/x86/x86/cpu_topology.c			1.10
+sys/arch/x86/x86/identcpu.c			1.56-1.57,1.70 via patch
+usr.sbin/cpuctl/arch/i386.c			1.71,1.75-1.79,1.81-1.85 via patch
+
+	Add some register definitions for x86:
+	  - Add CLWB bit.
+	  - Fix a few (unused) MSR values, and add some bit definitions of
+	MSR_EFER from Murray Armfield in PR#42861.
+	  - CPUID_CFLUSH bit is not for CFLUSH insn but CLFLUSH insn, so modify
+	comments and snprintb() string.
+	  - Define CPUID Fn0001 %ebx bits and use them.
+	No functional change.
+	  - Add Structured Extended Flags Enumeration Leaf's bit definitions:
+	AVX512_{IFMA,VBMI2,VNNI,BITALG,VPOPCNTDQ,4VNNIW,4FMAPS},GFNI
+	  - Add Turbo Boost Max Technology 3.0 bit.
+	  - Add AMD SVM features definitions.
+	  - Add Intel cpuid 7 %edx IBRS and STIBP bit definitions.
+	  - Fix swapped comments for EFER LME and LMA
+	  - Add Intel cpuid 7 %edx bit 29 IA32_ARCH_CAPABILITIES supported bit.
+	  - Add MSR_IA32_ARCH_CAPABILITIES definition.
+	  - Add IA32_SPEC_CTRL MSR and IA32_PRED_CMD MSR.
+	  - Add Intel Deterministic Address Translation Parameter Leaf(0x18)
+	definitions.
+	  - s/CLFUSH/CLFLUSH/
+	  - Add AMD's Disable Indirect Branch Predictor bit definition.
+	  - Add the MSR bits definitions for IBRS, STIBP and IBPB.
+	  - Add Intel Fn_0006 %eax new bit 14-20 (HWP stuff).
+	  - Intel Fn_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.
+	  - Add AMD's CPUID Fn8001 %edx MMX and FXSR bit definitions.
+	  - Add RDCL_NO and IBRS_ALL.
+	  - Add SSBD and RSBA bit definitions.
+	  - Add AMD's SSB bit definitions for F15H, F16H and F17H.
+	  - Add cpuid 7 edx L1D_FLUSH bit.
+	  - Add IA32_ARCH_SKIP_L1DFL_VMENTRY bit.
+	  - Add IA32_FLUSH_CMD MSR.
+	  - Add yet another Shared L2 TLB (2M/4M pages).
+	  - Add 3way and 6way of L2 cache or TLB on AMD CPU.
+	  - AMD L3 cache association bitfield is not 8bit but 4bit like others
+	association bitfields.
+	  - Sort entries. No functional change.
+	  - Modify comment, fix typo in comment and add comment.
+	cpuctl(8):
+	  - Add detection for Quark X1000, Xeon E5 v4, E7 v4,
+	Core i7-69xx Extreme Edition, Xeon Scalable (Skylake),
+	Xeon Phi [357]200 (Knights Landing), Atom (Goldmont),
+	Atom (Denverton), Future Core (Cannon Lake), Atom (Goldmont Plus),
+	Xeon Phi 7215, 7285 and 7295 (Knights Mill) and
+	7th or 8th gen Core (Kaby Lake, Coffee Lake).
+	  - Print Structured Extended Feature leaf Fn_0007 %ebx on AMD,too.
+	  - Print Fn_0007 %ecx on Intel.
+	  - Print Intel cpuid 7 %edx.
+	  - Parse the TLB info from `cpuid leaf 18H' on Intel processor.
+	  - Use aprint_error_dev() for error output.
+	[msaitoh, ticket #1636]
+



CVS commit: [netbsd-7] src

2018-10-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Oct  9 15:43:38 UTC 2018

Modified Files:
src/sys/arch/x86/include [netbsd-7]: cacheinfo.h cpu.h specialreg.h
src/sys/arch/x86/x86 [netbsd-7]: cpu_topology.c identcpu.c
src/usr.sbin/cpuctl/arch [netbsd-7]: i386.c

Log Message:
Pull up following revision(s) (requested by msaitoh in ticket #1636):
sys/arch/x86/include/cacheinfo.h: 1.23-1.26
sys/arch/x86/include/cpu.h: 1.70
sys/arch/x86/include/specialreg.h: 
1.91-1.93,1.98,1.100,1.102-1.124,1.126,1.130 via patch
sys/arch/x86/x86/cpu_topology.c: 1.10
sys/arch/x86/x86/identcpu.c: 1.56-1.57,1.70 via patch
usr.sbin/cpuctl/arch/i386.c: 1.71,1.75-1.79,1.81-1.85 via patch
Add some register definitions for x86:
  - Add CLWB bit.
  - Fix a few (unused) MSR values, and add some bit definitions of
MSR_EFER from Murray Armfield in PR#42861.
  - CPUID_CFLUSH bit is not for CFLUSH insn but CLFLUSH insn, so modify
comments and snprintb() string.
  - Define CPUID Fn0001 %ebx bits and use them.
No functional change.
  - Add Structured Extended Flags Enumeration Leaf's bit definitions:
AVX512_{IFMA,VBMI2,VNNI,BITALG,VPOPCNTDQ,4VNNIW,4FMAPS},GFNI
  - Add Turbo Boost Max Technology 3.0 bit.
  - Add AMD SVM features definitions.
  - Add Intel cpuid 7 %edx IBRS and STIBP bit definitions.
  - Fix swapped comments for EFER LME and LMA
  - Add Intel cpuid 7 %edx bit 29 IA32_ARCH_CAPABILITIES supported bit.
  - Add MSR_IA32_ARCH_CAPABILITIES definition.
  - Add IA32_SPEC_CTRL MSR and IA32_PRED_CMD MSR.
  - Add Intel Deterministic Address Translation Parameter Leaf(0x18)
definitions.
  - s/CLFUSH/CLFLUSH/
  - Add AMD's Disable Indirect Branch Predictor bit definition.
  - Add the MSR bits definitions for IBRS, STIBP and IBPB.
  - Add Intel Fn_0006 %eax new bit 14-20 (HWP stuff).
  - Intel Fn_0007 %ecx bit 22 is for both RDPID and IA32_TSC_AUX.
  - Add AMD's CPUID Fn8001 %edx MMX and FXSR bit definitions.
  - Add RDCL_NO and IBRS_ALL.
  - Add SSBD and RSBA bit definitions.
  - Add AMD's SSB bit definitions for F15H, F16H and F17H.
  - Add cpuid 7 edx L1D_FLUSH bit.
  - Add IA32_ARCH_SKIP_L1DFL_VMENTRY bit.
  - Add IA32_FLUSH_CMD MSR.
  - Add yet another Shared L2 TLB (2M/4M pages).
  - Add 3way and 6way of L2 cache or TLB on AMD CPU.
  - AMD L3 cache association bitfield is not 8bit but 4bit like others
association bitfields.
  - Sort entries. No functional change.
  - Modify comment, fix typo in comment and add comment.
cpuctl(8):
  - Add detection for Quark X1000, Xeon E5 v4, E7 v4,
Core i7-69xx Extreme Edition, Xeon Scalable (Skylake),
Xeon Phi [357]200 (Knights Landing), Atom (Goldmont),
Atom (Denverton), Future Core (Cannon Lake), Atom (Goldmont Plus),
Xeon Phi 7215, 7285 and 7295 (Knights Mill) and
7th or 8th gen Core (Kaby Lake, Coffee Lake).
  - Print Structured Extended Feature leaf Fn_0007 %ebx on AMD,too.
  - Print Fn_0007 %ecx on Intel.
  - Print Intel cpuid 7 %edx.
  - Parse the TLB info from `cpuid leaf 18H' on Intel processor.
  - Use aprint_error_dev() for error output.


To generate a diff of this commit:
cvs rdiff -u -r1.18.2.3 -r1.18.2.4 src/sys/arch/x86/include/cacheinfo.h
cvs rdiff -u -r1.66.4.1 -r1.66.4.2 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.78.4.5 -r1.78.4.6 src/sys/arch/x86/include/specialreg.h
cvs rdiff -u -r1.9 -r1.9.4.1 src/sys/arch/x86/x86/cpu_topology.c
cvs rdiff -u -r1.45.2.2 -r1.45.2.3 src/sys/arch/x86/x86/identcpu.c
cvs rdiff -u -r1.58.2.6 -r1.58.2.7 src/usr.sbin/cpuctl/arch/i386.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/cacheinfo.h
diff -u src/sys/arch/x86/include/cacheinfo.h:1.18.2.3 src/sys/arch/x86/include/cacheinfo.h:1.18.2.4
--- src/sys/arch/x86/include/cacheinfo.h:1.18.2.3	Thu Dec  8 00:15:25 2016
+++ src/sys/arch/x86/include/cacheinfo.h	Tue Oct  9 15:43:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: cacheinfo.h,v 1.18.2.3 2016/12/08 00:15:25 snj Exp $	*/
+/*	$NetBSD: cacheinfo.h,v 1.18.2.4 2018/10/09 15:43:38 snj Exp $	*/
 
 #ifndef _X86_CACHEINFO_H_
 #define _X86_CACHEINFO_H_
@@ -35,9 +35,10 @@ struct x86_cache_info {
 #define CAI_L2_DTLB2	15		/* L2 Data TLB (2/4M pages) */
 #define CAI_L2_STLB	16		/* Shared L2 TLB (4K pages) */
 #define CAI_L2_STLB2	17		/* Shared L2 TLB (4K/2M pages) */
-#define CAI_PREFETCH	18		/* Prefetch */
+#define CAI_L2_STLB3	18		/* Shared L2 TLB (2M/4M pages) */
+#define CAI_PREFETCH	19		/* Prefetch */
 
-#define	CAI_COUNT	19
+#define	CAI_COUNT	20
 
 /*
  * AMD Cache Info:
@@ -139,7 +140,7 @@ struct x86_cache_info {
 
 /* L3 Cache */
 #define AMD_L3_EDX_C_SIZE(x)		x) >> 18) & 0x) * 1024 * 512)
-#define AMD_L3_EDX_C_ASSOC(x)		 (((x) >> 12) & 0xff)
+#define AMD_L3_EDX_C_ASSOC(x)		 (((x) >> 12) & 0xf)
 #define AMD_L3_EDX_C_LPT(x)		 (((x) >> 8)  & 0xf)
 #define AMD_L3_EDX_C_LS(x)		 ( (x)& 

CVS commit: [netbsd-7] src

2018-10-09 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Tue Oct  9 15:50:03 UTC 2018

Modified Files:
src/doc [netbsd-7]: README.files
src/gnu/usr.bin/groff/tmac [netbsd-7]: mdoc.local
src/sys/sys [netbsd-7]: param.h
Added Files:
src/doc [netbsd-7]: CHANGES-7.3

Log Message:
hello there, 7.2_STABLE


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1.2.1 src/doc/CHANGES-7.3
cvs rdiff -u -r1.5.12.4 -r1.5.12.5 src/doc/README.files
cvs rdiff -u -r1.75.4.7 -r1.75.4.8 src/gnu/usr.bin/groff/tmac/mdoc.local
cvs rdiff -u -r1.459.2.12 -r1.459.2.13 src/sys/sys/param.h

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

Modified files:

Index: src/doc/README.files
diff -u src/doc/README.files:1.5.12.4 src/doc/README.files:1.5.12.5
--- src/doc/README.files:1.5.12.4	Wed Mar 15 06:26:31 2017
+++ src/doc/README.files	Tue Oct  9 15:50:03 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: README.files,v 1.5.12.4 2017/03/15 06:26:31 snj Exp $
+#	$NetBSD: README.files,v 1.5.12.5 2018/10/09 15:50:03 snj Exp $
 
 What's in this directory:
 
@@ -11,6 +11,8 @@ CHANGES-7.1	Changes between the 7.0 and 
 
 CHANGES-7.2	Changes between the 7.1 and 7.2 releases.
 
+CHANGES-7.3	Changes between the 7.2 and 7.3 releases.
+
 CHANGES.prev	Changes in previous NetBSD releases.
 
 LAST_MINUTE	Last minute changes and notes about the release.
@@ -33,7 +35,7 @@ source/patches/	Post-release source code
 
 In addition to the files and directories listed above, there is one
 directory per architecture, for each of the architectures for which
-NetBSD 7.2 has a binary distribution.  The contents of each
+NetBSD 7.3 has a binary distribution.  The contents of each
 architecture's directory are described in an "INSTALL" file found in
 that directory.
 

Index: src/gnu/usr.bin/groff/tmac/mdoc.local
diff -u src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.7 src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.8
--- src/gnu/usr.bin/groff/tmac/mdoc.local:1.75.4.7	Wed Aug 29 15:40:37 2018
+++ src/gnu/usr.bin/groff/tmac/mdoc.local	Tue Oct  9 15:50:03 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: mdoc.local,v 1.75.4.7 2018/08/29 15:40:37 martin Exp $
+.\" $NetBSD: mdoc.local,v 1.75.4.8 2018/10/09 15:50:03 snj Exp $
 .\"
 .\" Copyright (c) 2003, 2004 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -44,9 +44,9 @@
 .as doc-str-St--ieee1275-94 " (\*[Lq]\*[doc-Tn-font-size]Open Firmware\*[doc-str-St]\*[Rq])
 .
 .\" Default .Os value
-.ds doc-operating-system NetBSD\~7.1_STABLE
+.ds doc-operating-system NetBSD\~7.2_STABLE
 .\" Default footer operating system value
-.ds doc-default-operating-system NetBSD\~7.1_STABLE
+.ds doc-default-operating-system NetBSD\~7.2_STABLE
 .\" Other known versions, not yet in groff distribution
 .ds doc-operating-system-NetBSD-1.3.3  1.3.3
 .ds doc-operating-system-NetBSD-1.6.3  1.6.3

Index: src/sys/sys/param.h
diff -u src/sys/sys/param.h:1.459.2.12 src/sys/sys/param.h:1.459.2.13
--- src/sys/sys/param.h:1.459.2.12	Wed Aug 29 13:27:28 2018
+++ src/sys/sys/param.h	Tue Oct  9 15:50:03 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.459.2.12 2018/08/29 13:27:28 martin Exp $	*/
+/*	$NetBSD: param.h,v 1.459.2.13 2018/10/09 15:50:03 snj Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -63,7 +63,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	70200	/* NetBSD 7.2 */
+#define	__NetBSD_Version__	70200	/* NetBSD 7.2_STABLE */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)

Added files:

Index: src/doc/CHANGES-7.3
diff -u /dev/null src/doc/CHANGES-7.3:1.1.2.1
--- /dev/null	Tue Oct  9 15:50:03 2018
+++ src/doc/CHANGES-7.3	Tue Oct  9 15:50:03 2018
@@ -0,0 +1,12 @@
+# $NetBSD: CHANGES-7.3,v 1.1.2.1 2018/10/09 15:50:03 snj Exp $
+
+A complete list of changes from the NetBSD 7.2 release to the NetBSD 7.3
+release:
+
+doc/README.filespatched by hand
+gnu/usr.bin/groff/tmac/mdoc.local		patched by hand
+sys/sys/param.h	patched by hand
+
+	Welcome to 7.2_STABLE.
+	[snj]
+



CVS commit: src/lib/libc/hash/sha2

2018-10-09 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Oct  9 11:36:35 UTC 2018

Modified Files:
src/lib/libc/hash/sha2: sha2.3

Log Message:
Drop Pad functions from sha2(3)

This man-page first appeared before porting all the features to NetBSD and
actually Pad ones were never ported. Keeping it in the documentation is
misleading and actually caused bugs in handling of these functions in 3rd
party software.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/lib/libc/hash/sha2/sha2.3

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

Modified files:

Index: src/lib/libc/hash/sha2/sha2.3
diff -u src/lib/libc/hash/sha2/sha2.3:1.8 src/lib/libc/hash/sha2/sha2.3:1.9
--- src/lib/libc/hash/sha2/sha2.3:1.8	Mon Oct 30 15:44:29 2017
+++ src/lib/libc/hash/sha2/sha2.3	Tue Oct  9 11:36:35 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: sha2.3,v 1.8 2017/10/30 15:44:29 wiz Exp $
+.\" $NetBSD: sha2.3,v 1.9 2018/10/09 11:36:35 kamil Exp $
 .\"	$OpenBSD: sha2.3,v 1.11 2004/06/22 01:57:29 jfb Exp $
 .\"
 .\" Copyright (c) 2003, 2004 Todd C. Miller 
@@ -21,13 +21,12 @@
 .\"
 .\" See http://www.nist.gov/sha/ for the detailed standard
 .\"
-.Dd May 20, 2009
+.Dd October 9, 2018
 .Dt SHA2 3
 .Os
 .Sh NAME
 .Nm SHA224_Init ,
 .Nm SHA224_Update ,
-.Nm SHA224_Pad ,
 .Nm SHA224_Final ,
 .Nm SHA224_Transform ,
 .Nm SHA224_End ,
@@ -36,7 +35,6 @@
 .Nm SHA224_Data ,
 .Nm SHA256_Init ,
 .Nm SHA256_Update ,
-.Nm SHA256_Pad ,
 .Nm SHA256_Final ,
 .Nm SHA256_Transform ,
 .Nm SHA256_End ,
@@ -45,7 +43,6 @@
 .Nm SHA256_Data ,
 .Nm SHA384_Init ,
 .Nm SHA384_Update ,
-.Nm SHA384_Pad ,
 .Nm SHA384_Final ,
 .Nm SHA384_Transform ,
 .Nm SHA384_End ,
@@ -54,7 +51,6 @@
 .Nm SHA384_Data ,
 .Nm SHA512_Init ,
 .Nm SHA512_Update ,
-.Nm SHA512_Pad ,
 .Nm SHA512_Final ,
 .Nm SHA512_Transform ,
 .Nm SHA512_End ,
@@ -70,8 +66,6 @@
 .Ft void
 .Fn SHA224_Update "SHA224_CTX *context" "const uint8_t *data" "size_t len"
 .Ft void
-.Fn SHA224_Pad "SHA224_CTX *context"
-.Ft void
 .Fn SHA224_Final "uint8_t digest[SHA224_DIGEST_LENGTH]" "SHA224_CTX *context"
 .Ft void
 .Fn SHA224_Transform "uint32_t state[8]" "const uint8_t buffer[SHA224_BLOCK_LENGTH]"
@@ -88,8 +82,6 @@
 .Ft void
 .Fn SHA256_Update "SHA256_CTX *context" "const uint8_t *data" "size_t len"
 .Ft void
-.Fn SHA256_Pad "SHA256_CTX *context"
-.Ft void
 .Fn SHA256_Final "uint8_t digest[SHA256_DIGEST_LENGTH]" "SHA256_CTX *context"
 .Ft void
 .Fn SHA256_Transform "uint32_t state[8]" "const uint8_t buffer[SHA256_BLOCK_LENGTH]"
@@ -106,8 +98,6 @@
 .Ft void
 .Fn SHA384_Update "SHA384_CTX *context" "const uint8_t *data" "size_t len"
 .Ft void
-.Fn SHA384_Pad "SHA384_CTX *context"
-.Ft void
 .Fn SHA384_Final "uint8_t digest[SHA384_DIGEST_LENGTH]" "SHA384_CTX *context"
 .Ft void
 .Fn SHA384_Transform "uint64_t state[8]" "const uint8_t buffer[SHA384_BLOCK_LENGTH]"
@@ -124,8 +114,6 @@
 .Ft void
 .Fn SHA512_Update "SHA512_CTX *context" "const uint8_t *data" "size_t len"
 .Ft void
-.Fn SHA512_Pad "SHA512_CTX *context"
-.Ft void
 .Fn SHA512_Final "uint8_t digest[SHA512_DIGEST_LENGTH]" "SHA512_CTX *context"
 .Ft void
 .Fn SHA512_Transform "uint64_t state[8]" "const uint8_t buffer[SHA512_BLOCK_LENGTH]"
@@ -179,13 +167,6 @@ and stores a message digest in the
 parameter.
 .Pp
 The
-.Fn SHA256_Pad
-function can be used to apply padding to the message digest as in
-.Fn SHA256_Final ,
-but the current context can still be used with
-.Fn SHA256_Update .
-.Pp
-The
 .Fn SHA256_Transform
 function is used by
 .Fn SHA256_Update



CVS commit: [netbsd-8] src/doc

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 10:11:08 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Tickets #1050 - #1053


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.31 -r1.1.2.32 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.31 src/doc/CHANGES-8.1:1.1.2.32
--- src/doc/CHANGES-8.1:1.1.2.31	Tue Oct  9 09:46:09 2018
+++ src/doc/CHANGES-8.1	Tue Oct  9 10:11:08 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.31 2018/10/09 09:46:09 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.32 2018/10/09 10:11:08 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1226,3 +1226,37 @@ lib/libcurses/slk.c1.3,1.4
 	curses: once __slk_init is called, reset slk_fmt.
 	[roy, ticket #1048]
 
+bin/sh/jobs.c	1.101
+
+	A change in rev 1.91 interacted badly with the way that showjobs()
+	worked, preventing $(jobs) (and more usefully $(jobs -p) from
+	working.   Fix that.
+	[kre, ticket #1050]
+
+sbin/fsck_ffs/setup.c1.102
+
+	Add a test for duplicate inodes on the persistent snapshot list.
+	[hannken, ticket #1051]
+
+distrib/sets/lists/comp/mi			1.2233
+share/man/man9/Makefile1.431
+share/man/man9/fstrans.9			1.27
+sys/dev/vnd.c	1.266
+sys/kern/vfs_trans.c1.51
+sys/miscfs/genfs/genfs_vfsops.c			1.8
+sys/rump/librump/rumpkern/emul.c		1.187
+sys/sys/fstrans.h1.12
+
+	Fix for PR kern/53624 (dom0 freeze on domU exit):
+	Bring back three state file system suspension:
+	 NORMAL -> SUSPENDING -> SUSPENDED
+	and add operation fstrans_start_lazy() that only blocks while
+	SUSPENDED.
+	[hannken, ticket #1052]
+
+sys/dev/hdaudio/hdafg.c1.16
+
+	Fix hdaudio device configuration for COP_AWCAP_TYPE_PIN_COMPLEX,
+	to make e.g. the built-in speaker work on Dell OptiPlex 5060.
+	[manu, ticket #1053]
+



CVS commit: [netbsd-8] src/sys/dev/hdaudio

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 10:09:52 UTC 2018

Modified Files:
src/sys/dev/hdaudio [netbsd-8]: hdafg.c

Log Message:
Pull up following revision(s) (requested by manu in ticket #1053):

sys/dev/hdaudio/hdafg.c: revision 1.16

Fix hdaudio device configuration

When disabling unassociated devices, we have a special handling
for pins of type COP_AWCAP_TYPE_PIN_COMPLEX, but it came after code
that may disable any pins, including the ones that should be handled
as COP_AWCAP_TYPE_PIN_COMPLEX.

The result was that hdaudio could fail to detect some devices.  We
fix the situation by making sure that COP_AWCAP_TYPE_PIN_COMPLEX
pins always get their specific handling.

The change makes the built-in speaker work on Dell OptiPlex 5060


To generate a diff of this commit:
cvs rdiff -u -r1.12.2.1 -r1.12.2.2 src/sys/dev/hdaudio/hdafg.c

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

Modified files:

Index: src/sys/dev/hdaudio/hdafg.c
diff -u src/sys/dev/hdaudio/hdafg.c:1.12.2.1 src/sys/dev/hdaudio/hdafg.c:1.12.2.2
--- src/sys/dev/hdaudio/hdafg.c:1.12.2.1	Sun Aug 20 04:50:38 2017
+++ src/sys/dev/hdaudio/hdafg.c	Tue Oct  9 10:09:51 2018
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.12.2.1 2017/08/20 04:50:38 snj Exp $ */
+/* $NetBSD: hdafg.c,v 1.12.2.2 2018/10/09 10:09:51 martin Exp $ */
 
 /*
  * Copyright (c) 2009 Precedence Technologies Ltd 
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.12.2.1 2017/08/20 04:50:38 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.12.2.2 2018/10/09 10:09:51 martin Exp $");
 
 #include 
 #include 
@@ -2106,25 +2106,25 @@ hdafg_disable_unassoc(struct hdafg_softc
 	struct hdaudio_control *ctl;
 	int i, j, k;
 
-	/* Disable unassociated widgets */
 	for (i = sc->sc_startnode; i < sc->sc_endnode; i++) {
 		w = hdafg_widget_lookup(sc, i);
 		if (w == NULL || w->w_enable == false)
 			continue;
-		if (w->w_bindas == -1) {
-			w->w_enable = 0;
-			hda_trace(sc, "disable %02X [unassociated]\n",
-			w->w_nid);
+		
+		/* Disable unassociated widgets */
+		if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX) {
+			if (w->w_bindas == -1) {
+w->w_enable = 0;
+hda_trace(sc, "disable %02X [unassociated]\n",
+w->w_nid);
+			}
+			continue;
 		}
-	}
 
-	/* Disable input connections on input pin and output on output */
-	for (i = sc->sc_startnode; i < sc->sc_endnode; i++) {
-		w = hdafg_widget_lookup(sc, i);
-		if (w == NULL || w->w_enable == false)
-			continue;
-		if (w->w_type != COP_AWCAP_TYPE_PIN_COMPLEX)
-			continue;
+		/*
+		 * Disable input connections on input pin
+		 * and output on output pin
+		 */
 		if (w->w_bindas < 0)
 			continue;
 		if (as[w->w_bindas].as_dir == HDAUDIO_PINDIR_IN) {



CVS commit: [netbsd-8] src/lib/libcurses

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 10:01:38 UTC 2018

Modified Files:
src/lib/libcurses [netbsd-8]: newwin.c refresh.c

Log Message:
Back out the following revision(s) (requested by roy in ticket #1049):

lib/libcurses/refresh.c: revision 1.89
lib/libcurses/newwin.c: revision 1.53

  curses: allow drawing the lowest right hand cell of the terminal

  This is a historical behaviour that needs fixing
  If any terminal does scroll when drawing in the lowest right hand cell
  of the terminal then an entry should be made in the terminfo database
  (currently there is no standard code) to state that and define
  __SCROLLWIN as before.

  Fixes PR# 30978.

As discussed in the PR, this change introduces a regression.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.2 -r1.50.6.3 src/lib/libcurses/newwin.c
cvs rdiff -u -r1.88.4.1 -r1.88.4.2 src/lib/libcurses/refresh.c

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

Modified files:

Index: src/lib/libcurses/newwin.c
diff -u src/lib/libcurses/newwin.c:1.50.6.2 src/lib/libcurses/newwin.c:1.50.6.3
--- src/lib/libcurses/newwin.c:1.50.6.2	Tue Oct  9 09:49:35 2018
+++ src/lib/libcurses/newwin.c	Tue Oct  9 10:01:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: newwin.c,v 1.50.6.2 2018/10/09 09:49:35 martin Exp $	*/
+/*	$NetBSD: newwin.c,v 1.50.6.3 2018/10/09 10:01:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)newwin.c	8.3 (Berkeley) 7/27/94";
 #else
-__RCSID("$NetBSD: newwin.c,v 1.50.6.2 2018/10/09 09:49:35 martin Exp $");
+__RCSID("$NetBSD: newwin.c,v 1.50.6.3 2018/10/09 10:01:38 martin Exp $");
 #endif
 #endif/* not lint */
 
@@ -422,14 +422,8 @@ __swflags(WINDOW *win)
 		win->flags |= __ENDLINE;
 		if (win->begx == 0 && win->maxy == LINES && win->begy == 0)
 			win->flags |= __FULLWIN;
-		/*
-		 * Enable this if we have a terminfo setting which claims
-		 * terminal will scroll. Currently there is none.
-		 */
-#if 0
 		if (win->begy + win->maxy == LINES)
 			win->flags |= __SCROLLWIN;
-#endif
 	}
 }
 

Index: src/lib/libcurses/refresh.c
diff -u src/lib/libcurses/refresh.c:1.88.4.1 src/lib/libcurses/refresh.c:1.88.4.2
--- src/lib/libcurses/refresh.c:1.88.4.1	Tue Oct  9 09:49:35 2018
+++ src/lib/libcurses/refresh.c	Tue Oct  9 10:01:38 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.88.4.1 2018/10/09 09:49:35 martin Exp $	*/
+/*	$NetBSD: refresh.c,v 1.88.4.2 2018/10/09 10:01:38 martin Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c	8.7 (Berkeley) 8/13/94";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.88.4.1 2018/10/09 09:49:35 martin Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.88.4.2 2018/10/09 10:01:38 martin Exp $");
 #endif
 #endif/* not lint */
 
@@ -1208,46 +1208,50 @@ makech(int wy)
 			wx++;
 			if (wx >= win->maxx &&
 			wy == win->maxy - 1 && !_cursesi_screen->curwin) {
-if (win->flags & __ENDLINE)
-	__unsetattr(1);
-if (!(win->flags & __SCROLLWIN)) {
-	if (!_cursesi_screen->curwin) {
-		csp->attr = nsp->attr;
-		csp->ch = nsp->ch;
+if (win->flags & __SCROLLOK) {
+	if (win->flags & __ENDLINE)
+		__unsetattr(1);
+	if (!(win->flags & __SCROLLWIN)) {
+		if (!_cursesi_screen->curwin) {
+			csp->attr = nsp->attr;
+			csp->ch = nsp->ch;
 #ifdef HAVE_WCHAR
-		if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR)
-			return ERR;
+			if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR)
+return ERR;
 #endif /* HAVE_WCHAR */
-	}
+		}
 #ifndef HAVE_WCHAR
-	__cputchar((int) nsp->ch);
+		__cputchar((int) nsp->ch);
 #else
-	if ( WCOL( *nsp ) > 0 ) {
-		__cputwchar((int)nsp->ch);
+		if ( WCOL( *nsp ) > 0 ) {
+			__cputwchar((int)nsp->ch);
 #ifdef DEBUG
-		__CTRACE(__CTRACE_REFRESH,
-		"makech: (%d,%d)putwchar(0x%x)\n",
-			wy, wx - 1,
-			nsp->ch );
+			__CTRACE(__CTRACE_REFRESH,
+			"makech: (%d,%d)putwchar(0x%x)\n",
+wy, wx - 1,
+nsp->ch );
 #endif /* DEBUG */
-		/*
-		 * Output non-spacing
-		 * characters for the
-		 * cell.
-		 */
-		__cursesi_putnsp(nsp->nsp, wy, wx);
-	}
+			/*
+			 * Output non-spacing
+			 * characters for the
+			 * cell.
+			 */
+			__cursesi_putnsp(nsp->nsp,
+	 wy, wx);
+
+		}
 #endif /* HAVE_WCHAR */
+	}
+	if (wx < curscr->maxx) {
+		domvcur(win,
+		_cursesi_screen->ly, wx,
+		(int)(win->maxy - 1),
+		(int)(win->maxx - 1));
+	}
+	_cursesi_screen->ly = win->maxy - 1;
+	_cursesi_screen->lx = win->maxx - 1;
+	return (OK);
 }
-if (wx < curscr->maxx) {
-	domvcur(win,
-	_cursesi_screen->ly, wx,
-	(int)(win->maxy - 1),
-	(int)(win->maxx - 1));
-}
-_cursesi_screen->ly = win->maxy - 1;
-_cursesi_screen->lx = 

CVS commit: [netbsd-8] src

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 09:58:09 UTC 2018

Modified Files:
src/distrib/sets/lists/comp [netbsd-8]: mi
src/share/man/man9 [netbsd-8]: Makefile fstrans.9
src/sys/dev [netbsd-8]: vnd.c
src/sys/kern [netbsd-8]: vfs_trans.c
src/sys/miscfs/genfs [netbsd-8]: genfs_vfsops.c
src/sys/rump/librump/rumpkern [netbsd-8]: emul.c
src/sys/sys [netbsd-8]: fstrans.h

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1052):

sys/kern/vfs_trans.c: revision 1.51
distrib/sets/lists/comp/mi: revision 1.2233
share/man/man9/fstrans.9: revision 1.27
share/man/man9/Makefile: revision 1.431
sys/sys/fstrans.h: revision 1.12
sys/rump/librump/rumpkern/emul.c: revision 1.187
sys/dev/vnd.c: revision 1.266
sys/miscfs/genfs/genfs_vfsops.c: revision 1.8

Bring back three state file system suspension:

 NORMAL -> SUSPENDING -> SUSPENDED

and add operation fstrans_start_lazy() that only blocks while SUSPENDED.

Change vndthread() support operation handle_with_rdwr() to bracket
its file system operations by fstrans_start_lazy() and fstrans_done().

PR kern/53624 (dom0 freeze on domU exit)


To generate a diff of this commit:
cvs rdiff -u -r1.2138.2.6 -r1.2138.2.7 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.414.2.1 -r1.414.2.2 src/share/man/man9/Makefile
cvs rdiff -u -r1.24.2.1 -r1.24.2.2 src/share/man/man9/fstrans.9
cvs rdiff -u -r1.259.6.1 -r1.259.6.2 src/sys/dev/vnd.c
cvs rdiff -u -r1.45.2.2 -r1.45.2.3 src/sys/kern/vfs_trans.c
cvs rdiff -u -r1.7 -r1.7.2.1 src/sys/miscfs/genfs/genfs_vfsops.c
cvs rdiff -u -r1.181.6.2 -r1.181.6.3 src/sys/rump/librump/rumpkern/emul.c
cvs rdiff -u -r1.10.60.1 -r1.10.60.2 src/sys/sys/fstrans.h

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

Modified files:

Index: src/distrib/sets/lists/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.2138.2.6 src/distrib/sets/lists/comp/mi:1.2138.2.7
--- src/distrib/sets/lists/comp/mi:1.2138.2.6	Thu Jun  7 18:24:15 2018
+++ src/distrib/sets/lists/comp/mi	Tue Oct  9 09:58:08 2018
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.2138.2.6 2018/06/07 18:24:15 martin Exp $
+#	$NetBSD: mi,v 1.2138.2.7 2018/10/09 09:58:08 martin Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 ./etc/mtree/set.compcomp-sys-root
@@ -10567,6 +10567,7 @@
 ./usr/share/man/cat9/fstrans_is_owner.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/fstrans_setstate.0		comp-sys-catman		.cat
 ./usr/share/man/cat9/fstrans_start.0		comp-sys-catman		.cat
+./usr/share/man/cat9/fstrans_start_lazy.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/fstrans_start_nowait.0	comp-sys-catman		.cat
 ./usr/share/man/cat9/fubyte.0			comp-sys-catman		.cat
 ./usr/share/man/cat9/fuibyte.0			comp-sys-catman		.cat
@@ -18033,6 +18034,7 @@
 ./usr/share/man/html9/fstrans_is_owner.html	comp-sys-htmlman	html
 ./usr/share/man/html9/fstrans_setstate.html	comp-sys-htmlman	html
 ./usr/share/man/html9/fstrans_start.html	comp-sys-htmlman	html
+./usr/share/man/html9/fstrans_start_lazy.html	comp-sys-htmlman	html
 ./usr/share/man/html9/fstrans_start_nowait.html comp-sys-htmlman	html
 ./usr/share/man/html9/fubyte.html		comp-sys-htmlman	html
 ./usr/share/man/html9/fuibyte.html		comp-sys-htmlman	html
@@ -25645,6 +25647,7 @@
 ./usr/share/man/man9/fstrans_is_owner.9		comp-sys-man		.man
 ./usr/share/man/man9/fstrans_setstate.9		comp-sys-man		.man
 ./usr/share/man/man9/fstrans_start.9		comp-sys-man		.man
+./usr/share/man/man9/fstrans_start_lazy.9	comp-sys-man		.man
 ./usr/share/man/man9/fstrans_start_nowait.9	comp-sys-man		.man
 ./usr/share/man/man9/fubyte.9			comp-sys-man		.man
 ./usr/share/man/man9/fuibyte.9			comp-sys-man		.man

Index: src/share/man/man9/Makefile
diff -u src/share/man/man9/Makefile:1.414.2.1 src/share/man/man9/Makefile:1.414.2.2
--- src/share/man/man9/Makefile:1.414.2.1	Thu Jun  7 18:24:15 2018
+++ src/share/man/man9/Makefile	Tue Oct  9 09:58:09 2018
@@ -1,4 +1,4 @@
-#   $NetBSD: Makefile,v 1.414.2.1 2018/06/07 18:24:15 martin Exp $
+#   $NetBSD: Makefile,v 1.414.2.2 2018/10/09 09:58:09 martin Exp $
 
 #	Makefile for section 9 (kernel function and variable) manual pages.
 
@@ -356,6 +356,7 @@ MLINKS+=fstrans.9 fstrans_done.9 \
 	fstrans.9 fstrans_getstate.9 \
 	fstrans.9 fstrans_setstate.9 \
 	fstrans.9 fstrans_start.9 \
+	fstrans.9 fstrans_start_lazy.9 \
 	fstrans.9 fstrans_start_nowait.9 \
 	fstrans.9 fscow_establish.9 \
 	fstrans.9 fscow_disestablish.9 \

Index: src/share/man/man9/fstrans.9
diff -u src/share/man/man9/fstrans.9:1.24.2.1 src/share/man/man9/fstrans.9:1.24.2.2
--- src/share/man/man9/fstrans.9:1.24.2.1	Sun Jun  4 20:35:01 2017
+++ src/share/man/man9/fstrans.9	Tue Oct  9 09:58:09 2018
@@ -1,4 +1,4 @@
-.\" $NetBSD: fstrans.9,v 1.24.2.1 2017/06/04 20:35:01 bouyer Exp $
+.\" $NetBSD: fstrans.9,v 1.24.2.2 2018/10/09 09:58:09 martin Exp $
 

CVS commit: [netbsd-8] src/sbin/fsck_ffs

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 09:53:20 UTC 2018

Modified Files:
src/sbin/fsck_ffs [netbsd-8]: setup.c

Log Message:
Pull up following revision(s) (requested by hannken in ticket #1051):

sbin/fsck_ffs/setup.c: revision 1.102

Add a test for duplicate inodes on the persistent snapshot list.


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.101.4.1 src/sbin/fsck_ffs/setup.c

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

Modified files:

Index: src/sbin/fsck_ffs/setup.c
diff -u src/sbin/fsck_ffs/setup.c:1.101 src/sbin/fsck_ffs/setup.c:1.101.4.1
--- src/sbin/fsck_ffs/setup.c:1.101	Wed Feb  8 16:11:40 2017
+++ src/sbin/fsck_ffs/setup.c	Tue Oct  9 09:53:20 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: setup.c,v 1.101 2017/02/08 16:11:40 rin Exp $	*/
+/*	$NetBSD: setup.c,v 1.101.4.1 2018/10/09 09:53:20 martin Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)setup.c	8.10 (Berkeley) 5/9/95";
 #else
-__RCSID("$NetBSD: setup.c,v 1.101 2017/02/08 16:11:40 rin Exp $");
+__RCSID("$NetBSD: setup.c,v 1.101.4.1 2018/10/09 09:53:20 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -73,6 +73,7 @@ static int readsb(int);
 #ifndef NO_APPLE_UFS
 static int readappleufs(void);
 #endif
+static int check_snapinum(void);
 
 int16_t sblkpostbl[256];
 
@@ -341,6 +342,14 @@ setup(const char *dev, const char *origd
 			dirty();
 		}
 	}
+	if (check_snapinum()) {
+		if (preen)
+			printf(" (FIXED)\n");
+		if (preen || reply("FIX") == 1) {
+			sbdirty();
+			dirty();
+		}
+	}
 	if (is_ufs2 || sblock->fs_old_inodefmt >= FS_44INODEFMT) {
 		if (sblock->fs_maxfilesize != maxfilesize) {
 			pwarn("INCORRECT MAXFILESIZE=%lld IN SUPERBLOCK",
@@ -1094,3 +1103,42 @@ calcsb(const char *dev, int devfd, struc
 	}
 	return (1);
 }
+
+/*
+ * Test the list of snapshot inode numbers for duplicates and repair.
+ */
+static int
+check_snapinum(void)
+{
+	int loc, loc2, res;
+	int *snapinum = >fs_snapinum[0];
+
+	res = 0;
+ 
+	if (isappleufs)
+		return 0;
+
+	for (loc = 0; loc < FSMAXSNAP; loc++) {
+		if (snapinum[loc] == 0)
+			break;
+		for (loc2 = loc + 1; loc2 < FSMAXSNAP; loc2++) {
+			if (snapinum[loc2] == 0 ||
+			snapinum[loc2] == snapinum[loc])
+break;
+		}
+		if (loc2 >= FSMAXSNAP || snapinum[loc2] == 0)
+			continue;
+		pwarn("SNAPSHOT INODE %u ALREADY ON LIST%s", snapinum[loc2],
+		(res ? "" : "\n"));
+		res = 1;
+		for (loc2 = loc + 1; loc2 < FSMAXSNAP; loc2++) {
+			if (snapinum[loc2] == 0)
+break;
+			snapinum[loc2 - 1] = snapinum[loc2];
+		}
+		snapinum[loc2 - 1] = 0;
+		loc--;
+	}
+
+	return res;
+}



CVS commit: [netbsd-8] src/bin/sh

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 09:51:57 UTC 2018

Modified Files:
src/bin/sh [netbsd-8]: jobs.c

Log Message:
Pull up following revision(s) (requested by kre in ticket #1050):

bin/sh/jobs.c: revision 1.101

A change in rev 1.91 interacted badly with the way that showjobs()
worked, preventing $(jobs) (and more usefully $(jobs -p) from
working.   Fix that.

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.85.2.2 -r1.85.2.3 src/bin/sh/jobs.c

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

Modified files:

Index: src/bin/sh/jobs.c
diff -u src/bin/sh/jobs.c:1.85.2.2 src/bin/sh/jobs.c:1.85.2.3
--- src/bin/sh/jobs.c:1.85.2.2	Fri Nov 17 14:56:52 2017
+++ src/bin/sh/jobs.c	Tue Oct  9 09:51:57 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.85.2.2 2017/11/17 14:56:52 martin Exp $	*/
+/*	$NetBSD: jobs.c,v 1.85.2.3 2018/10/09 09:51:57 martin Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.85.2.2 2017/11/17 14:56:52 martin Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.85.2.3 2018/10/09 09:51:57 martin Exp $");
 #endif
 #endif /* not lint */
 
@@ -578,14 +578,13 @@ showjobs(struct output *out, int mode)
 		silent = 1;
 	}
 #endif
-	if (jobs_invalid)
-		return;
 
 	for (jobno = 1, jp = jobtab ; jobno <= njobs ; jobno++, jp++) {
 		if (!jp->used)
 			continue;
 		if (jp->nprocs == 0) {
-			freejob(jp);
+			if (!jobs_invalid)
+freejob(jp);
 			continue;
 		}
 		if ((mode & SHOW_CHANGED) && !jp->changed)



CVS commit: [netbsd-8] src/lib/libcurses

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 09:49:35 UTC 2018

Modified Files:
src/lib/libcurses [netbsd-8]: newwin.c refresh.c

Log Message:
Pull up following revision(s) (requested by roy in ticket #1049):

lib/libcurses/refresh.c: revision 1.89
lib/libcurses/newwin.c: revision 1.53

curses: allow drawing the lowest right hand cell of the terminal

This is a historical behaviour that needs fixing
If any terminal does scroll when drawing in the lowest right hand cell
of the terminal then an entry should be made in the terminfo database
(currently there is no standard code) to state that and define
__SCROLLWIN as before.

Fixes PR# 30978.


To generate a diff of this commit:
cvs rdiff -u -r1.50.6.1 -r1.50.6.2 src/lib/libcurses/newwin.c
cvs rdiff -u -r1.88 -r1.88.4.1 src/lib/libcurses/refresh.c

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

Modified files:

Index: src/lib/libcurses/newwin.c
diff -u src/lib/libcurses/newwin.c:1.50.6.1 src/lib/libcurses/newwin.c:1.50.6.2
--- src/lib/libcurses/newwin.c:1.50.6.1	Thu Oct  4 10:20:12 2018
+++ src/lib/libcurses/newwin.c	Tue Oct  9 09:49:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: newwin.c,v 1.50.6.1 2018/10/04 10:20:12 martin Exp $	*/
+/*	$NetBSD: newwin.c,v 1.50.6.2 2018/10/09 09:49:35 martin Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)newwin.c	8.3 (Berkeley) 7/27/94";
 #else
-__RCSID("$NetBSD: newwin.c,v 1.50.6.1 2018/10/04 10:20:12 martin Exp $");
+__RCSID("$NetBSD: newwin.c,v 1.50.6.2 2018/10/09 09:49:35 martin Exp $");
 #endif
 #endif/* not lint */
 
@@ -422,8 +422,14 @@ __swflags(WINDOW *win)
 		win->flags |= __ENDLINE;
 		if (win->begx == 0 && win->maxy == LINES && win->begy == 0)
 			win->flags |= __FULLWIN;
+		/*
+		 * Enable this if we have a terminfo setting which claims
+		 * terminal will scroll. Currently there is none.
+		 */
+#if 0
 		if (win->begy + win->maxy == LINES)
 			win->flags |= __SCROLLWIN;
+#endif
 	}
 }
 

Index: src/lib/libcurses/refresh.c
diff -u src/lib/libcurses/refresh.c:1.88 src/lib/libcurses/refresh.c:1.88.4.1
--- src/lib/libcurses/refresh.c:1.88	Mon Mar 20 20:42:39 2017
+++ src/lib/libcurses/refresh.c	Tue Oct  9 09:49:35 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: refresh.c,v 1.88 2017/03/20 20:42:39 christos Exp $	*/
+/*	$NetBSD: refresh.c,v 1.88.4.1 2018/10/09 09:49:35 martin Exp $	*/
 
 /*
  * Copyright (c) 1981, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)refresh.c	8.7 (Berkeley) 8/13/94";
 #else
-__RCSID("$NetBSD: refresh.c,v 1.88 2017/03/20 20:42:39 christos Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.88.4.1 2018/10/09 09:49:35 martin Exp $");
 #endif
 #endif/* not lint */
 
@@ -1208,50 +1208,46 @@ makech(int wy)
 			wx++;
 			if (wx >= win->maxx &&
 			wy == win->maxy - 1 && !_cursesi_screen->curwin) {
-if (win->flags & __SCROLLOK) {
-	if (win->flags & __ENDLINE)
-		__unsetattr(1);
-	if (!(win->flags & __SCROLLWIN)) {
-		if (!_cursesi_screen->curwin) {
-			csp->attr = nsp->attr;
-			csp->ch = nsp->ch;
+if (win->flags & __ENDLINE)
+	__unsetattr(1);
+if (!(win->flags & __SCROLLWIN)) {
+	if (!_cursesi_screen->curwin) {
+		csp->attr = nsp->attr;
+		csp->ch = nsp->ch;
 #ifdef HAVE_WCHAR
-			if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR)
-return ERR;
+		if (_cursesi_copy_nsp(nsp->nsp, csp) == ERR)
+			return ERR;
 #endif /* HAVE_WCHAR */
-		}
+	}
 #ifndef HAVE_WCHAR
-		__cputchar((int) nsp->ch);
+	__cputchar((int) nsp->ch);
 #else
-		if ( WCOL( *nsp ) > 0 ) {
-			__cputwchar((int)nsp->ch);
+	if ( WCOL( *nsp ) > 0 ) {
+		__cputwchar((int)nsp->ch);
 #ifdef DEBUG
-			__CTRACE(__CTRACE_REFRESH,
-			"makech: (%d,%d)putwchar(0x%x)\n",
-wy, wx - 1,
-nsp->ch );
+		__CTRACE(__CTRACE_REFRESH,
+		"makech: (%d,%d)putwchar(0x%x)\n",
+			wy, wx - 1,
+			nsp->ch );
 #endif /* DEBUG */
-			/*
-			 * Output non-spacing
-			 * characters for the
-			 * cell.
-			 */
-			__cursesi_putnsp(nsp->nsp,
-	 wy, wx);
-
-		}
-#endif /* HAVE_WCHAR */
-	}
-	if (wx < curscr->maxx) {
-		domvcur(win,
-		_cursesi_screen->ly, wx,
-		(int)(win->maxy - 1),
-		(int)(win->maxx - 1));
+		/*
+		 * Output non-spacing
+		 * characters for the
+		 * cell.
+		 */
+		__cursesi_putnsp(nsp->nsp, wy, wx);
 	}
-	_cursesi_screen->ly = win->maxy - 1;
-	_cursesi_screen->lx = win->maxx - 1;
-	return (OK);
+#endif /* HAVE_WCHAR */
 }
+if (wx < curscr->maxx) {
+	domvcur(win,
+	_cursesi_screen->ly, wx,
+	(int)(win->maxy - 1),
+	(int)(win->maxx - 1));
+}
+_cursesi_screen->ly = win->maxy - 1;
+_cursesi_screen->lx = win->maxx - 1;
+return OK;
 			}
 			if (wx < win->maxx || wy < win->maxy - 

CVS commit: [netbsd-8] src/doc

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 09:46:10 UTC 2018

Modified Files:
src/doc [netbsd-8]: CHANGES-8.1

Log Message:
Remove entry for backed out ticket #1045


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.30 -r1.1.2.31 src/doc/CHANGES-8.1

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

Modified files:

Index: src/doc/CHANGES-8.1
diff -u src/doc/CHANGES-8.1:1.1.2.30 src/doc/CHANGES-8.1:1.1.2.31
--- src/doc/CHANGES-8.1:1.1.2.30	Mon Oct  8 19:09:18 2018
+++ src/doc/CHANGES-8.1	Tue Oct  9 09:46:09 2018
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.1,v 1.1.2.30 2018/10/08 19:09:18 martin Exp $
+# $NetBSD: CHANGES-8.1,v 1.1.2.31 2018/10/09 09:46:09 martin Exp $
 
 A complete list of changes from the NetBSD 8.0 release to the NetBSD 8.1
 release:
@@ -1191,12 +1191,6 @@ sys/dev/pad/pad.c1.58
 	other than 1 is requested.
 	[nakayama, ticket #1044]
 
-sys/netinet/ip_reass.c1.19
-
-	Hold ip_off and ip_len in the fragment entry, instead of always
-	reading the associated mbuf (and converting to host order).
-	[maxv, ticket #1045]
-
 sys/net/if_bridge.c1.157-1.159
 
 	Fix a bug that checksum of spontaneous packets through a bridge



CVS commit: [netbsd-8] src/sys/netinet

2018-10-09 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Oct  9 09:44:31 UTC 2018

Modified Files:
src/sys/netinet [netbsd-8]: ip_reass.c

Log Message:
Back out the following from ticket #1045 by maxv:

sys/netinet/ip_reass.c  1.19

Faster IPv4 packet reassembly - causes fallout, needs further investigation
(see PR kern/53664)


To generate a diff of this commit:
cvs rdiff -u -r1.11.8.5 -r1.11.8.6 src/sys/netinet/ip_reass.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/netinet/ip_reass.c
diff -u src/sys/netinet/ip_reass.c:1.11.8.5 src/sys/netinet/ip_reass.c:1.11.8.6
--- src/sys/netinet/ip_reass.c:1.11.8.5	Wed Oct  3 17:53:56 2018
+++ src/sys/netinet/ip_reass.c	Tue Oct  9 09:44:31 2018
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_reass.c,v 1.11.8.5 2018/10/03 17:53:56 martin Exp $	*/
+/*	$NetBSD: ip_reass.c,v 1.11.8.6 2018/10/09 09:44:31 martin Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1993
@@ -46,7 +46,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.11.8.5 2018/10/03 17:53:56 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_reass.c,v 1.11.8.6 2018/10/09 09:44:31 martin Exp $");
 
 #include 
 #include 
@@ -80,8 +80,6 @@ typedef struct ipfr_qent {
 	struct ip *		ipqe_ip;
 	struct mbuf *		ipqe_m;
 	bool			ipqe_mff;
-	uint16_t		ipqe_off;
-	uint16_t		ipqe_len;
 } ipfr_qent_t;
 
 TAILQ_HEAD(ipfr_qent_head, ipfr_qent);
@@ -217,7 +215,7 @@ ip_nmbclusters_changed(void)
 struct mbuf *
 ip_reass(ipfr_qent_t *ipqe, ipfr_queue_t *fp, const u_int hash)
 {
-	struct ip *ip = ipqe->ipqe_ip;
+	struct ip *ip = ipqe->ipqe_ip, *qip;
 	const int hlen = ip->ip_hl << 2;
 	struct mbuf *m = ipqe->ipqe_m, *t;
 	int ipsecflags = m->m_flags & (M_DECRYPTED|M_AUTHIPHDR);
@@ -232,6 +230,16 @@ ip_reass(ipfr_qent_t *ipqe, ipfr_queue_t
 	m->m_data += hlen;
 	m->m_len -= hlen;
 
+#ifdef	notyet
+	/* Make sure fragment limit is up-to-date. */
+	CHECK_NMBCLUSTER_PARAMS();
+
+	/* If we have too many fragments, drop the older half. */
+	if (ip_nfrags >= ip_maxfrags) {
+		ip_reass_drophalf(void);
+	}
+#endif
+
 	/*
 	 * We are about to add a fragment; increment frag count.
 	 */
@@ -247,9 +255,9 @@ ip_reass(ipfr_qent_t *ipqe, ipfr_queue_t
 		 * never accept fragments  b) if maxfrag is -1, accept
 		 * all fragments without limitation.
 		 */
-		if (ip_maxfragpackets < 0) {
-			/* no limit */
-		} else if (ip_nfragpackets >= ip_maxfragpackets) {
+		if (ip_maxfragpackets < 0)
+			;
+		else if (ip_nfragpackets >= ip_maxfragpackets) {
 			goto dropfrag;
 		}
 		fp = malloc(sizeof(ipfr_queue_t), M_FTABLE, M_NOWAIT);
@@ -277,7 +285,7 @@ ip_reass(ipfr_qent_t *ipqe, ipfr_queue_t
 	 * Find a segment which begins after this one does.
 	 */
 	TAILQ_FOREACH(q, >ipq_fragq, ipqe_q) {
-		if (q->ipqe_off > ipqe->ipqe_off)
+		if (ntohs(q->ipqe_ip->ip_off) > ntohs(ip->ip_off))
 			break;
 	}
 	if (q != NULL) {
@@ -292,14 +300,15 @@ ip_reass(ipfr_qent_t *ipqe, ipfr_queue_t
 	 * If it provides all of our data, drop us.
 	 */
 	if (p != NULL) {
-		i = p->ipqe_off + p->ipqe_len - ipqe->ipqe_off;
+		i = ntohs(p->ipqe_ip->ip_off) + ntohs(p->ipqe_ip->ip_len) -
+		ntohs(ip->ip_off);
 		if (i > 0) {
-			if (i >= ipqe->ipqe_len) {
+			if (i >= ntohs(ip->ip_len)) {
 goto dropfrag;
 			}
 			m_adj(ipqe->ipqe_m, i);
-			ipqe->ipqe_off = ipqe->ipqe_off + i;
-			ipqe->ipqe_len = ipqe->ipqe_len - i;
+			ip->ip_off = htons(ntohs(ip->ip_off) + i);
+			ip->ip_len = htons(ntohs(ip->ip_len) - i);
 		}
 	}
 
@@ -308,13 +317,17 @@ ip_reass(ipfr_qent_t *ipqe, ipfr_queue_t
 	 * completely covered, dequeue them.
 	 */
 	while (q != NULL) {
-		i = ipqe->ipqe_off + ipqe->ipqe_len - q->ipqe_off;
-		if (i <= 0) {
+		size_t end;
+
+		qip = q->ipqe_ip;
+		end = ntohs(ip->ip_off) + ntohs(ip->ip_len);
+		if (end <= ntohs(qip->ip_off)) {
 			break;
 		}
-		if (i < q->ipqe_len) {
-			q->ipqe_off = q->ipqe_off + i;
-			q->ipqe_len = q->ipqe_len - i;
+		i = end - ntohs(qip->ip_off);
+		if (i < ntohs(qip->ip_len)) {
+			qip->ip_len = htons(ntohs(qip->ip_len) - i);
+			qip->ip_off = htons(ntohs(qip->ip_off) + i);
 			m_adj(q->ipqe_m, i);
 			break;
 		}
@@ -338,11 +351,12 @@ insert:
 	}
 	next = 0;
 	TAILQ_FOREACH(q, >ipq_fragq, ipqe_q) {
-		if (q->ipqe_off != next) {
+		qip = q->ipqe_ip;
+		if (ntohs(qip->ip_off) != next) {
 			mutex_exit(_lock);
 			return NULL;
 		}
-		next += q->ipqe_len;
+		next += ntohs(qip->ip_len);
 	}
 	p = TAILQ_LAST(>ipq_fragq, ipfr_qent_head);
 	if (p->ipqe_mff) {
@@ -637,6 +651,13 @@ ip_reass_packet(struct mbuf **m0, struct
 		return EINVAL;
 	}
 
+	/*
+	 * Adjust total IP length to not reflect header and convert
+	 * offset of this to bytes.  XXX: clobbers struct ip.
+	 */
+	ip->ip_len = htons(flen);
+	ip->ip_off = htons(off);
+
 	/* Look for queue of fragments of this datagram. */
 	mutex_enter(_lock);
 	hash = IPREASS_HASH(ip->ip_src.s_addr, ip->ip_id);
@@ -681,8 +702,6 @@ ip_reass_packet(struct mbuf **m0, struct