Sat Jan 23 21:22:15 2016 UTC ()
Hide {p,v}{addr,size}_t and register_t (and a couple more types that
are machine-specific) from userland unless _KERNEL/_KMEMUSER and a
new _KERNTYPES variables is defined. The _KERNTYPES should be fixed
for many subsystems that should not be using it (rump)...


(christos)
diff -r1.2 -r1.3 src/sys/arch/aarch64/include/types.h
diff -r1.51 -r1.52 src/sys/arch/alpha/include/types.h
diff -r1.48 -r1.49 src/sys/arch/amd64/include/types.h
diff -r1.30 -r1.31 src/sys/arch/arm/include/types.h
diff -r1.24 -r1.25 src/sys/arch/hppa/include/types.h
diff -r1.83 -r1.84 src/sys/arch/i386/include/types.h
diff -r1.8 -r1.9 src/sys/arch/ia64/include/types.h
diff -r1.31 -r1.32 src/sys/arch/m68k/include/types.h
diff -r1.59 -r1.60 src/sys/arch/mips/include/types.h
diff -r1.2 -r1.3 src/sys/arch/or1k/include/types.h
diff -r1.51 -r1.52 src/sys/arch/powerpc/include/types.h
diff -r1.3 -r1.4 src/sys/arch/riscv/include/types.h
diff -r1.35 -r1.36 src/sys/arch/sh3/include/types.h
diff -r1.64 -r1.65 src/sys/arch/sparc/include/types.h
diff -r1.9 -r1.10 src/sys/arch/usermode/include/types.h
diff -r1.48 -r1.49 src/sys/arch/vax/include/types.h

cvs diff -r1.2 -r1.3 src/sys/arch/aarch64/include/types.h (expand / switch to context diff)
--- src/sys/arch/aarch64/include/types.h 2015/08/27 12:30:50 1.2
+++ src/sys/arch/aarch64/include/types.h 2016/01/23 21:22:13 1.3
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.2 2015/08/27 12:30:50 pooka Exp $ */
+/* $NetBSD: types.h,v 1.3 2016/01/23 21:22:13 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -38,8 +38,13 @@
 #include <sys/featuretest.h>
 #include <aarch64/int_types.h>
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL)
+typedef struct label_t {	/* Used by setjmp & longjmp */
+        register_t lb_reg[13];	/* x19 .. x30, sp */
+} label_t;
+#endif
+
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef	unsigned long	vm_offset_t;	/* depreciated */
 typedef	unsigned long	vm_size_t;	/* depreciated */
 
@@ -53,7 +58,6 @@
 #define PRIxVADDR	"lx"
 #define PRIxVSIZE	"lx"
 #define PRIuVSIZE	"lu"
-#endif
 
 typedef unsigned long long int register_t;
 typedef unsigned int register32_t;
@@ -65,16 +69,13 @@
 typedef unsigned long	pmc_ctr_t;
 typedef unsigned short	tlb_asid_t;
 
-#if defined(_KERNEL)
-typedef struct label_t {	/* Used by setjmp & longjmp */
-        register_t lb_reg[13];	/* x19 .. x30, sp */
-} label_t;
 #endif
          
 /*
  * This should have always been an 8-bit type.
  */
 typedef	unsigned char	__cpu_simple_lock_nv_t;
+typedef unsigned long long int __register_t;
 
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0

cvs diff -r1.51 -r1.52 src/sys/arch/alpha/include/types.h (expand / switch to context diff)
--- src/sys/arch/alpha/include/types.h 2015/08/28 09:30:01 1.51
+++ src/sys/arch/alpha/include/types.h 2016/01/23 21:22:13 1.52
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.51 2015/08/28 09:30:01 pooka Exp $ */
+/* $NetBSD: types.h,v 1.52 2016/01/23 21:22:13 christos Exp $ */
 
 /*-
  * Copyright (c) 1990, 1993
@@ -44,8 +44,7 @@
 } label_t;
 #endif
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long	paddr_t;
 typedef unsigned long	psize_t;
 typedef unsigned long	vaddr_t;
@@ -56,14 +55,13 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef long int	register_t;
-#if defined(_NETBSD_SOURCE)
 #define	PRIxREGISTER	"lx"
 #endif
 
 typedef	int		__cpu_simple_lock_nv_t;
+typedef long int	__register_t;
 
 #define	__SIMPLELOCK_LOCKED	1
 #define	__SIMPLELOCK_UNLOCKED	0

cvs diff -r1.48 -r1.49 src/sys/arch/amd64/include/types.h (expand / switch to context diff)
--- src/sys/arch/amd64/include/types.h 2015/08/27 12:30:50 1.48
+++ src/sys/arch/amd64/include/types.h 2016/01/23 21:22:13 1.49
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.48 2015/08/27 12:30:50 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.49 2016/01/23 21:22:13 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -46,8 +46,7 @@
 } label_t;
 #endif
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long	paddr_t;
 typedef unsigned long	psize_t;
 typedef unsigned long	vaddr_t;
@@ -58,7 +57,6 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef int             pmc_evid_t; 
 typedef __uint64_t      pmc_ctr_t;
@@ -67,6 +65,9 @@
 #define	PRIxREGISTER	"lx"
 #define	PRIxREGISTER32	"x"
 
+#endif
+
+typedef long int		__register_t;
 typedef	unsigned char		__cpu_simple_lock_nv_t;
 
 /* __cpu_simple_lock_t used to be a full word. */

cvs diff -r1.30 -r1.31 src/sys/arch/arm/include/types.h (expand / switch to context diff)
--- src/sys/arch/arm/include/types.h 2015/08/27 12:30:50 1.30
+++ src/sys/arch/arm/include/types.h 2016/01/23 21:22:13 1.31
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.30 2015/08/27 12:30:50 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.31 2016/01/23 21:22:13 christos Exp $	*/
 
 /*
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,8 +44,7 @@
 } label_t;
 #endif
          
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long	paddr_t;
 typedef unsigned long	psize_t;
 typedef unsigned long	vaddr_t;
@@ -56,7 +55,6 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef int		register_t, register32_t;
 #define	PRIxREGISTER	"x"
@@ -65,6 +63,7 @@
 #define PMC_INVALID_EVID	(-1)
 typedef unsigned long	pmc_ctr_t;
 typedef unsigned short	tlb_asid_t;
+#endif
 
 /*
  * This should have always been an 8-bit type, but since it's been exposed
@@ -75,6 +74,7 @@
 #else
 typedef	int		__cpu_simple_lock_nv_t;
 #endif /* _KERNEL */
+typedef	int		__register_t;
 
 #define	__SIMPLELOCK_LOCKED	1
 #define	__SIMPLELOCK_UNLOCKED	0

cvs diff -r1.24 -r1.25 src/sys/arch/hppa/include/types.h (expand / switch to context diff)
--- src/sys/arch/hppa/include/types.h 2015/08/27 12:30:51 1.24
+++ src/sys/arch/hppa/include/types.h 2016/01/23 21:22:13 1.25
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.24 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.25 2016/01/23 21:22:13 christos Exp $	*/
 
 /*	$OpenBSD: types.h,v 1.6 2001/08/11 01:58:34 art Exp $	*/
 
@@ -39,7 +39,6 @@
 #include <sys/cdefs.h>
 #include <sys/featuretest.h>
 
-#if defined(_NETBSD_SOURCE)
 #if defined(_KERNEL)
 typedef struct label_t {
 	int	lbl_rp;
@@ -50,6 +49,7 @@
 } label_t;
 #endif
 
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef	unsigned long		hppa_hpa_t;
 typedef	unsigned long		hppa_spa_t;
 typedef	unsigned int		pa_space_t;
@@ -63,6 +63,9 @@
 #define	PRIxPADDR		"lx"
 #define	PRIxPSIZE		"lx"
 #define	PRIuPSIZE		"lu"
+
+typedef int			register_t;
+#define	PRIxREGISTER		"x"
 #endif
 
 /*
@@ -72,12 +75,12 @@
 	volatile unsigned long csl_lock[4];
 } __cpu_simple_lock_nv_t;
 
+typedef int			__register_t;
 
+
 #define __SIMPLELOCK_LOCKED	{ { 0, 0, 0, 0} }
 #define __SIMPLELOCK_UNLOCKED	{ { 1, 1, 1, 1} }
 
-typedef int			register_t;
-#define	PRIxREGISTER		"x"
 
 #define	__MACHINE_STACK_GROWS_UP	/* stack grows to higher addresses */
 #define	__HAVE_FUNCTION_DESCRIPTORS	/* function ptrs may be descriptors */

cvs diff -r1.83 -r1.84 src/sys/arch/i386/include/types.h (expand / switch to context diff)
--- src/sys/arch/i386/include/types.h 2015/08/27 12:30:51 1.83
+++ src/sys/arch/i386/include/types.h 2016/01/23 21:22:14 1.84
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.83 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.84 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -47,9 +47,7 @@
 } label_t;
 #endif
 
-#if defined(_NETBSD_SOURCE)
 #if defined(_KERNEL)
-
 /*
  * XXX JYM for now, in kernel paddr_t can be 32 or 64 bits, depending
  * on PAE. Revisit when paddr_t becomes 64 bits for !PAE systems.
@@ -68,7 +66,7 @@
 #define	PRIuPSIZE	"lu"
 #endif /* PAE */
 
-#else /* _KERNEL */
+#elif defined(_KMEMUSER) || defined(_KERNTYPES)
 /* paddr_t is always 64 bits for userland */
 typedef __uint64_t	paddr_t;
 typedef __uint64_t	psize_t;
@@ -78,18 +76,22 @@
 
 #endif /* _KERNEL */
 
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
+
 typedef unsigned long	vaddr_t;
 typedef unsigned long	vsize_t;
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif /* _NETBSD_SOURCE */
 
 typedef int		pmc_evid_t;
 typedef __uint64_t	pmc_ctr_t;
 typedef int		register_t;
 #define	PRIxREGISTER	"x"
 
+#endif /* _KERNEL || _KMEMUSER */
+
+typedef int			__register_t;
 typedef	unsigned char		__cpu_simple_lock_nv_t;
 
 /* __cpu_simple_lock_t used to be a full word. */

cvs diff -r1.8 -r1.9 src/sys/arch/ia64/include/types.h (expand / switch to context diff)
--- src/sys/arch/ia64/include/types.h 2015/08/27 12:30:51 1.8
+++ src/sys/arch/ia64/include/types.h 2016/01/23 21:22:14 1.9
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.8 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.9 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,8 +44,7 @@
 } label_t;
 #endif
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long	paddr_t;
 typedef unsigned long	psize_t;
 typedef unsigned long	vaddr_t;
@@ -56,14 +55,15 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef int		pmc_evid_t;
 typedef __uint64_t	pmc_ctr_t;
 typedef long int	register_t;
 #define	PRIxREGISTER	"lx"
+#endif
 
 typedef	int		__cpu_simple_lock_nv_t;
+typedef long int	__register_t;
 
 #define	__SIMPLELOCK_LOCKED	1
 #define	__SIMPLELOCK_UNLOCKED	0

cvs diff -r1.31 -r1.32 src/sys/arch/m68k/include/types.h (expand / switch to context diff)
--- src/sys/arch/m68k/include/types.h 2015/08/27 12:30:51 1.31
+++ src/sys/arch/m68k/include/types.h 2016/01/23 21:22:14 1.32
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.31 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.32 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -43,8 +43,7 @@
 } label_t;
 #endif
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef	unsigned long	vm_offset_t;	/* depreciated */
 typedef	unsigned long	vm_size_t;	/* depreciated */
 
@@ -58,12 +57,13 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef int		register_t;
 #define	PRIxREGISTER	"x"
+#endif
 
-typedef	unsigned char __cpu_simple_lock_nv_t;
+typedef	unsigned char	__cpu_simple_lock_nv_t;
+typedef int		__register_t;
 
 #define	__SIMPLELOCK_LOCKED	0x80	/* result of `tas' insn */
 #define	__SIMPLELOCK_UNLOCKED	0

cvs diff -r1.59 -r1.60 src/sys/arch/mips/include/types.h (expand / switch to context diff)
--- src/sys/arch/mips/include/types.h 2015/08/27 12:30:51 1.59
+++ src/sys/arch/mips/include/types.h 2016/01/23 21:22:14 1.60
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.59 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.60 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -48,8 +48,7 @@
  */
 
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 #if defined(_MIPS_PADDR_T_64BIT) || defined(_LP64)
 typedef __uint64_t	paddr_t;
 typedef __uint64_t	psize_t;
@@ -76,7 +75,6 @@
 #define	PRIxVSIZE	PRIx32
 #define	PRIdVSIZE	PRId32
 #endif
-#endif /* NETBSD_SOURCE */
 
 typedef int		mips_prid_t;
 /* Make sure this is signed; we need pointers to be sign-extended. */
@@ -104,8 +102,9 @@
 #define	PRIxREGISTER	PRIx64
 #define	PRIxUREGISTER	PRIx64
 #endif /* __mips_o32 */
+#endif /* _KERNEL || _KMEMUSER*/
 
-#if defined(_KERNEL) || defined(_NETBSD_SOURCE)
+#if defined(_KERNEL)
 typedef struct label_t {
 	register_t val[14];
 } label_t;
@@ -125,7 +124,7 @@
 #define	_L_SR		13
 
 typedef __uint32_t tlb_asid_t;
-#endif /* defined(_KERNEL) || defined(_NETBSD_SOURCE) */
+#endif /* _KERNEL */
 
 #if defined(_KERNEL) || defined(_KMEMUSER)
 #define	PCU_FPU		0
@@ -134,6 +133,11 @@
 #endif
 
 typedef	unsigned int	__cpu_simple_lock_nv_t;
+#if defined(__mips_o32)
+typedef __int32_t	__register_t;
+#else
+typedef __int64_t	__register_t;
+#endif
 
 #define	__SIMPLELOCK_LOCKED	1
 #define	__SIMPLELOCK_UNLOCKED	0

cvs diff -r1.2 -r1.3 src/sys/arch/or1k/include/types.h (expand / switch to context diff)
--- src/sys/arch/or1k/include/types.h 2015/08/27 12:30:51 1.2
+++ src/sys/arch/or1k/include/types.h 2016/01/23 21:22:14 1.3
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.2 2015/08/27 12:30:51 pooka Exp $ */
+/* $NetBSD: types.h,v 1.3 2016/01/23 21:22:14 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,10 +36,9 @@
 #include <sys/featuretest.h>
 #include <or1k/int_types.h>
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
-typedef	unsigned long	vm_offset_t;	/* depreciated */
-typedef	unsigned long	vm_size_t;	/* depreciated */
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
+typedef	unsigned long	vm_offset_t;	/* deprecated */
+typedef	unsigned long	vm_size_t;	/* deprecated */
 
 typedef __UINTPTR_TYPE__	paddr_t;
 typedef __UINTPTR_TYPE__	psize_t;
@@ -51,7 +50,6 @@
 #define PRIxVADDR	PRIxPTR
 #define PRIxVSIZE	PRIxPTR
 #define PRIuVSIZE	PRIuPTR
-#endif
 
 typedef unsigned long int register_t;
 
@@ -59,6 +57,7 @@
 #define PMC_INVALID_EVID	(-1)
 typedef unsigned long	pmc_ctr_t;
 typedef unsigned short	tlb_asid_t;
+#endif
 
 #if defined(_KERNEL)
 typedef struct label_t {	/* Used by setjmp & longjmp */
@@ -67,6 +66,7 @@
 #endif
          
 typedef	unsigned int	__cpu_simple_lock_nv_t;
+typedef	unsigned long int	__register_t;
 
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0

cvs diff -r1.51 -r1.52 src/sys/arch/powerpc/include/types.h (expand / switch to context diff)
--- src/sys/arch/powerpc/include/types.h 2015/08/27 12:30:51 1.51
+++ src/sys/arch/powerpc/include/types.h 2016/01/23 21:22:14 1.52
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.51 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.52 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (C) 1995 Wolfgang Solfrank.
@@ -38,8 +38,7 @@
 #include <sys/featuretest.h>
 #include <powerpc/int_types.h>
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef	unsigned long	paddr_t, vaddr_t;
 typedef	unsigned long	psize_t, vsize_t;
 #define	PRIxPADDR	"lx"
@@ -48,7 +47,6 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 /*
  * Because lwz etal don't sign extend, it's best to make registers unsigned.
@@ -59,6 +57,7 @@
 #define	PRIxREGISTER	"lx"
 #define	PRIxREGISTER64	PRIx64
 #define	PRIxREGISTER32	PRIx32
+#endif
 
 #if defined(_KERNEL)
 typedef struct label_t {
@@ -69,6 +68,7 @@
 #endif
 
 typedef int __cpu_simple_lock_nv_t;
+typedef unsigned long __register_t;
 
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0

cvs diff -r1.3 -r1.4 src/sys/arch/riscv/include/types.h (expand / switch to context diff)
--- src/sys/arch/riscv/include/types.h 2015/08/27 12:30:51 1.3
+++ src/sys/arch/riscv/include/types.h 2016/01/23 21:22:14 1.4
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.3 2015/08/27 12:30:51 pooka Exp $ */
+/* $NetBSD: types.h,v 1.4 2016/01/23 21:22:14 christos Exp $ */
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -36,8 +36,7 @@
 #include <sys/featuretest.h>
 #include <riscv/int_types.h>
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef __UINTPTR_TYPE__	paddr_t;
 typedef __UINTPTR_TYPE__	psize_t;
 typedef __UINTPTR_TYPE__	vaddr_t;
@@ -48,7 +47,6 @@
 #define PRIxVADDR	PRIxPTR
 #define PRIxVSIZE	PRIxPTR
 #define PRIuVSIZE	PRIuPTR
-#endif
 
 #ifdef _LP64			// match <riscv/reg.h>
 #define PRIxREGISTER	PRIx64
@@ -67,6 +65,7 @@
 #define PMC_INVALID_EVID	(-1)
 typedef unsigned long	pmc_ctr_t;
 typedef unsigned short	tlb_asid_t;
+#endif
 
 #if defined(_KERNEL)
 typedef struct label_t {	/* Used by setjmp & longjmp */
@@ -76,6 +75,11 @@
 #endif
          
 typedef	unsigned int	__cpu_simple_lock_nv_t;
+#ifdef _LP64		
+typedef __int64_t	__register_t;
+#else
+typedef __int32_t	__register_t;
+#endif
 
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0

cvs diff -r1.35 -r1.36 src/sys/arch/sh3/include/types.h (expand / switch to context diff)
--- src/sys/arch/sh3/include/types.h 2015/08/27 12:30:51 1.35
+++ src/sys/arch/sh3/include/types.h 2016/01/23 21:22:14 1.36
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.35 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.36 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,8 +44,7 @@
 } label_t;
 #endif
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef	unsigned long	vm_offset_t;
 typedef	unsigned long	vm_size_t;
 
@@ -59,12 +58,13 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef int		register_t;
 #define	PRIxREGISTER	"x"
+#endif
 
-typedef	unsigned char __cpu_simple_lock_nv_t;
+typedef	unsigned char	__cpu_simple_lock_nv_t;
+typedef	int		__register_t;
 
 #define	__SIMPLELOCK_LOCKED	0x80
 #define	__SIMPLELOCK_UNLOCKED	0

cvs diff -r1.64 -r1.65 src/sys/arch/sparc/include/types.h (expand / switch to context diff)
--- src/sys/arch/sparc/include/types.h 2015/10/06 20:03:05 1.64
+++ src/sys/arch/sparc/include/types.h 2016/01/23 21:22:14 1.65
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.64 2015/10/06 20:03:05 martin Exp $ */
+/*	$NetBSD: types.h,v 1.65 2016/01/23 21:22:14 christos Exp $ */
 
 /*
  * Copyright (c) 1992, 1993
@@ -58,6 +58,7 @@
 #include <machine/int_types.h>
 
 /* The following are unsigned to prevent annoying sign extended pointers. */
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long int	register_t;
 #define	PRIxREGISTER		"lx"
 typedef unsigned int		register32_t;
@@ -70,6 +71,7 @@
 typedef unsigned long long int	register64_t;
 #define	PRIxREGISTER64		"llx"
 #endif
+#endif
 
 #if defined(_KERNEL)
 typedef struct label_t {
@@ -81,7 +83,7 @@
 } label_t;
 #endif
 
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long int	vaddr_t;
 typedef vaddr_t			vsize_t;
 #define	PRIxVADDR		"lx"
@@ -108,6 +110,7 @@
 #endif
 
 typedef	unsigned char		__cpu_simple_lock_nv_t;
+typedef unsigned long int	__register_t;
 
 /* __cpu_simple_lock_t used to be a full word. */
 #define	__CPU_SIMPLE_LOCK_PAD

cvs diff -r1.9 -r1.10 src/sys/arch/usermode/include/types.h (expand / switch to context diff)
--- src/sys/arch/usermode/include/types.h 2015/08/27 12:30:51 1.9
+++ src/sys/arch/usermode/include/types.h 2016/01/23 21:22:14 1.10
@@ -1,4 +1,4 @@
-/* $NetBSD: types.h,v 1.9 2015/08/27 12:30:51 pooka Exp $ */
+/* $NetBSD: types.h,v 1.10 2016/01/23 21:22:14 christos Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill <jmcneill@invisible.ca>
@@ -39,6 +39,7 @@
 } label_t;
 #endif
 
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long	paddr_t;
 typedef unsigned long	psize_t;
 typedef unsigned long	vaddr_t;
@@ -51,8 +52,11 @@
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
 #define	PRIxREGISTER	"lx"
+#endif
 
 typedef unsigned char	__cpu_simple_lock_nv_t;
+typedef long int	__register_t;
+
 #define __CPU_SIMPLE_LOCK_PAD
 
 #define __SIMPLELOCK_LOCKED	1

cvs diff -r1.48 -r1.49 src/sys/arch/vax/include/types.h (expand / switch to context diff)
--- src/sys/arch/vax/include/types.h 2015/08/27 12:30:51 1.48
+++ src/sys/arch/vax/include/types.h 2016/01/23 21:22:14 1.49
@@ -1,4 +1,4 @@
-/*	$NetBSD: types.h,v 1.48 2015/08/27 12:30:51 pooka Exp $	*/
+/*	$NetBSD: types.h,v 1.49 2016/01/23 21:22:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 1990 The Regents of the University of California.
@@ -44,8 +44,7 @@
 } label_t;
 #endif
 
-/* NB: This should probably be if defined(_KERNEL) */
-#if defined(_NETBSD_SOURCE)
+#if defined(_KERNEL) || defined(_KMEMUSER) || defined(_KERNTYPES)
 typedef unsigned long	paddr_t;
 typedef unsigned long	psize_t;
 typedef unsigned long	vaddr_t;
@@ -56,15 +55,16 @@
 #define	PRIxVADDR	"lx"
 #define	PRIxVSIZE	"lx"
 #define	PRIuVSIZE	"lu"
-#endif
 
 typedef int		register_t;
 #define	PRIxREGISTER	"x"
+#endif
 
 /*
  * BBCCI/BBSSI can operate on bytes so let's save some space.
  */
 typedef char	__cpu_simple_lock_nv_t;
+typedef int	__register_t;
 
 #define __SIMPLELOCK_LOCKED	1
 #define __SIMPLELOCK_UNLOCKED	0