Module Name:    src
Committed By:   matt
Date:           Fri Jan 10 18:03:26 UTC 2014

Modified Files:
        src/sys/arch/arm/arm: arm_machdep.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/arch/arm/arm/arm_machdep.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/arm/arm/arm_machdep.c
diff -u src/sys/arch/arm/arm/arm_machdep.c:1.39 src/sys/arch/arm/arm/arm_machdep.c:1.40
--- src/sys/arch/arm/arm/arm_machdep.c:1.39	Wed Nov  6 02:34:10 2013
+++ src/sys/arch/arm/arm/arm_machdep.c	Fri Jan 10 18:03:26 2014
@@ -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 @@ setregs(struct lwp *l, struct exec_packa
 	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

Reply via email to