[Vm-dev] [commit][3315] Provide stack alignment checks for ARM32.
commits at squeakvm.org
commits at squeakvm.org
Tue Apr 28 22:36:41 UTC 2015
Revision: 3315
Author: eliot
Date: 2015-04-28 15:36:39 -0700 (Tue, 28 Apr 2015)
Log Message:
-----------
Provide stack alignment checks for ARM32.
Make sure the spur image uploader uploads the checksum.
Modified Paths:
--------------
branches/Cog/image/uploadspurimage.sh
branches/Cog/platforms/Cross/vm/sqCogStackAlignment.h
Modified: branches/Cog/image/uploadspurimage.sh
===================================================================
--- branches/Cog/image/uploadspurimage.sh 2015-04-26 23:58:12 UTC (rev 3314)
+++ branches/Cog/image/uploadspurimage.sh 2015-04-28 22:36:39 UTC (rev 3315)
@@ -15,11 +15,11 @@
echo ssh -x $RemoteUser mkdir $DIR
ssh -x $RemoteUser mkdir $DIR
echo scp -p $BASENAME.image $BASENAME.changes $BASENAME.sum "$@" $RemoteUser:$DIR
-scp -p $BASENAME.image $BASENAME.changes "$@" $RemoteUser:$DIR
+scp -p $BASENAME.image $BASENAME.changes $BASENAME.sum "$@" $RemoteUser:$DIR
echo ssh $RemoteUser chmod a-w $DIR/* \\\; ls -al $DIR
ssh $RemoteUser chmod a-w $DIR/* \; ls -al $DIR
-echo ssh $RemoteUser rm $RemoteRoot/{$BASENAME.image,$BASENAME.changes}
-ssh $RemoteUser rm $RemoteRoot/{$BASENAME.image,$BASENAME.changes}
+echo ssh $RemoteUser rm $RemoteRoot/{$BASENAME.image,$BASENAME.changes,$BASENAME.sum}
+ssh $RemoteUser rm $RemoteRoot/{$BASENAME.image,$BASENAME.changes,$BASENAME.sum}
echo ssh $RemoteUser cd $RemoteRoot \\\; ln -s $DATE/{$BASENAME.image,$BASENAME.changes} .
ssh $RemoteUser cd $RemoteRoot \; ln -s $DATE/{$BASENAME.image,$BASENAME.changes,$BASENAME.sum} .
ssh $RemoteUser ls -l $RemoteRoot $RemoteRoot/$DATE
Modified: branches/Cog/platforms/Cross/vm/sqCogStackAlignment.h
===================================================================
--- branches/Cog/platforms/Cross/vm/sqCogStackAlignment.h 2015-04-26 23:58:12 UTC (rev 3314)
+++ branches/Cog/platforms/Cross/vm/sqCogStackAlignment.h 2015-04-28 22:36:39 UTC (rev 3315)
@@ -5,19 +5,27 @@
* AUTHOR: Eliot Miranda
* DATE: February 2009
*
- * Changes: eem Wed Jul 14 17:11:01 PDT 2010
- * make 16 bytes the default alignment for all x86.
+ * Changes: eem Tue 28 Apr 2015 Add ARM32 support.
+ * eem Wed Jul 14 2010 make 16 bytes the default alignment for all x86.
*/
+#if __i386__ && (__SSE2__ || __APPLE__ && __MACH__ || __linux__)
/* 16-byte stack alignment on x86 is required for SSE instructions which
* insist on aligned addresses for accessing 64 or 128 bit values in memory.
*/
-#if __i386__ && (__SSE2__ || __APPLE__ && __MACH__ || __linux__)
# define STACK_ALIGN_BYTES 16
# define LEAF_CALL_STACK_ALIGN_BYTES 12
# define STACK_FP_ALIGN_BYTES 8
#endif
+#if defined(__arm__) || defined(__arm32__) || defined(ARM32)
+/* 8-byte stack alignment on ARM32 is required for instructions
+ * which access doubles and insist on 8-byte alignment.
+ */
+# define STACK_ALIGN_BYTES 8
+# define STACK_FP_ALIGN_BYTES 8
+#endif
+
#if defined(STACK_ALIGN_BYTES)
# if defined(_X86_) || defined(i386) || defined(__i386) || defined(__i386__)
# if __GNUC__
@@ -27,17 +35,39 @@
# else
extern unsigned long getfp();
# endif
+# elif defined(__arm__) || defined(__arm32__) || defined(ARM32)
+ /* http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0041c/Cegbidie.html
+ * ARM DUI 0041C Page 9-7
+ */
+# if __GNUC__
+# define getfp() ({ register unsigned long fp; \
+ asm volatile ("mov %0, r11 : "=r"(fp) : ); \
+ fp; })
+# else
+extern unsigned long getfp();
+# endif
# else
# error define code for your processor here
# endif
extern unsigned long (*ceGetSP)(); /* provided by Cogit */
# define STACK_ALIGN_MASK (STACK_ALIGN_BYTES-1)
-# define assertCStackWellAligned() do { \
+# if defined(LEAF_CALL_STACK_ALIGN_BYTES)
+ /* On CISCs, calling cGetSP will push ret pc and change algnment */
+# define assertCStackWellAligned() do { \
extern sqInt cFramePointerInUse; \
if (cFramePointerInUse) \
assert((getfp() & STACK_ALIGN_MASK) == STACK_FP_ALIGN_BYTES); \
assert((ceGetSP() & STACK_ALIGN_MASK) == LEAF_CALL_STACK_ALIGN_BYTES); \
} while (0)
+# else
+ /* on RISCs, LinkReg implies stack ptr unchanged when doing cGetSP */
+# define assertCStackWellAligned() do { \
+ extern sqInt cFramePointerInUse; \
+ if (cFramePointerInUse) \
+ assert((getfp() & STACK_ALIGN_MASK) == STACK_FP_ALIGN_BYTES); \
+ assert((ceGetSP() & STACK_ALIGN_MASK) == STACK_FP_ALIGN_BYTES); \
+} while (0)
+# endif
#else /* defined(STACK_ALIGN_BYTES) */
# define STACK_ALIGN_BYTES 4
# define assertCStackWellAligned() 0
More information about the Vm-dev
mailing list