Source-Changes-HG archive

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

[src/trunk]: src/sys machine_arch on mips depends on the ABI so we need a rou...



details:   https://anonhg.NetBSD.org/src/rev/da253a1f8b17
branches:  trunk
changeset: 338300:da253a1f8b17
user:      matt <matt%NetBSD.org@localhost>
date:      Sun May 17 18:52:37 2015 +0000

description:
machine_arch on mips depends on the ABI so we need a routine to return
the right value.

diffstat:

 sys/arch/mips/include/netbsd32_machdep.h |   4 +++-
 sys/arch/mips/mips/netbsd32_machdep.c    |  15 +++++++++++++--
 sys/compat/netbsd32/netbsd32_sysctl.c    |  14 ++++++++++++--
 3 files changed, 28 insertions(+), 5 deletions(-)

diffs (97 lines):

diff -r 466173aacc22 -r da253a1f8b17 sys/arch/mips/include/netbsd32_machdep.h
--- a/sys/arch/mips/include/netbsd32_machdep.h  Sun May 17 15:48:57 2015 +0000
+++ b/sys/arch/mips/include/netbsd32_machdep.h  Sun May 17 18:52:37 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.h,v 1.3 2012/02/19 21:06:16 rmind Exp $       */
+/*     $NetBSD: netbsd32_machdep.h,v 1.4 2015/05/17 18:52:37 matt Exp $        */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -69,4 +69,6 @@
        int ctl;
 };
 
+int cpu_machinearch32(SYSCTLFN_PROTO);
+
 #endif /* _MACHINE_NETBSD32_H_ */
diff -r 466173aacc22 -r da253a1f8b17 sys/arch/mips/mips/netbsd32_machdep.c
--- a/sys/arch/mips/mips/netbsd32_machdep.c     Sun May 17 15:48:57 2015 +0000
+++ b/sys/arch/mips/mips/netbsd32_machdep.c     Sun May 17 18:52:37 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_machdep.c,v 1.11 2014/01/25 15:20:55 christos Exp $   */
+/*     $NetBSD: netbsd32_machdep.c,v 1.12 2015/05/17 18:52:37 matt Exp $       */
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.11 2014/01/25 15:20:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.12 2015/05/17 18:52:37 matt Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_coredump.h"
@@ -343,3 +343,14 @@
            chdr->c_cpusize);
 }
 #endif
+
+int
+cpu_machinearch32(SYSCTLFN_ARGS)
+{
+       struct sysctlnode node = *rnode;
+       const char *march = l->l_proc->p_md.md_abi == _MIPS_BSD_API_O32
+           ? machine_arch32 : machine_arch;
+       node.sysctl_data = __UNCONST(march);
+       node.sysctl_size = strlen(march) + 1;
+       return sysctl_lookup(SYSCTLFN_CALL(&node));
+}
diff -r 466173aacc22 -r da253a1f8b17 sys/compat/netbsd32/netbsd32_sysctl.c
--- a/sys/compat/netbsd32/netbsd32_sysctl.c     Sun May 17 15:48:57 2015 +0000
+++ b/sys/compat/netbsd32/netbsd32_sysctl.c     Sun May 17 18:52:37 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_sysctl.c,v 1.35 2014/06/13 10:42:26 joerg Exp $       */
+/*     $NetBSD: netbsd32_sysctl.c,v 1.36 2015/05/17 18:52:37 matt Exp $        */
 
 /*
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.35 2014/06/13 10:42:26 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_sysctl.c,v 1.36 2015/05/17 18:52:37 matt Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -108,7 +108,9 @@
 netbsd32_sysctl_init(void)
 {
        const struct sysctlnode *_root = &netbsd32_sysctl_root;
+#ifndef __mips__
        extern const char machine_arch32[];
+#endif
        extern const char machine32[];
 
        sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
@@ -150,11 +152,19 @@
                       CTLTYPE_STRING, "machine", NULL,
                       NULL, 0, __UNCONST(&machine32), 0,
                       CTL_HW, HW_MACHINE, CTL_EOL);
+#ifdef __mips__
+       sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
+                      CTLFLAG_PERMANENT,
+                      CTLTYPE_STRING, "machine_arch", NULL,
+                      cpu_machinearch32, 0, NULL, 0,
+                      CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
+#else
        sysctl_createv(&netbsd32_clog, 0, &_root, NULL,
                       CTLFLAG_PERMANENT,
                       CTLTYPE_STRING, "machine_arch", NULL,
                       NULL, 0, __UNCONST(&machine_arch32), 0,
                       CTL_HW, HW_MACHINE_ARCH, CTL_EOL);
+#endif
 }
 
 void



Home | Main Index | Thread Index | Old Index