Module Name:    src
Committed By:   matt
Date:           Sun May 17 18:52:37 UTC 2015

Modified Files:
        src/sys/arch/mips/include: netbsd32_machdep.h
        src/sys/arch/mips/mips: netbsd32_machdep.c
        src/sys/compat/netbsd32: netbsd32_sysctl.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/include/netbsd32_machdep.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/mips/mips/netbsd32_machdep.c
cvs rdiff -u -r1.35 -r1.36 src/sys/compat/netbsd32/netbsd32_sysctl.c

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

Modified files:

Index: src/sys/arch/mips/include/netbsd32_machdep.h
diff -u src/sys/arch/mips/include/netbsd32_machdep.h:1.3 src/sys/arch/mips/include/netbsd32_machdep.h:1.4
--- src/sys/arch/mips/include/netbsd32_machdep.h:1.3	Sun Feb 19 21:06:16 2012
+++ src/sys/arch/mips/include/netbsd32_machdep.h	Sun May 17 18:52:37 2015
@@ -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 @@ struct mips_cachectl_args32 {
 	int ctl;
 };
 
+int cpu_machinearch32(SYSCTLFN_PROTO);
+
 #endif /* _MACHINE_NETBSD32_H_ */

Index: src/sys/arch/mips/mips/netbsd32_machdep.c
diff -u src/sys/arch/mips/mips/netbsd32_machdep.c:1.11 src/sys/arch/mips/mips/netbsd32_machdep.c:1.12
--- src/sys/arch/mips/mips/netbsd32_machdep.c:1.11	Sat Jan 25 15:20:55 2014
+++ src/sys/arch/mips/mips/netbsd32_machdep.c	Sun May 17 18:52:37 2015
@@ -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 @@ cpu_coredump32(struct lwp *l, struct cor
 	    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));
+}

Index: src/sys/compat/netbsd32/netbsd32_sysctl.c
diff -u src/sys/compat/netbsd32/netbsd32_sysctl.c:1.35 src/sys/compat/netbsd32/netbsd32_sysctl.c:1.36
--- src/sys/compat/netbsd32/netbsd32_sysctl.c:1.35	Fri Jun 13 10:42:26 2014
+++ src/sys/compat/netbsd32/netbsd32_sysctl.c	Sun May 17 18:52:37 2015
@@ -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 @@ void
 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 @@ netbsd32_sysctl_init(void)
 		       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

Reply via email to