Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch Hide {p, v}{addr, size}_t and register_t (and a coupl...



details:   https://anonhg.NetBSD.org/src/rev/e9c869dd4d7a
branches:  trunk
changeset: 343154:e9c869dd4d7a
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jan 23 21:22:13 2016 +0000

description:
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)...

diffstat:

 sys/arch/aarch64/include/types.h  |  17 +++++++++--------
 sys/arch/alpha/include/types.h    |   8 +++-----
 sys/arch/amd64/include/types.h    |   9 +++++----
 sys/arch/arm/include/types.h      |   8 ++++----
 sys/arch/hppa/include/types.h     |  11 +++++++----
 sys/arch/i386/include/types.h     |  12 +++++++-----
 sys/arch/ia64/include/types.h     |   8 ++++----
 sys/arch/m68k/include/types.h     |  10 +++++-----
 sys/arch/mips/include/types.h     |  16 ++++++++++------
 sys/arch/or1k/include/types.h     |  12 ++++++------
 sys/arch/powerpc/include/types.h  |   8 ++++----
 sys/arch/riscv/include/types.h    |  12 ++++++++----
 sys/arch/sh3/include/types.h      |  10 +++++-----
 sys/arch/sparc/include/types.h    |   7 +++++--
 sys/arch/usermode/include/types.h |   6 +++++-
 sys/arch/vax/include/types.h      |   8 ++++----
 16 files changed, 91 insertions(+), 71 deletions(-)

diffs (truncated from 678 to 300 lines):

diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/aarch64/include/types.h
--- a/sys/arch/aarch64/include/types.h  Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/aarch64/include/types.h  Sat Jan 23 21:22:13 2016 +0000
@@ -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
diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/alpha/include/types.h
--- a/sys/arch/alpha/include/types.h    Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/alpha/include/types.h    Sat Jan 23 21:22:13 2016 +0000
@@ -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
diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/amd64/include/types.h
--- a/sys/arch/amd64/include/types.h    Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/amd64/include/types.h    Sat Jan 23 21:22:13 2016 +0000
@@ -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. */
diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/arm/include/types.h
--- a/sys/arch/arm/include/types.h      Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/arm/include/types.h      Sat Jan 23 21:22:13 2016 +0000
@@ -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
diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/hppa/include/types.h
--- a/sys/arch/hppa/include/types.h     Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/hppa/include/types.h     Sat Jan 23 21:22:13 2016 +0000
@@ -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 */
diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/i386/include/types.h
--- a/sys/arch/i386/include/types.h     Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/i386/include/types.h     Sat Jan 23 21:22:13 2016 +0000
@@ -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. */
diff -r 66e41634fd04 -r e9c869dd4d7a sys/arch/ia64/include/types.h
--- a/sys/arch/ia64/include/types.h     Sat Jan 23 21:19:24 2016 +0000
+++ b/sys/arch/ia64/include/types.h     Sat Jan 23 21:22:13 2016 +0000
@@ -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;



Home | Main Index | Thread Index | Old Index