Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/arm Make sure to start BE-8 programs with the P...



details:   https://anonhg.NetBSD.org/src/rev/12a48d115063
branches:  trunk
changeset: 792631:12a48d115063
user:      matt <matt%NetBSD.org@localhost>
date:      Fri Jan 10 18:03:26 2014 +0000

description:
Make sure to start BE-8 programs with the PSR[E] set.

diffstat:

 sys/arch/arm/arm/arm_machdep.c |  15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diffs (41 lines):

diff -r bf3288d408a9 -r 12a48d115063 sys/arch/arm/arm/arm_machdep.c
--- a/sys/arch/arm/arm/arm_machdep.c    Fri Jan 10 17:48:11 2014 +0000
+++ b/sys/arch/arm/arm/arm_machdep.c    Fri Jan 10 18:03:26 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: arm_machdep.c,v 1.39 2013/11/06 02:34:10 christos Exp $        */
+/*     $NetBSD: arm_machdep.c,v 1.40 2014/01/10 18:03:26 matt Exp $    */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -78,7 +78,7 @@
 
 #include <sys/param.h>
 
-__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.39 2013/11/06 02:34:10 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm_machdep.c,v 1.40 2014/01/10 18:03:26 matt Exp $");
 
 #include <sys/exec.h>
 #include <sys/proc.h>
@@ -174,12 +174,21 @@
        tf->tf_svc_lr = 0x77777777;             /* Something we can see */
        tf->tf_pc = pack->ep_entry;
 #ifdef __PROG32
+#if defined(__ARMEB__)
+       /*
+        * If we are running on ARMv7, we need to set the E bit to force
+        * programs to start as big endian.
+        */
+       tf->tf_spsr = PSR_USR32_MODE | (CPU_IS_ARMV7_P() ? PSR_E_BIT : 0);
+#else
        tf->tf_spsr = PSR_USR32_MODE;
+#endif /* __ARMEB__ */ 
+
 #ifdef THUMB_CODE
        if (pack->ep_entry & 1)
                tf->tf_spsr |= PSR_T_bit;
 #endif
-#endif
+#endif /* __PROG32 */
 
        l->l_md.md_flags = 0;
 #ifdef EXEC_AOUT



Home | Main Index | Thread Index | Old Index