Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 4 Aug 2012 05:31:26 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r239032 - head/sys/arm/arm
Message-ID:  <201208040531.q745VQPT014094@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201208040531.q745VQPT014094>