svn commit: r239032 - head/sys/arm/arm

Andrew Turner andrew at FreeBSD.org
Sat Aug 4 05:31:26 UTC 2012


Author: andrew
Date: Sat Aug  4 05:31:26 2012
New Revision: 239032
URL: http://svn.freebsd.org/changeset/base/239032

Log:
  Ensure we align the stack to 8 bytes in system calls.
  
  This is not strictly required with the current ABI but will be when we
  switch to the ARM EABI. The aapcs requires the stack to be 4 byte aligned
  at all times and 8 byte aligned when calling a public subroutine where the
  current ABI only requires sp to be a multiple of 4.

Modified:
  head/sys/arm/arm/exception.S

Modified: head/sys/arm/arm/exception.S
==============================================================================
--- head/sys/arm/arm/exception.S	Sat Aug  4 05:30:20 2012	(r239031)
+++ head/sys/arm/arm/exception.S	Sat Aug  4 05:31:26 2012	(r239032)
@@ -80,7 +80,10 @@ ASENTRY_NP(swi_entry)
 	PUSHFRAME
 
 	mov	r0, sp			/* Pass the frame to any function */
+	mov	r6, sp			/* Backup the stack pointer */
+	bic	sp, sp, #7		/* Align the stack pointer */
 	bl	_C_LABEL(swi_handler)	/* It's a SWI ! */
+	mov	sp, r6			/* Restore the stack */
 
 	DO_AST
 	PULLFRAME


More information about the svn-src-all mailing list