public inbox for libffi-discuss@sourceware.org
 help / color / mirror / Atom feed
* patch for windows CE/Mobile arm
@ 2011-10-11 13:48 Timothy Wall
  2011-11-12 21:14 ` Anthony Green
  0 siblings, 1 reply; 2+ messages in thread
From: Timothy Wall @ 2011-10-11 13:48 UTC (permalink / raw)
  To: libffi-discuss

[-- 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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: patch for windows CE/Mobile arm
  2011-10-11 13:48 patch for windows CE/Mobile arm Timothy Wall
@ 2011-11-12 21:14 ` Anthony Green
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Green @ 2011-11-12 21:14 UTC (permalink / raw)
  To: libffi-discuss

On 10/11/2011 9:47 AM, Timothy Wall wrote:
> wce/wme has maximum alignment of 4 bytes.
>

Thanks, I applied this with a minor tweak.

Your patch has...

        if (alignment < 4)
  	alignment = 4;
+#ifdef _WIN32_WCE
+      if (alignment > 4)
+        alignment = 4;
+#endif

I added an "else" immediately after #ifdef _WIN32_WCE.

Thanks,

AG

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-11-12 21:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-11 13:48 patch for windows CE/Mobile arm Timothy Wall
2011-11-12 21:14 ` Anthony Green

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).