Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm Add EF_ARM_BE8
details: https://anonhg.NetBSD.org/src/rev/1042c8f9d83a
branches: trunk
changeset: 789039:1042c8f9d83a
user: matt <matt%NetBSD.org@localhost>
date: Mon Aug 05 00:57:24 2013 +0000
description:
Add EF_ARM_BE8
Make sure that running a program, that it right big-endian format for the
processor. (BE8 for armv7, BE32 for all others).
diffstat:
sys/arch/arm/arm/cpu_exec.c | 16 ++++++++++++++--
sys/arch/arm/include/elf_machdep.h | 3 ++-
2 files changed, 16 insertions(+), 3 deletions(-)
diffs (54 lines):
diff -r fa0305dc73c5 -r 1042c8f9d83a sys/arch/arm/arm/cpu_exec.c
--- a/sys/arch/arm/arm/cpu_exec.c Mon Aug 05 00:28:52 2013 +0000
+++ b/sys/arch/arm/arm/cpu_exec.c Mon Aug 05 00:57:24 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cpu_exec.c,v 1.3 2012/08/11 07:18:53 matt Exp $ */
+/* $NetBSD: cpu_exec.c,v 1.4 2013/08/05 00:57:24 matt Exp $ */
/*-
* Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.3 2012/08/11 07:18:53 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_exec.c,v 1.4 2013/08/05 00:57:24 matt Exp $");
#include "opt_compat_netbsd.h"
#include "opt_compat_netbsd32.h"
@@ -68,6 +68,18 @@
#else
const bool aapcs_p = false;
#endif
+#ifdef __ARMEB__
+ const bool be8_p = (eh->e_flags & EF_ARM_BE8) != 0;
+
+ /*
+ * If the BE-8 model is supported, CPSR[7] will be clear.
+ * If the BE-32 model is supported, CPSR[7] will be set.
+ */
+ register_t cpsr;
+ __asm("mrs\t%0, cpsr" : "=r"(cpsr));
+ if ((cpsr & CPU_CONTROL_BEND_ENABLE) == be8_p)
+ return ENOEXEC;
+#endif /* __ARMEB__ */
/*
* This is subtle. If are netbsd32, then we don't want to match the
diff -r fa0305dc73c5 -r 1042c8f9d83a sys/arch/arm/include/elf_machdep.h
--- a/sys/arch/arm/include/elf_machdep.h Mon Aug 05 00:28:52 2013 +0000
+++ b/sys/arch/arm/include/elf_machdep.h Mon Aug 05 00:57:24 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: elf_machdep.h,v 1.11 2013/04/24 22:35:23 matt Exp $ */
+/* $NetBSD: elf_machdep.h,v 1.12 2013/08/05 00:57:24 matt Exp $ */
#ifndef _ARM_ELF_MACHDEP_H_
#define _ARM_ELF_MACHDEP_H_
@@ -27,6 +27,7 @@
#define EF_ARM_NEW_ABI 0x00000080
#define EF_ARM_OLD_ABI 0x00000100
#define EF_ARM_SOFT_FLOAT 0x00000200
+#define EF_ARM_BE8 0x00800000
#define EF_ARM_EABIMASK 0xff000000
#define EF_ARM_EABI_VER1 0x01000000
#define EF_ARM_EABI_VER2 0x02000000
Home |
Main Index |
Thread Index |
Old Index