public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
From: Timothy Wall <twall@users.sf.net>
To: libffi-discuss <libffi-discuss@sourceware.org>
Subject: patch for windows CE/Mobile arm
Date: Tue, 11 Oct 2011 13:48:00 -0000	[thread overview]
Message-ID: <CE0D20F3-B765-43BE-847C-F295969DE602@users.sf.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 43 bytes --]

wce/wme has maximum alignment of 4 bytes.


[-- Attachment #2: diff.txt --]
[-- Type: text/plain, Size: 1250 bytes --]

diff --git a/src/arm/ffi.c b/src/arm/ffi.c
index b2e7667..532c330 100644
--- a/src/arm/ffi.c
+++ b/src/arm/ffi.c
@@ -64,6 +64,7 @@ int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space)
        i--, p_arg++)
     {
       size_t z;
+      size_t alignment;
 
       /* Allocated in VFP registers. */
       if (ecif->cif->abi == FFI_VFP
@@ -81,8 +82,13 @@ int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space)
 	}
 
       /* Align if necessary */
-      if (((*p_arg)->alignment - 1) & (unsigned) argp) {
-	argp = (char *) ALIGN(argp, (*p_arg)->alignment);
+      alignment = (*p_arg)->alignment;
+#ifdef _WIN32_WCE
+      if (alignment > 4)
+        alignment = 4;
+#endif
+      if ((alignment - 1) & (unsigned) argp) {
+	argp = (char *) ALIGN(argp, alignment);
       }
 
       if ((*p_arg)->type == FFI_TYPE_STRUCT)
@@ -320,6 +326,10 @@ ffi_prep_incoming_args_SYSV(char *stack, void **rvalue,
       alignment = (*p_arg)->alignment;
       if (alignment < 4)
 	alignment = 4;
+#ifdef _WIN32_WCE
+      if (alignment > 4) 
+        alignment = 4;
+#endif
       /* Align if necessary */
       if ((alignment - 1) & (unsigned) argp) {
 	argp = (char *) ALIGN(argp, alignment);

             reply	other threads:[~2011-10-11 13:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 13:48 Timothy Wall [this message]
2011-11-12 21:14 ` Anthony Green

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=CE0D20F3-B765-43BE-847C-F295969DE602@users.sf.net \
    --to=twall@users.sf.net \
    --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).