public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: libffi-discuss@sourceware.org
Subject: [PATCH] Fix stack alignment on *BSD/i386
Date: Mon, 01 Apr 2013 11:18:00 -0000	[thread overview]
Message-ID: <201304011118.r31BI5OV023760@glazunov.sibelius.xs4all.nl> (raw)

The same thing was done to the "generic" SystemV ABI code back in
2010.  Without this, executing code that uses SSE instructions with
data on the stack will fail.


2013-04-01  Mark Kettenis  <kettenis@gnu.org>

	* src/x86/freebsd.S (ffi_call_SYSV): Align the stack pointer to
	16-bytes.

Index: src/x86/freebsd.S
===================================================================
--- src/x86/freebsd.S	(revision 197303)
+++ src/x86/freebsd.S	(working copy)
@@ -49,6 +49,9 @@
 	movl  16(%ebp),%ecx
 	subl  %ecx,%esp
 
+	/* Align the stack pointer to 16-bytes */
+	andl  $0xfffffff0, %esp
+
 	movl  %esp,%eax
 
 	/* Place all of the ffi_prep_args in position  */

             reply	other threads:[~2013-04-01 11:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-01 11:18 Mark Kettenis [this message]
2013-11-04 23:47 ` Brad Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201304011118.r31BI5OV023760@glazunov.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=libffi-discuss@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).