Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/mips fix "uname -p" on mips n32.
details: https://anonhg.NetBSD.org/src/rev/b36df97f1df0
branches: trunk
changeset: 1021287:b36df97f1df0
user: mrg <mrg%NetBSD.org@localhost>
date: Sun May 23 23:24:45 2021 +0000
description:
fix "uname -p" on mips n32.
this has been returning "mipsn64eb" on my edgerouter4 with the
32 bit uname binary.
introduce o32, n32, and n64 versions of MACHINE_ARCH, and use
them appropriately in PROC_MACHINE_ARCH32(). now o32, n32 and
n64 "uname -p" all return different values.
diffstat:
sys/arch/mips/include/mips_param.h | 27 ++++++++++++++++++---------
sys/arch/mips/include/netbsd32_machdep.h | 15 +++++++++++----
sys/arch/mips/mips/cpu_exec.c | 6 +++---
sys/arch/mips/mips/netbsd32_machdep.c | 11 +++++++----
4 files changed, 39 insertions(+), 20 deletions(-)
diffs (142 lines):
diff -r 961cc876aa07 -r b36df97f1df0 sys/arch/mips/include/mips_param.h
--- a/sys/arch/mips/include/mips_param.h Sun May 23 23:22:55 2021 +0000
+++ b/sys/arch/mips/include/mips_param.h Sun May 23 23:24:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mips_param.h,v 1.49 2021/05/08 13:09:58 skrll Exp $ */
+/* $NetBSD: mips_param.h,v 1.50 2021/05/23 23:24:45 mrg Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,19 +38,28 @@
# error neither __MIPSEL__ nor __MIPSEB__ are defined.
#endif
+#define ___MACHINE32_OARCH mips##_MACHINE_SUFFIX
+#define __MACHINE32_OARCH "mips" MACHINE_SUFFIX
+#define ___MACHINE32_NARCH mips64##_MACHINE_SUFFIX
+#define __MACHINE32_NARCH "mips64" MACHINE_SUFFIX
+#define ___MACHINE64_NARCH mipsn64##_MACHINE_SUFFIX
+#define __MACHINE64_NARCH "mipsn64" MACHINE_SUFFIX
+
#if defined(__mips_n32) || defined(__mips_n64)
# if defined(__mips_n32)
-# define _MACHINE_ARCH mips64##_MACHINE_SUFFIX
-# define MACHINE_ARCH "mips64" MACHINE_SUFFIX
+# define _MACHINE_ARCH ___MACHINE32_NARCH
+# define MACHINE_ARCH __MACHINE32_NARCH
# else /* __mips_n64 */
-# define _MACHINE_ARCH mipsn64##_MACHINE_SUFFIX
-# define MACHINE_ARCH "mipsn64" MACHINE_SUFFIX
+# define _MACHINE_ARCH ___MACHINE64_NARCH
+# define MACHINE_ARCH __MACHINE64_NARCH
+# define _MACHINE32_NARCH ___MACHINE32_NARCH
+# define MACHINE32_NARCH __MACHINE32_NARCH
# endif
-# define _MACHINE32_ARCH mips##_MACHINE_SUFFIX
-# define MACHINE32_ARCH "mips" MACHINE_SUFFIX
+# define _MACHINE32_OARCH ___MACHINE32_OARCH
+# define MACHINE32_OARCH __MACHINE32_OARCH
#else /* o32 */
-# define _MACHINE_ARCH mips##_MACHINE_SUFFIX
-# define MACHINE_ARCH "mips" MACHINE_SUFFIX
+# define _MACHINE_ARCH ___MACHINE32_OARCH
+# define MACHINE_ARCH __MACHINE32_OARCH
#endif
/*
diff -r 961cc876aa07 -r b36df97f1df0 sys/arch/mips/include/netbsd32_machdep.h
--- a/sys/arch/mips/include/netbsd32_machdep.h Sun May 23 23:22:55 2021 +0000
+++ b/sys/arch/mips/include/netbsd32_machdep.h Sun May 23 23:24:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.h,v 1.6 2020/07/26 08:08:41 simonb Exp $ */
+/* $NetBSD: netbsd32_machdep.h,v 1.7 2021/05/23 23:24:45 mrg Exp $ */
/*-
* Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -44,10 +44,17 @@
typedef netbsd32_pointer_t netbsd32_sigcontextp_t;
-/* Support varying ABI names for netbsd32 */
-extern const char machine_arch32[];
+/* Support varying ABI names for netbsd32/ABI */
+extern const char machine_archo32[];
+#if defined(__mips_n64)
+extern const char machine_archn32[];
#define PROC_MACHINE_ARCH32(P) ((P)->p_md.md_abi == _MIPS_BSD_API_O32) ? \
- __UNCONST(machine_arch32) : machine_arch
+ __UNCONST(machine_archo32) : ((P)->p_md.md_abi == _MIPS_BSD_API_N32) ? \
+ __UNCONST(machine_archn32) : machine_arch
+#else
+#define PROC_MACHINE_ARCH32(P) ((P)->p_md.md_abi == _MIPS_BSD_API_O32) ? \
+ __UNCONST(machine_archo32) : machine_arch
+#endif
/*
* The sigcode is ABI neutral.
diff -r 961cc876aa07 -r b36df97f1df0 sys/arch/mips/mips/cpu_exec.c
--- a/sys/arch/mips/mips/cpu_exec.c Sun May 23 23:22:55 2021 +0000
+++ b/sys/arch/mips/mips/cpu_exec.c Sun May 23 23:24:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_exec.c,v 1.67 2018/08/19 10:33:49 mrg Exp $ */
+/* $NetBSD: cpu_exec.c,v 1.68 2021/05/23 23:24:45 mrg Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.67 2018/08/19 10:33:49 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.68 2021/05/23 23:24:45 mrg Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_ultrix.h"
@@ -201,7 +201,7 @@
eh->e_flags |= EF_MIPS_ABI2;
break;
case _MIPS_BSD_API_O32:
- eh->e_flags |=EF_MIPS_ABI_O32;
+ eh->e_flags |= EF_MIPS_ABI_O32;
break;
}
}
diff -r 961cc876aa07 -r b36df97f1df0 sys/arch/mips/mips/netbsd32_machdep.c
--- a/sys/arch/mips/mips/netbsd32_machdep.c Sun May 23 23:22:55 2021 +0000
+++ b/sys/arch/mips/mips/netbsd32_machdep.c Sun May 23 23:24:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: netbsd32_machdep.c,v 1.20 2019/12/12 02:15:42 pgoyette Exp $ */
+/* $NetBSD: netbsd32_machdep.c,v 1.21 2021/05/23 23:24:45 mrg 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.20 2019/12/12 02:15:42 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_machdep.c,v 1.21 2021/05/23 23:24:45 mrg Exp $");
#include "opt_compat_netbsd.h"
@@ -67,7 +67,10 @@
#include <uvm/uvm_extern.h>
const char machine32[] = MACHINE;
-const char machine_arch32[] = MACHINE32_ARCH;
+const char machine_archo32[] = MACHINE32_OARCH;
+#ifdef MACHINE32_NARCH
+const char machine_archn32[] = MACHINE32_NARCH;
+#endif
#if 0
cpu_coredump32
@@ -321,7 +324,7 @@
netbsd32_machine32(void)
{
- return machine32;
+ return PROC_MACHINE_ARCH32(curproc);
}
void
Home |
Main Index |
Thread Index |
Old Index