[Python-checkins] r60950 - in python/branches/libffi3-branch/Modules/_ctypes/libffi/src: cris/ffi.c cris/ffitarget.h frv/eabi.S frv/ffi.c frv/ffitarget.h m32r/ffi.c m68k/ffi.c m68k/ffitarget.h m68k/sysv.S pa/ffi.c pa/ffitarget.h pa/linux.S sh/ffi.c sh/ffitarget.h sh/sysv.S sh64/ffi.c sh64/ffitarget.h sh64/sysv.S

thomas.heller python-checkins at python.org
Fri Feb 22 09:37:07 CET 2008


Author: thomas.heller
Date: Fri Feb 22 09:37:07 2008
New Revision: 60950

Modified:
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/eabi.S
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m32r/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/sysv.S
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/linux.S
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/sysv.S
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffi.c
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffitarget.h
   python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/sysv.S
Log:
More files from libffi-3.0.2.

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffi.c	Fri Feb 22 09:37:07 2008
@@ -2,6 +2,7 @@
    ffi.c - Copyright (c) 1998 Cygnus Solutions
            Copyright (c) 2004 Simon Posnjak
 	   Copyright (c) 2005 Axis Communications AB
+	   Copyright (C) 2007 Free Software Foundation, Inc.
 
    CRIS Foreign Function Interface
 
@@ -235,11 +236,11 @@
 
 extern void ffi_call_SYSV (int (*)(char *, extended_cif *),
 			   extended_cif *,
-			   unsigned, unsigned, unsigned *, void (*fn) ())
+			   unsigned, unsigned, unsigned *, void (*fn)(void))
      __attribute__ ((__visibility__ ("hidden")));
 
 void
-ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue)
+ffi_call (ffi_cif * cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   extended_cif ecif;
 
@@ -360,10 +361,11 @@
 /* API function: Prepare the trampoline.  */
 
 ffi_status
-ffi_prep_closure (ffi_closure* closure,
-		  ffi_cif* cif,
-		  void (*fun)(ffi_cif *, void *, void **, void*),
-		  void *user_data)
+ffi_prep_closure_loc (ffi_closure* closure,
+		      ffi_cif* cif,
+		      void (*fun)(ffi_cif *, void *, void **, void*),
+		      void *user_data,
+		      void *codeloc)
 {
   void *innerfn = ffi_prep_closure_inner;
   FFI_ASSERT (cif->abi == FFI_SYSV);
@@ -375,7 +377,7 @@
   memcpy (closure->tramp + ffi_cris_trampoline_fn_offset,
 	  &innerfn, sizeof (void *));
   memcpy (closure->tramp + ffi_cris_trampoline_closure_offset,
-	  &closure, sizeof (void *));
+	  &codeloc, sizeof (void *));
 
   return FFI_OK;
 }

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/cris/ffitarget.h	Fri Feb 22 09:37:07 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/eabi.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/eabi.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/eabi.S	Fri Feb 22 09:37:07 2008
@@ -3,8 +3,6 @@
    
    FR-V Assembly glue.
 
-   $Id: eabi.S,v 1.2 2006/03/03 20:24:46 theller Exp $
-
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
    ``Software''), to deal in the Software without restriction, including

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffi.c	Fri Feb 22 09:37:07 2008
@@ -1,5 +1,6 @@
 /* -----------------------------------------------------------------------
    ffi.c - Copyright (c) 2004  Anthony Green
+   Copyright (C) 2007  Free Software Foundation, Inc.
    
    FR-V Foreign Function Interface 
 
@@ -14,13 +15,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
 #include <ffi.h>
@@ -124,10 +126,10 @@
 			  extended_cif *, 
 			  unsigned, unsigned, 
 			  unsigned *, 
-			  void (*fn)());
+			  void (*fn)(void));
 
 void ffi_call(ffi_cif *cif, 
-	      void (*fn)(), 
+	      void (*fn)(void), 
 	      void *rvalue, 
 	      void **avalue)
 {
@@ -243,14 +245,15 @@
 }
 
 ffi_status
-ffi_prep_closure (ffi_closure* closure,
-		  ffi_cif* cif,
-		  void (*fun)(ffi_cif*, void*, void**, void*),
-		  void *user_data)
+ffi_prep_closure_loc (ffi_closure* closure,
+		      ffi_cif* cif,
+		      void (*fun)(ffi_cif*, void*, void**, void*),
+		      void *user_data,
+		      void *codeloc)
 {
   unsigned int *tramp = (unsigned int *) &closure->tramp[0];
   unsigned long fn = (long) ffi_closure_eabi;
-  unsigned long cls = (long) closure;
+  unsigned long cls = (long) codeloc;
 #ifdef __FRV_FDPIC__
   register void *got __asm__("gr15");
 #endif
@@ -259,7 +262,7 @@
   fn = (unsigned long) ffi_closure_eabi;
 
 #ifdef __FRV_FDPIC__
-  tramp[0] = &tramp[2];
+  tramp[0] = &((unsigned int *)codeloc)[2];
   tramp[1] = got;
   tramp[2] = 0x8cfc0000 + (fn  & 0xffff); /* setlos lo(fn), gr6    */
   tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7   */
@@ -281,7 +284,8 @@
 
   /* Cache flushing.  */
   for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++)
-    __asm__ volatile ("dcf @(%0,%1)\n\tici @(%0,%1)" :: "r" (tramp), "r" (i));
+    __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i),
+		      "r" (codeloc));
 
   return FFI_OK;
 }

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/frv/ffitarget.h	Fri Feb 22 09:37:07 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m32r/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m32r/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m32r/ffi.c	Fri Feb 22 09:37:07 2008
@@ -31,9 +31,7 @@
 /* ffi_prep_args is called by the assembly routine once stack
    space has been allocated for the function's arguments.  */
 
-/*@-exportheader@*/
 void ffi_prep_args(char *stack, extended_cif *ecif)
-/*@=exportheader@*/
 {
   unsigned int i;
   int tmp;
@@ -173,20 +171,10 @@
   return FFI_OK;
 }
 
-/*@-declundef@*/
-/*@-exportheader@*/
-extern void ffi_call_SYSV(void (*)(char *, extended_cif *), 
-			  /*@out@*/ extended_cif *, 
-			  unsigned, unsigned, 
-			  /*@out@*/ unsigned *, 
-			  void (*fn)());
-/*@=declundef@*/
-/*@=exportheader@*/
-
-void ffi_call(/*@dependent@*/ ffi_cif *cif, 
-	      void (*fn)(), 
-	      /*@out@*/ void *rvalue, 
-	      /*@dependent@*/ void **avalue)
+extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
+			  unsigned, unsigned, unsigned *, void (*fn)(void));
+
+void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   extended_cif ecif;
 
@@ -198,9 +186,7 @@
   if ((rvalue == NULL) && 
       (cif->rtype->type == FFI_TYPE_STRUCT))
     {
-      /*@-sysunrecog@*/
       ecif.rvalue = alloca (cif->rtype->size);
-      /*@=sysunrecog@*/
     }
   else
     ecif.rvalue = rvalue;    
@@ -208,7 +194,6 @@
   switch (cif->abi) 
     {
     case FFI_SYSV:
-      /*@-usedef@*/
       ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, 
 		    cif->flags, ecif.rvalue, fn);
       if (cif->rtype->type == FFI_TYPE_STRUCT)
@@ -237,7 +222,6 @@
 		}
 	    }
 	}
-      /*@=usedef@*/
       break;
 
     default:

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffi.c	Fri Feb 22 09:37:07 2008
@@ -8,11 +8,23 @@
 #include <ffi_common.h>
 
 #include <stdlib.h>
+#include <unistd.h>
+#include <sys/syscall.h>
+#include <asm/cachectl.h>
+
+void ffi_call_SYSV (extended_cif *,
+		    unsigned, unsigned,
+		    void *, void (*fn)(void));
+void *ffi_prep_args (void *stack, extended_cif *ecif);
+void ffi_closure_SYSV (ffi_closure *);
+void ffi_closure_struct_SYSV (ffi_closure *);
+unsigned int ffi_closure_SYSV_inner (ffi_closure *closure,
+				     void *resp, void *args);
 
 /* ffi_prep_args is called by the assembly routine once stack space has
    been allocated for the function's arguments.  */
 
-static void *
+void *
 ffi_prep_args (void *stack, extended_cif *ecif)
 {
   unsigned int i;
@@ -24,7 +36,7 @@
   argp = stack;
 
   if (ecif->cif->rtype->type == FFI_TYPE_STRUCT
-      && ecif->cif->rtype->size > 8)
+      && !ecif->cif->flags)
     struct_value_ptr = ecif->rvalue;
   else
     struct_value_ptr = NULL;
@@ -37,44 +49,47 @@
     {
       size_t z;
 
-      /* Align if necessary.  */
-      if (((*p_arg)->alignment - 1) & (unsigned) argp)
-	argp = (char *) ALIGN (argp, (*p_arg)->alignment);
-
-	  z = (*p_arg)->size;
-	  if (z < sizeof (int))
+      z = (*p_arg)->size;
+      if (z < sizeof (int))
+	{
+	  switch ((*p_arg)->type)
 	    {
-	      switch ((*p_arg)->type)
-		{
-		case FFI_TYPE_SINT8:
-		  *(signed int *) argp = (signed int) *(SINT8 *) *p_argv;
-		  break;
-
-		case FFI_TYPE_UINT8:
-		  *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv;
-		  break;
-
-		case FFI_TYPE_SINT16:
-		  *(signed int *) argp = (signed int) *(SINT16 *) *p_argv;
-		  break;
-
-		case FFI_TYPE_UINT16:
-		  *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv;
-		  break;
-
-		case FFI_TYPE_STRUCT:
-		  memcpy (argp + sizeof (int) - z, *p_argv, z);
-		  break;
-
-		default:
-		  FFI_ASSERT (0);
-		}
-	      z = sizeof (int);
+	    case FFI_TYPE_SINT8:
+	      *(signed int *) argp = (signed int) *(SINT8 *) *p_argv;
+	      break;
+
+	    case FFI_TYPE_UINT8:
+	      *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv;
+	      break;
+
+	    case FFI_TYPE_SINT16:
+	      *(signed int *) argp = (signed int) *(SINT16 *) *p_argv;
+	      break;
+
+	    case FFI_TYPE_UINT16:
+	      *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv;
+	      break;
+
+	    case FFI_TYPE_STRUCT:
+	      memcpy (argp + sizeof (int) - z, *p_argv, z);
+	      break;
+
+	    default:
+	      FFI_ASSERT (0);
 	    }
-	  else
-	    memcpy (argp, *p_argv, z);
-	  p_argv++;
-	  argp += z;
+	  z = sizeof (int);
+	}
+      else
+	{
+	  memcpy (argp, *p_argv, z);
+
+	  /* Align if necessary.  */
+	  if ((sizeof(int) - 1) & z)
+	    z = ALIGN(z, sizeof(int));
+	}
+
+      p_argv++;
+      argp += z;
     }
 
   return struct_value_ptr;
@@ -86,7 +101,8 @@
 #define CIF_FLAGS_DOUBLE	8
 #define CIF_FLAGS_LDOUBLE	16
 #define CIF_FLAGS_POINTER	32
-#define CIF_FLAGS_STRUCT	64
+#define CIF_FLAGS_STRUCT1	64
+#define CIF_FLAGS_STRUCT2	128
 
 /* Perform machine dependent cif processing */
 ffi_status
@@ -100,12 +116,24 @@
       break;
 
     case FFI_TYPE_STRUCT:
-      if (cif->rtype->size > 4 && cif->rtype->size <= 8)
-	cif->flags = CIF_FLAGS_DINT;
-      else if (cif->rtype->size <= 4)
-	cif->flags = CIF_FLAGS_STRUCT;
-      else
-	cif->flags = 0;
+      switch (cif->rtype->size)
+	{
+	case 1:
+	  cif->flags = CIF_FLAGS_STRUCT1;
+	  break;
+	case 2:
+	  cif->flags = CIF_FLAGS_STRUCT2;
+	  break;
+	case 4:
+	  cif->flags = CIF_FLAGS_INT;
+	  break;
+	case 8:
+	  cif->flags = CIF_FLAGS_DINT;
+	  break;
+	default:
+	  cif->flags = 0;
+	  break;
+	}
       break;
 
     case FFI_TYPE_FLOAT:
@@ -137,19 +165,14 @@
   return FFI_OK;
 }
 
-extern void ffi_call_SYSV (void *(*) (void *, extended_cif *), 
-			   extended_cif *, 
-			   unsigned, unsigned, unsigned,
-			   void *, void (*fn) ());
-
 void
-ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue)
+ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   extended_cif ecif;
 
   ecif.cif = cif;
   ecif.avalue = avalue;
-  
+
   /* If the return value is a struct and we don't have a return value
      address then we need to make one.  */
 
@@ -159,13 +182,11 @@
     ecif.rvalue = alloca (cif->rtype->size);
   else
     ecif.rvalue = rvalue;
-    
-  
-  switch (cif->abi) 
+
+  switch (cif->abi)
     {
     case FFI_SYSV:
-      ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes, 
-		     cif->flags, cif->rtype->size * 8,
+      ffi_call_SYSV (&ecif, cif->bytes, cif->flags,
 		     ecif.rvalue, fn);
       break;
 
@@ -174,3 +195,84 @@
       break;
     }
 }
+
+static void
+ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif)
+{
+  unsigned int i;
+  void **p_argv;
+  char *argp;
+  ffi_type **p_arg;
+
+  argp = stack;
+  p_argv = avalue;
+
+  for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++)
+    {
+      size_t z;
+
+      z = (*p_arg)->size;
+      if (z <= 4)
+	{
+	  *p_argv = (void *) (argp + 4 - z);
+
+	  z = 4;
+	}
+      else
+	{
+	  *p_argv = (void *) argp;
+
+	  /* Align if necessary */
+	  if ((sizeof(int) - 1) & z)
+	    z = ALIGN(z, sizeof(int));
+	}
+
+      p_argv++;
+      argp += z;
+    }
+}
+
+unsigned int
+ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args)
+{
+  ffi_cif *cif;
+  void **arg_area;
+
+  cif = closure->cif;
+  arg_area = (void**) alloca (cif->nargs * sizeof (void *));
+
+  ffi_prep_incoming_args_SYSV(args, arg_area, cif);
+
+  (closure->fun) (cif, resp, arg_area, closure->user_data);
+
+  return cif->flags;
+}
+
+ffi_status
+ffi_prep_closure_loc (ffi_closure* closure,
+		      ffi_cif* cif,
+		      void (*fun)(ffi_cif*,void*,void**,void*),
+		      void *user_data,
+		      void *codeloc)
+{
+  FFI_ASSERT (cif->abi == FFI_SYSV);
+
+  *(unsigned short *)closure->tramp = 0x207c;
+  *(void **)(closure->tramp + 2) = codeloc;
+  *(unsigned short *)(closure->tramp + 6) = 0x4ef9;
+  if (cif->rtype->type == FFI_TYPE_STRUCT
+      && !cif->flags)
+    *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV;
+  else
+    *(void **)(closure->tramp + 8) = ffi_closure_SYSV;
+
+  syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE,
+	  FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE);
+
+  closure->cif  = cif;
+  closure->user_data = user_data;
+  closure->fun  = fun;
+
+  return FFI_OK;
+}
+

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/ffitarget.h	Fri Feb 22 09:37:07 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 
@@ -40,7 +41,8 @@
 
 /* ---- Definitions for closures ----------------------------------------- */
 
-#define FFI_CLOSURES 0
+#define FFI_CLOSURES 1
+#define FFI_TRAMPOLINE_SIZE 16
 #define FFI_NATIVE_RAW_API 0
 
 #endif

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/sysv.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/sysv.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/m68k/sysv.S	Fri Feb 22 09:37:07 2008
@@ -8,40 +8,60 @@
 #include <fficonfig.h>
 #include <ffi.h>
 
+#ifdef HAVE_AS_CFI_PSEUDO_OP
+#define CFI_STARTPROC()		.cfi_startproc
+#define CFI_OFFSET(reg,off)	.cfi_offset	reg,off
+#define CFI_DEF_CFA(reg,off)	.cfi_def_cfa	reg,off
+#define CFI_ENDPROC()		.cfi_endproc
+#else
+#define CFI_STARTPROC()
+#define CFI_OFFSET(reg,off)
+#define CFI_DEF_CFA(reg,off)
+#define CFI_ENDPROC()
+#endif
+
 	.text
 
 	.globl	ffi_call_SYSV
 	.type	ffi_call_SYSV, at function
+	.align	4
 
 ffi_call_SYSV:
+	CFI_STARTPROC()
 	link	%fp,#0
+	CFI_OFFSET(14,-8)
+	CFI_DEF_CFA(14,8)
 	move.l	%d2,-(%sp)
+	CFI_OFFSET(2,-12)
 
 	| Make room for all of the new args.
-	sub.l	16(%fp),%sp
+	sub.l	12(%fp),%sp
 
 	| Call ffi_prep_args
-	move.l	12(%fp),-(%sp)
+	move.l	8(%fp),-(%sp)
 	pea	4(%sp)
-	move.l	8(%fp),%a0
-	jsr	(%a0)
+#if !defined __PIC__
+	jsr	ffi_prep_args
+#else
+	bsr.l	ffi_prep_args at PLTPC
+#endif
 	addq.l	#8,%sp	
 
 	| Pass pointer to struct value, if any
 	move.l	%a0,%a1
 
 	| Call the function
-	move.l	32(%fp),%a0
+	move.l	24(%fp),%a0
 	jsr	(%a0)
 
 	| Remove the space we pushed for the args
-	add.l	16(%fp),%sp
+	add.l	12(%fp),%sp
 
 	| Load the pointer to storage for the return value
-	move.l	28(%fp),%a1
+	move.l	20(%fp),%a1
 
 	| Load the return type code 
-	move.l	20(%fp),%d2
+	move.l	16(%fp),%d2
 
 	| If the return value pointer is NULL, assume no return value.
 	tst.l	%a1
@@ -79,19 +99,111 @@
 
 retpointer:
 	btst	#5,%d2
-	jbeq	retstruct
+	jbeq	retstruct1
 	move.l	%a0,(%a1)
 	jbra	epilogue
 
-retstruct:
+retstruct1:
 	btst	#6,%d2
+	jbeq	retstruct2
+	move.b	%d0,(%a1)
+	jbra	epilogue
+
+retstruct2:
+	btst	#7,%d2
 	jbeq	noretval
-	move.l	24(%fp),%d2
-	bfins	%d0,(%a1){#0,%d2}
+	move.w	%d0,(%a1)
 
 noretval:
 epilogue:
 	move.l	(%sp)+,%d2
-	unlk	%a6
+	unlk	%fp
 	rts
+	CFI_ENDPROC()
 	.size	ffi_call_SYSV,.-ffi_call_SYSV
+
+	.globl	ffi_closure_SYSV
+	.type	ffi_closure_SYSV, @function
+	.align	4
+
+ffi_closure_SYSV:
+	CFI_STARTPROC()
+	link	%fp,#-12
+	CFI_OFFSET(14,-8)
+	CFI_DEF_CFA(14,8)
+	move.l	%sp,-12(%fp)
+	pea	8(%fp)
+	pea	-12(%fp)
+	move.l	%a0,-(%sp)
+#if !defined __PIC__
+	jsr	ffi_closure_SYSV_inner
+#else
+	bsr.l	ffi_closure_SYSV_inner at PLTPC
+#endif
+
+	lsr.l	#1,%d0
+	jne	1f
+	jcc	.Lcls_epilogue
+	move.l	-12(%fp),%d0
+.Lcls_epilogue:
+	unlk	%fp
+	rts
+1:
+	lea	-12(%fp),%a0
+	lsr.l	#2,%d0
+	jne	1f
+	jcs	.Lcls_ret_float
+	move.l	(%a0)+,%d0
+	move.l	(%a0),%d1
+	jra	.Lcls_epilogue
+.Lcls_ret_float:
+	fmove.s	(%a0),%fp0
+	jra	.Lcls_epilogue
+1:
+	lsr.l	#2,%d0
+	jne	1f
+	jcs	.Lcls_ret_ldouble
+	fmove.d	(%a0),%fp0
+	jra	.Lcls_epilogue
+.Lcls_ret_ldouble:
+	fmove.x	(%a0),%fp0
+	jra	.Lcls_epilogue
+1:
+	lsr.l	#2,%d0
+	jne	.Lcls_ret_struct2
+	jcs	.Lcls_ret_struct1
+	move.l	(%a0),%a0
+	move.l	%a0,%d0
+	jra	.Lcls_epilogue
+.Lcls_ret_struct1:
+	move.b	(%a0),%d0
+	jra	.Lcls_epilogue
+.Lcls_ret_struct2:
+	move.w	(%a0),%d0
+	jra	.Lcls_epilogue
+	CFI_ENDPROC()
+
+	.size	ffi_closure_SYSV,.-ffi_closure_SYSV
+
+	.globl	ffi_closure_struct_SYSV
+	.type	ffi_closure_struct_SYSV, @function
+	.align	4
+
+ffi_closure_struct_SYSV:
+	CFI_STARTPROC()
+	link	%fp,#0
+	CFI_OFFSET(14,-8)
+	CFI_DEF_CFA(14,8)
+	move.l	%sp,-12(%fp)
+	pea	8(%fp)
+	move.l	%a1,-(%sp)
+	move.l	%a0,-(%sp)
+#if !defined __PIC__
+	jsr	ffi_closure_SYSV_inner
+#else
+	bsr.l	ffi_closure_SYSV_inner at PLTPC
+#endif
+	unlk	%fp
+	rts
+	CFI_ENDPROC()
+	.size	ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffi.c	Fri Feb 22 09:37:07 2008
@@ -2,6 +2,7 @@
    ffi.c - (c) 2003-2004 Randolph Chung <tausq at debian.org>
 
    HPPA Foreign Function Interface
+   HP-UX PA ABI support (c) 2006 Free Software Foundation, Inc.
 
    Permission is hereby granted, free of charge, to any person obtaining
    a copy of this software and associated documentation files (the
@@ -14,13 +15,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
 #include <ffi.h>
@@ -30,15 +32,19 @@
 #include <stdio.h>
 
 #define ROUND_UP(v, a)  (((size_t)(v) + (a) - 1) & ~((a) - 1))
-#define ROUND_DOWN(v, a)  (((size_t)(v) - (a) + 1) & ~((a) - 1))
+
 #define MIN_STACK_SIZE  64
 #define FIRST_ARG_SLOT  9
 #define DEBUG_LEVEL   0
 
-#define fldw(addr, fpreg) asm volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg)
-#define fstw(fpreg, addr) asm volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr))
-#define fldd(addr, fpreg) asm volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg)
-#define fstd(fpreg, addr) asm volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr))
+#define fldw(addr, fpreg) \
+  __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg)
+#define fstw(fpreg, addr) \
+  __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr))
+#define fldd(addr, fpreg) \
+  __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg)
+#define fstd(fpreg, addr) \
+  __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr))
 
 #define debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0)
 
@@ -47,16 +53,19 @@
   size_t sz = t->size;
 
   /* Small structure results are passed in registers,
-     larger ones are passed by pointer.  */
+     larger ones are passed by pointer.  Note that
+     small structures of size 2, 4 and 8 differ from
+     the corresponding integer types in that they have
+     different alignment requirements.  */
 
   if (sz <= 1)
     return FFI_TYPE_UINT8;
   else if (sz == 2)
-    return FFI_TYPE_UINT16;
+    return FFI_TYPE_SMALL_STRUCT2;
   else if (sz == 3)
     return FFI_TYPE_SMALL_STRUCT3;
   else if (sz == 4)
-    return FFI_TYPE_UINT32;
+    return FFI_TYPE_SMALL_STRUCT4;
   else if (sz == 5)
     return FFI_TYPE_SMALL_STRUCT5;
   else if (sz == 6)
@@ -64,61 +73,80 @@
   else if (sz == 7)
     return FFI_TYPE_SMALL_STRUCT7;
   else if (sz <= 8)
-    return FFI_TYPE_UINT64;
+    return FFI_TYPE_SMALL_STRUCT8;
   else
     return FFI_TYPE_STRUCT; /* else, we pass it by pointer.  */
 }
 
 /* PA has a downward growing stack, which looks like this:
-  
+
    Offset
-        [ Variable args ]
+	[ Variable args ]
    SP = (4*(n+9))       arg word N
    ...
    SP-52                arg word 4
-        [ Fixed args ]
+	[ Fixed args ]
    SP-48                arg word 3
    SP-44                arg word 2
    SP-40                arg word 1
    SP-36                arg word 0
-        [ Frame marker ]
+	[ Frame marker ]
    ...
    SP-20                RP
    SP-4                 previous SP
-  
-   First 4 non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23
-   First 2 non-FP 64-bit args are passed in register pairs, starting
-     on an even numbered register (i.e. r26/r25 and r24+r23)
-   First 4 FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L
-   First 2 FP 64-bit arguments are passed in fr5 and fr7
-   The rest are passed on the stack starting at SP-52, but 64-bit
-     arguments need to be aligned to an 8-byte boundary
-  
+
+   The first four argument words on the stack are reserved for use by
+   the callee.  Instead, the general and floating registers replace
+   the first four argument slots.  Non FP arguments are passed solely
+   in the general registers.  FP arguments are passed in both general
+   and floating registers when using libffi.
+
+   Non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23.
+   Non-FP 64-bit args are passed in register pairs, starting
+   on an odd numbered register (i.e. r25+r26 and r23+r24).
+   FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L.
+   FP 64-bit arguments are passed in fr5 and fr7.
+
+   The registers are allocated in the same manner as stack slots.
+   This allows the callee to save its arguments on the stack if
+   necessary:
+
+   arg word 3 -> gr23 or fr7L
+   arg word 2 -> gr24 or fr6L or fr7R
+   arg word 1 -> gr25 or fr5L
+   arg word 0 -> gr26 or fr4L or fr5R
+
+   Note that fr4R and fr6R are never used for arguments (i.e.,
+   doubles are not passed in fr4 or fr6).
+
+   The rest of the arguments are passed on the stack starting at SP-52,
+   but 64-bit arguments need to be aligned to an 8-byte boundary
+
    This means we can have holes either in the register allocation,
    or in the stack.  */
 
 /* ffi_prep_args is called by the assembly routine once stack space
    has been allocated for the function's arguments
-  
+
    The following code will put everything into the stack frame
    (which was allocated by the asm routine), and on return
    the asm routine will load the arguments that should be
    passed by register into the appropriate registers
-  
+
    NOTE: We load floating point args in this function... that means we
    assume gcc will not mess with fp regs in here.  */
 
-/*@-exportheader@*/
-void ffi_prep_args_LINUX(UINT32 *stack, extended_cif *ecif, unsigned bytes)
-/*@=exportheader@*/
+void ffi_prep_args_pa32(UINT32 *stack, extended_cif *ecif, unsigned bytes)
 {
   register unsigned int i;
   register ffi_type **p_arg;
   register void **p_argv;
-  unsigned int slot = FIRST_ARG_SLOT - 1;
+  unsigned int slot = FIRST_ARG_SLOT;
   char *dest_cpy;
+  size_t len;
 
-  debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack, ecif, bytes);
+  debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack,
+	ecif, bytes);
 
   p_arg = ecif->cif->arg_types;
   p_argv = ecif->avalue;
@@ -130,116 +158,105 @@
       switch (type)
 	{
 	case FFI_TYPE_SINT8:
-	  slot++;
 	  *(SINT32 *)(stack - slot) = *(SINT8 *)(*p_argv);
 	  break;
 
 	case FFI_TYPE_UINT8:
-	  slot++;
 	  *(UINT32 *)(stack - slot) = *(UINT8 *)(*p_argv);
 	  break;
 
 	case FFI_TYPE_SINT16:
-	  slot++;
 	  *(SINT32 *)(stack - slot) = *(SINT16 *)(*p_argv);
 	  break;
 
 	case FFI_TYPE_UINT16:
-	  slot++;
 	  *(UINT32 *)(stack - slot) = *(UINT16 *)(*p_argv);
 	  break;
 
 	case FFI_TYPE_UINT32:
 	case FFI_TYPE_SINT32:
 	case FFI_TYPE_POINTER:
-	  slot++;
-	  debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv), slot);
+	  debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv),
+		slot);
 	  *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv);
 	  break;
 
 	case FFI_TYPE_UINT64:
 	case FFI_TYPE_SINT64:
-	  slot += 2;
-	  if (slot & 1)
-	    slot++;
-
-	  *(UINT32 *)(stack - slot) = (*(UINT64 *)(*p_argv)) >> 32;
-	  *(UINT32 *)(stack - slot + 1) = (*(UINT64 *)(*p_argv)) & 0xffffffffUL;
+	  /* Align slot for 64-bit type.  */
+	  slot += (slot & 1) ? 1 : 2;
+	  *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv);
 	  break;
 
 	case FFI_TYPE_FLOAT:
-	  /* First 4 args go in fr4L - fr7L */
-	  slot++;
+	  /* First 4 args go in fr4L - fr7L.  */
+	  debug(3, "Storing UINT32(float) in slot %u\n", slot);
+	  *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv);
 	  switch (slot - FIRST_ARG_SLOT)
 	    {
-	    case 0: fldw(*p_argv, fr4); break;
-	    case 1: fldw(*p_argv, fr5); break;
-	    case 2: fldw(*p_argv, fr6); break;
-	    case 3: fldw(*p_argv, fr7); break;
-	    default:
-	      /* Other ones are just passed on the stack.  */
-	      debug(3, "Storing UINT32(float) in slot %u\n", slot);
-	      *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv);
-	      break;
+	    /* First 4 args go in fr4L - fr7L.  */
+	    case 0: fldw(stack - slot, fr4); break;
+	    case 1: fldw(stack - slot, fr5); break;
+	    case 2: fldw(stack - slot, fr6); break;
+	    case 3: fldw(stack - slot, fr7); break;
 	    }
-	    break;
+	  break;
 
 	case FFI_TYPE_DOUBLE:
-	  slot += 2;
-	  if (slot & 1)
-	    slot++;
-	  switch (slot - FIRST_ARG_SLOT + 1)
+	  /* Align slot for 64-bit type.  */
+	  slot += (slot & 1) ? 1 : 2;
+	  debug(3, "Storing UINT64(double) at slot %u\n", slot);
+	  *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv);
+	  switch (slot - FIRST_ARG_SLOT)
 	    {
-	      /* First 2 args go in fr5, fr7 */
-	      case 2: fldd(*p_argv, fr5); break;
-	      case 4: fldd(*p_argv, fr7); break;
-	      default:
-	        debug(3, "Storing UINT64(double) at slot %u\n", slot);
-	        *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv);
-	        break;
+	      /* First 2 args go in fr5, fr7.  */
+	      case 1: fldd(stack - slot, fr5); break;
+	      case 3: fldd(stack - slot, fr7); break;
 	    }
 	  break;
 
+#ifdef PA_HPUX
+	case FFI_TYPE_LONGDOUBLE:
+	  /* Long doubles are passed in the same manner as structures
+	     larger than 8 bytes.  */
+	  *(UINT32 *)(stack - slot) = (UINT32)(*p_argv);
+	  break;
+#endif
+
 	case FFI_TYPE_STRUCT:
 
 	  /* Structs smaller or equal than 4 bytes are passed in one
 	     register. Structs smaller or equal 8 bytes are passed in two
 	     registers. Larger structures are passed by pointer.  */
 
-	  if((*p_arg)->size <= 4) 
+	  len = (*p_arg)->size;
+	  if (len <= 4)
 	    {
-	      slot++;
-	      dest_cpy = (char *)(stack - slot);
-	      dest_cpy += 4 - (*p_arg)->size;
-	      memcpy((char *)dest_cpy, (char *)*p_argv, (*p_arg)->size);
+	      dest_cpy = (char *)(stack - slot) + 4 - len;
+	      memcpy(dest_cpy, (char *)*p_argv, len);
 	    }
-	  else if ((*p_arg)->size <= 8) 
+	  else if (len <= 8)
 	    {
-	      slot += 2;
-	      if (slot & 1)
-	        slot++;
-	      dest_cpy = (char *)(stack - slot);
-	      dest_cpy += 8 - (*p_arg)->size;
-	      memcpy((char *)dest_cpy, (char *)*p_argv, (*p_arg)->size);
-	    } 
-	  else 
-	    {
-	      slot++;
-	      *(UINT32 *)(stack - slot) = (UINT32)(*p_argv);
+	      slot += (slot & 1) ? 1 : 2;
+	      dest_cpy = (char *)(stack - slot) + 8 - len;
+	      memcpy(dest_cpy, (char *)*p_argv, len);
 	    }
+	  else
+	    *(UINT32 *)(stack - slot) = (UINT32)(*p_argv);
 	  break;
 
 	default:
 	  FFI_ASSERT(0);
 	}
 
+      slot++;
       p_arg++;
       p_argv++;
     }
 
   /* Make sure we didn't mess up and scribble on the stack.  */
   {
-    int n;
+    unsigned int n;
 
     debug(5, "Stack setup:\n");
     for (n = 0; n < (bytes + 3) / 4; n++)
@@ -255,7 +272,7 @@
   return;
 }
 
-static void ffi_size_stack_LINUX(ffi_cif *cif)
+static void ffi_size_stack_pa32(ffi_cif *cif)
 {
   ffi_type **ptr;
   int i;
@@ -273,6 +290,9 @@
 	  z += 2 + (z & 1); /* must start on even regs, so we may waste one */
 	  break;
 
+#ifdef PA_HPUX
+	case FFI_TYPE_LONGDOUBLE:
+#endif
 	case FFI_TYPE_STRUCT:
 	  z += 1; /* pass by ptr, callee will copy */
 	  break;
@@ -304,6 +324,13 @@
       cif->flags = (unsigned) cif->rtype->type;
       break;
 
+#ifdef PA_HPUX
+    case FFI_TYPE_LONGDOUBLE:
+      /* Long doubles are treated like a structure.  */
+      cif->flags = FFI_TYPE_STRUCT;
+      break;
+#endif
+
     case FFI_TYPE_STRUCT:
       /* For the return type we have to check the size of the structures.
 	 If the size is smaller or equal 4 bytes, the result is given back
@@ -327,8 +354,8 @@
      own stack sizing.  */
   switch (cif->abi)
     {
-    case FFI_LINUX:
-      ffi_size_stack_LINUX(cif);
+    case FFI_PA32:
+      ffi_size_stack_pa32(cif);
       break;
 
     default:
@@ -339,20 +366,11 @@
   return FFI_OK;
 }
 
-/*@-declundef@*/
-/*@-exportheader@*/
-extern void ffi_call_LINUX(void (*)(UINT32 *, extended_cif *, unsigned),
-			   /*@out@*/ extended_cif *,
-			   unsigned, unsigned,
-			   /*@out@*/ unsigned *,
-			   void (*fn)(void));
-/*@=declundef@*/
-/*@=exportheader@*/
-
-void ffi_call(/*@dependent@*/ ffi_cif *cif,
-	      void (*fn)(void),
-	      /*@out@*/ void *rvalue,
-	      /*@dependent@*/ void **avalue)
+extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned),
+			  extended_cif *, unsigned, unsigned, unsigned *,
+			  void (*fn)(void));
+
+void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   extended_cif ecif;
 
@@ -362,12 +380,15 @@
   /* If the return value is a struct and we don't have a return
      value address then we need to make one.  */
 
-  if ((rvalue == NULL) &&
-      (cif->rtype->type == FFI_TYPE_STRUCT))
+  if (rvalue == NULL
+#ifdef PA_HPUX
+      && (cif->rtype->type == FFI_TYPE_STRUCT
+	  || cif->rtype->type == FFI_TYPE_LONGDOUBLE))
+#else
+      && cif->rtype->type == FFI_TYPE_STRUCT)
+#endif
     {
-      /*@-sysunrecog@*/
       ecif.rvalue = alloca(cif->rtype->size);
-      /*@=sysunrecog@*/
     }
   else
     ecif.rvalue = rvalue;
@@ -375,12 +396,10 @@
 
   switch (cif->abi)
     {
-    case FFI_LINUX:
-      /*@-usedef@*/
-      debug(2, "Calling ffi_call_LINUX: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn);
-      ffi_call_LINUX(ffi_prep_args_LINUX, &ecif, cif->bytes,
+    case FFI_PA32:
+      debug(3, "Calling ffi_call_pa32: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn);
+      ffi_call_pa32(ffi_prep_args_pa32, &ecif, cif->bytes,
 		     cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
       break;
 
     default:
@@ -394,7 +413,7 @@
    the stack, and we need to fill them into a cif structure and invoke
    the user function. This really ought to be in asm to make sure
    the compiler doesn't do things we don't expect.  */
-UINT32 ffi_closure_inner_LINUX(ffi_closure *closure, UINT32 *stack)
+ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack)
 {
   ffi_cif *cif;
   void **avalue;
@@ -402,7 +421,8 @@
   UINT32 ret[2]; /* function can return up to 64-bits in registers */
   ffi_type **p_arg;
   char *tmp;
-  int i, avn, slot = FIRST_ARG_SLOT - 1;
+  int i, avn;
+  unsigned int slot = FIRST_ARG_SLOT;
   register UINT32 r28 asm("r28");
 
   cif = closure->cif;
@@ -430,20 +450,23 @@
 	case FFI_TYPE_SINT32:
 	case FFI_TYPE_UINT32:
 	case FFI_TYPE_POINTER:
-	  slot++;
 	  avalue[i] = (char *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size;
 	  break;
 
 	case FFI_TYPE_SINT64:
 	case FFI_TYPE_UINT64:
-	  slot += 2;
-	  if (slot & 1)
-	    slot++;
+	  slot += (slot & 1) ? 1 : 2;
 	  avalue[i] = (void *)(stack - slot);
 	  break;
 
 	case FFI_TYPE_FLOAT:
-	  slot++;
+#ifdef PA_LINUX
+	  /* The closure call is indirect.  In Linux, floating point
+	     arguments in indirect calls with a prototype are passed
+	     in the floating point registers instead of the general
+	     registers.  So, we need to replace what was previously
+	     stored in the current slot with the value in the
+	     corresponding floating point register.  */
 	  switch (slot - FIRST_ARG_SLOT)
 	    {
 	    case 0: fstw(fr4, (void *)(stack - slot)); break;
@@ -451,18 +474,20 @@
 	    case 2: fstw(fr6, (void *)(stack - slot)); break;
 	    case 3: fstw(fr7, (void *)(stack - slot)); break;
 	    }
+#endif
 	  avalue[i] = (void *)(stack - slot);
 	  break;
 
 	case FFI_TYPE_DOUBLE:
-	  slot += 2;
-	  if (slot & 1)
-	    slot++;
-	  switch (slot - FIRST_ARG_SLOT + 1)
+	  slot += (slot & 1) ? 1 : 2;
+#ifdef PA_LINUX
+	  /* See previous comment for FFI_TYPE_FLOAT.  */
+	  switch (slot - FIRST_ARG_SLOT)
 	    {
-	    case 2: fstd(fr5, (void *)(stack - slot)); break;
-	    case 4: fstd(fr7, (void *)(stack - slot)); break;
+	    case 1: fstd(fr5, (void *)(stack - slot)); break;
+	    case 3: fstd(fr7, (void *)(stack - slot)); break;
 	    }
+#endif
 	  avalue[i] = (void *)(stack - slot);
 	  break;
 
@@ -470,35 +495,36 @@
 	  /* Structs smaller or equal than 4 bytes are passed in one
 	     register. Structs smaller or equal 8 bytes are passed in two
 	     registers. Larger structures are passed by pointer.  */
-	  if((*p_arg)->size <= 4) {
-	    slot++;
-	    avalue[i] = (void *)(stack - slot) + sizeof(UINT32) -
-	      (*p_arg)->size;
-	  } else if ((*p_arg)->size <= 8) {
-	    slot += 2;
-	    if (slot & 1)
-	      slot++;
-	    avalue[i] = (void *)(stack - slot) + sizeof(UINT64) -
-	      (*p_arg)->size;
-	  } else {
-	    slot++;
+	  if((*p_arg)->size <= 4)
+	    {
+	      avalue[i] = (void *)(stack - slot) + sizeof(UINT32) -
+		(*p_arg)->size;
+	    }
+	  else if ((*p_arg)->size <= 8)
+	    {
+	      slot += (slot & 1) ? 1 : 2;
+	      avalue[i] = (void *)(stack - slot) + sizeof(UINT64) -
+		(*p_arg)->size;
+	    }
+	  else
 	    avalue[i] = (void *) *(stack - slot);
-	  }
 	  break;
 
 	default:
 	  FFI_ASSERT(0);
 	}
 
+      slot++;
       p_arg++;
     }
 
   /* Invoke the closure.  */
   (closure->fun) (cif, rvalue, avalue, closure->user_data);
 
-  debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0], ret[1]);
+  debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0],
+	ret[1]);
 
-  /* Store the result */
+  /* Store the result using the lower 2 bytes of the flags.  */
   switch (cif->flags)
     {
     case FFI_TYPE_UINT8:
@@ -536,7 +562,9 @@
       /* Don't need a return value, done by caller.  */
       break;
 
+    case FFI_TYPE_SMALL_STRUCT2:
     case FFI_TYPE_SMALL_STRUCT3:
+    case FFI_TYPE_SMALL_STRUCT4:
       tmp = (void*)(stack -  FIRST_ARG_SLOT);
       tmp += 4 - cif->rtype->size;
       memcpy((void*)tmp, &ret[0], cif->rtype->size);
@@ -545,6 +573,7 @@
     case FFI_TYPE_SMALL_STRUCT5:
     case FFI_TYPE_SMALL_STRUCT6:
     case FFI_TYPE_SMALL_STRUCT7:
+    case FFI_TYPE_SMALL_STRUCT8:
       {
 	unsigned int ret2[2];
 	int off;
@@ -582,39 +611,93 @@
    cif specifies the argument and result types for fun.
    The cif must already be prep'ed.  */
 
-void ffi_closure_LINUX(void);
+extern void ffi_closure_pa32(void);
 
 ffi_status
-ffi_prep_closure (ffi_closure* closure,
-		  ffi_cif* cif,
-		  void (*fun)(ffi_cif*,void*,void**,void*),
-		  void *user_data)
+ffi_prep_closure_loc (ffi_closure* closure,
+		      ffi_cif* cif,
+		      void (*fun)(ffi_cif*,void*,void**,void*),
+		      void *user_data,
+		      void *codeloc)
 {
   UINT32 *tramp = (UINT32 *)(closure->tramp);
+#ifdef PA_HPUX
+  UINT32 *tmp;
+#endif
 
-  FFI_ASSERT (cif->abi == FFI_LINUX);
+  FFI_ASSERT (cif->abi == FFI_PA32);
 
   /* Make a small trampoline that will branch to our
      handler function. Use PC-relative addressing.  */
 
-  tramp[0] = 0xeaa00000; /* b,l  .+8, %r21      ; %r21 <- pc+8 */
-  tramp[1] = 0xd6a01c1e; /* depi 0,31,2, %r21   ; mask priv bits */
-  tramp[2] = 0x4aa10028; /* ldw  20(%r21), %r1  ; load plabel */
-  tramp[3] = 0x36b53ff1; /* ldo  -8(%r21), %r21 ; get closure addr */
-  tramp[4] = 0x0c201096; /* ldw  0(%r1), %r22   ; address of handler */
-  tramp[5] = 0xeac0c000; /* bv	 %r0(%r22)      ; branch to handler */
-  tramp[6] = 0x0c281093; /* ldw  4(%r1), %r19   ; GP of handler */
-  tramp[7] = ((UINT32)(ffi_closure_LINUX) & ~2);
+#ifdef PA_LINUX
+  tramp[0] = 0xeaa00000; /* b,l .+8,%r21        ; %r21 <- pc+8 */
+  tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21    ; mask priv bits */
+  tramp[2] = 0x4aa10028; /* ldw 20(%r21),%r1    ; load plabel */
+  tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21   ; get closure addr */
+  tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22     ; address of handler */
+  tramp[5] = 0xeac0c000; /* bv%r0(%r22)         ; branch to handler */
+  tramp[6] = 0x0c281093; /* ldw 4(%r1),%r19     ; GP of handler */
+  tramp[7] = ((UINT32)(ffi_closure_pa32) & ~2);
 
   /* Flush d/icache -- have to flush up 2 two lines because of
      alignment.  */
-  asm volatile (
-		"fdc 0(%0)\n"
-		"fdc %1(%0)\n"
-		"fic 0(%%sr4, %0)\n"
-		"fic %1(%%sr4, %0)\n"
-		"sync\n"
-		: : "r"((unsigned long)tramp & ~31), "r"(32 /* stride */));
+  __asm__ volatile(
+		   "fdc 0(%0)\n\t"
+		   "fdc %1(%0)\n\t"
+		   "fic 0(%%sr4, %0)\n\t"
+		   "fic %1(%%sr4, %0)\n\t"
+		   "sync\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n"
+		   :
+		   : "r"((unsigned long)tramp & ~31),
+		     "r"(32 /* stride */)
+		   : "memory");
+#endif
+
+#ifdef PA_HPUX
+  tramp[0] = 0xeaa00000; /* b,l .+8,%r21        ; %r21 <- pc+8  */
+  tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21    ; mask priv bits  */
+  tramp[2] = 0x4aa10038; /* ldw 28(%r21),%r1    ; load plabel  */
+  tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21   ; get closure addr  */
+  tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22     ; address of handler  */
+  tramp[5] = 0x02c010b4; /* ldsid (%r22),%r20   ; load space id  */
+  tramp[6] = 0x00141820; /* mtsp %r20,%sr0      ; into %sr0  */
+  tramp[7] = 0xe2c00000; /* be 0(%sr0,%r22)     ; branch to handler  */
+  tramp[8] = 0x0c281093; /* ldw 4(%r1),%r19     ; GP of handler  */
+  tramp[9] = ((UINT32)(ffi_closure_pa32) & ~2);
+
+  /* Flush d/icache -- have to flush three lines because of alignment.  */
+  __asm__ volatile(
+		   "copy %1,%0\n\t"
+		   "fdc,m %2(%0)\n\t"
+		   "fdc,m %2(%0)\n\t"
+		   "fdc,m %2(%0)\n\t"
+		   "ldsid (%1),%0\n\t"
+		   "mtsp %0,%%sr0\n\t"
+		   "copy %1,%0\n\t"
+		   "fic,m %2(%%sr0,%0)\n\t"
+		   "fic,m %2(%%sr0,%0)\n\t"
+		   "fic,m %2(%%sr0,%0)\n\t"
+		   "sync\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n\t"
+		   "nop\n"
+		   : "=&r" ((unsigned long)tmp)
+		   : "r" ((unsigned long)tramp & ~31),
+		     "r" (32/* stride */)
+		   : "memory");
+#endif
 
   closure->cif  = cif;
   closure->user_data = user_data;

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/ffitarget.h	Fri Feb 22 09:37:07 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 
@@ -35,9 +36,20 @@
 typedef enum ffi_abi {
   FFI_FIRST_ABI = 0,
 
-#ifdef PA
-  FFI_LINUX,
-  FFI_DEFAULT_ABI = FFI_LINUX,
+#ifdef PA_LINUX
+  FFI_PA32,
+  FFI_DEFAULT_ABI = FFI_PA32,
+#endif
+
+#ifdef PA_HPUX
+  FFI_PA32,
+  FFI_DEFAULT_ABI = FFI_PA32,
+#endif
+
+#ifdef PA64_HPUX
+#error "PA64_HPUX FFI is not yet implemented"
+  FFI_PA64,
+  FFI_DEFAULT_ABI = FFI_PA64,
 #endif
 
   FFI_LAST_ABI = FFI_DEFAULT_ABI + 1
@@ -49,11 +61,17 @@
 #define FFI_CLOSURES 1
 #define FFI_NATIVE_RAW_API 0
 
+#ifdef PA_LINUX
 #define FFI_TRAMPOLINE_SIZE 32
-
-#define FFI_TYPE_SMALL_STRUCT3 -1
-#define FFI_TYPE_SMALL_STRUCT5 -2
-#define FFI_TYPE_SMALL_STRUCT6 -3
-#define FFI_TYPE_SMALL_STRUCT7 -4
+#else
+#define FFI_TRAMPOLINE_SIZE 40
 #endif
 
+#define FFI_TYPE_SMALL_STRUCT2 -1
+#define FFI_TYPE_SMALL_STRUCT3 -2
+#define FFI_TYPE_SMALL_STRUCT4 -3
+#define FFI_TYPE_SMALL_STRUCT5 -4
+#define FFI_TYPE_SMALL_STRUCT6 -5
+#define FFI_TYPE_SMALL_STRUCT7 -6
+#define FFI_TYPE_SMALL_STRUCT8 -7
+#endif

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/linux.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/linux.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/pa/linux.S	Fri Feb 22 09:37:07 2008
@@ -17,7 +17,8 @@
    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+	ANY CLAIM, DAMAGES OR
    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.
@@ -31,7 +32,7 @@
 	.level 1.1
 	.align 4
 
-	/* void ffi_call_LINUX(void (*)(char *, extended_cif *),
+	/* void ffi_call_pa32(void (*)(char *, extended_cif *),
 			       extended_cif *ecif,
 			       unsigned bytes,
 			       unsigned flags,
@@ -39,12 +40,12 @@
 			       void (*fn)());
 	 */
 
-	.export ffi_call_LINUX,code
-	.import ffi_prep_args_LINUX,code
+	.export ffi_call_pa32,code
+	.import ffi_prep_args_pa32,code
 
-	.type ffi_call_LINUX, @function
+	.type ffi_call_pa32, @function
 .LFB1:
-ffi_call_LINUX:
+ffi_call_pa32:
 	.proc
 	.callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4
 	.entry
@@ -63,7 +64,7 @@
 	   [ 64-bytes register save area               ] <- %r4
 
 	   [ Stack space for actual call, passed as    ] <- %arg0
-	   [     arg0 to ffi_prep_args_LINUX           ]
+	   [     arg0 to ffi_prep_args_pa32           ]
 
 	   [ Stack for calling prep_args               ] <- %sp
 	 */
@@ -73,14 +74,14 @@
 .LCFI13:
 	copy %sp, %r4
 
-	addl %arg2, %r4, %arg0                  /* arg stack */
-	stw %arg3, -48(%r3)                     /* save flags; we need it later */
+	addl %arg2, %r4, %arg0      /* arg stack */
+	stw %arg3, -48(%r3)         /* save flags; we need it later */
 
 	/* Call prep_args:
 	   %arg0(stack) -- set up above
 	   %arg1(ecif) -- same as incoming param
 	   %arg2(bytes) -- same as incoming param */
-	bl ffi_prep_args_LINUX,%r2
+	bl ffi_prep_args_pa32,%r2
 	ldo 64(%arg0), %sp
 	ldo -64(%sp), %sp
 
@@ -106,90 +107,139 @@
 
 	/* Store the result according to the return type.  */
 
-checksmst3:
-	comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, checksmst567
-	/* 3-byte structs are returned in ret0 as ??xxyyzz.  Shift
-	   left 8 bits to write to the result structure.  */
-	zdep %ret0, 23, 24, %r22
-	b done
-	stw %r22, 0(%r20)
-
-checksmst567:
-	/* 5-7 byte values are returned right justified:
+.Lcheckint:
+	comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8
+	b	.Ldone
+	stw	%ret0, 0(%r20)
+
+.Lcheckint8:
+	comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16
+	b	.Ldone
+	stb	%ret0, 0(%r20)
+
+.Lcheckint16:
+	comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl
+	b	.Ldone
+	sth	%ret0, 0(%r20)
+
+.Lcheckdbl:
+	comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat
+	b	.Ldone
+	fstd	%fr4,0(%r20)
+
+.Lcheckfloat:
+	comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll
+	b	.Ldone
+	fstw	%fr4L,0(%r20)
+
+.Lcheckll:
+	comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2
+	stw	%ret0, 0(%r20)
+	b	.Ldone
+	stw	%ret1, 4(%r20)
+
+.Lchecksmst2:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3
+	/* 2-byte structs are returned in ret0 as ????xxyy.  */
+	extru	%ret0, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	b	.Ldone
+	stb	%ret0, 0(%r20)
+
+.Lchecksmst3:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4
+	/* 3-byte structs are returned in ret0 as ??xxyyzz.  */
+	extru	%ret0, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret0, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	b	.Ldone
+	stb	%ret0, 0(%r20)
+
+.Lchecksmst4:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5
+	/* 4-byte structs are returned in ret0 as wwxxyyzz.  */
+	extru	%ret0, 7, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret0, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret0, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	b	.Ldone
+	stb	%ret0, 0(%r20)
+
+.Lchecksmst5:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6
+	/* 5 byte values are returned right justified:
+	      ret0     ret1
+	   5: ??????aa bbccddee */
+	stbs,ma	%ret0, 1(%r20)
+	extru	%ret1, 7, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	b	.Ldone
+	stb	%ret1, 0(%r20)
+
+.Lchecksmst6:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7
+	/* 6 byte values are returned right justified:
+	      ret0     ret1
+	   6: ????aabb ccddeeff */
+	extru	%ret0, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	stbs,ma	%ret0, 1(%r20)
+	extru	%ret1, 7, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	b	.Ldone
+	stb	%ret1, 0(%r20)
+
+.Lchecksmst7:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8
+	/* 7 byte values are returned right justified:
 	      ret0     ret1
-	   5: ??????aa bbccddee
-	   6: ????aabb ccddeeff
-	   7: ??aabbcc ddeeffgg
-
-	   To store this in the result, write the first 4 bytes into a temp
-	   register using shrpw (t1 = aabbccdd), followed by a rotation of
-	   ret1:
-
-	      ret0     ret1	   ret1
-	   5: ??????aa bbccddee -> eebbccdd (rotate 8)
-	   6: ????aabb ccddeeff -> eeffccdd (rotate 16)
-	   7: ??aabbcc ddeeffgg -> eeffggdd (rotate 24)
-
-	   then we write (t1, ret1) into the result.  */
-
-	addi,<> -FFI_TYPE_SMALL_STRUCT5,%r21,%r0
-	ldi 8, %r22
-	addi,<> -FFI_TYPE_SMALL_STRUCT6,%r21,%r0
-	ldi 16, %r22
-	addi,<> -FFI_TYPE_SMALL_STRUCT7,%r21,%r0
-	ldi 24, %r22
-
-	/* This relies on all the FFI_TYPE_*_STRUCT* defines being <0 */
-	cmpib,<=,n 0, %r21, checkint8
-	mtsar %r22
-
-	shrpw %ret0, %ret1, %sar, %ret0  /* ret0 = aabbccdd */
-	shrpw %ret1, %ret1, %sar, %ret1  /* rotate ret1 */
-	
-	stw %ret0, 0(%r20)
-	b done
-	stw %ret1, 4(%r20)
-
-checkint8:
-	comib,<>,n FFI_TYPE_UINT8, %r21, checkint16
-	b done
-	stb %ret0, 0(%r20)
-
-checkint16:
-	comib,<>,n FFI_TYPE_UINT16, %r21, checkint32
-	b done
-	sth %ret0, 0(%r20)
-
-checkint32:
-	comib,<>,n FFI_TYPE_UINT32, %r21, checkint
-	b done
-	stw %ret0, 0(%r20)
-
-checkint:
-	comib,<>,n FFI_TYPE_INT, %r21, checkll
-	b done
-	stw %ret0, 0(%r20)
-
-checkll:
-	comib,<>,n FFI_TYPE_UINT64, %r21, checkdbl
-	stw %ret0, 0(%r20)
-	b done
-	stw %ret1, 4(%r20)
-
-checkdbl:
-	comib,<>,n FFI_TYPE_DOUBLE, %r21, checkfloat
-	b done
-	fstd %fr4,0(%r20)
-
-checkfloat:
-	comib,<>,n FFI_TYPE_FLOAT, %r21, done
-	fstw %fr4L,0(%r20)
-
-	/* structure returns are either handled by one of the
-	   INT/UINT64 cases above, or, if passed by pointer,
-	   is handled by the callee.  */
+	   7: ??aabbcc ddeeffgg */
+	extru	%ret0, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret0, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	stbs,ma	%ret0, 1(%r20)
+	extru	%ret1, 7, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	b	.Ldone
+	stb	%ret1, 0(%r20)
+
+.Lchecksmst8:
+	comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone
+	/* 8 byte values are returned right justified:
+	      ret0     ret1
+	   8: aabbccdd eeffgghh */
+	extru	%ret0, 7, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret0, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret0, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	stbs,ma	%ret0, 1(%r20)
+	extru	%ret1, 7, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 15, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	extru	%ret1, 23, 8, %r22
+	stbs,ma	%r22, 1(%r20)
+	stb	%ret1, 0(%r20)
 
-done:
+.Ldone:
 	/* all done, return */
 	copy %r4, %sp                           /* pop arg stack */
 	ldw 12(%r3), %r4
@@ -201,14 +251,14 @@
 	.procend
 .LFE1:
 
-	/* void ffi_closure_LINUX(void);
+	/* void ffi_closure_pa32(void);
 	   Called with closure argument in %r21 */
-	.export ffi_closure_LINUX,code
-	.import ffi_closure_inner_LINUX,code
+	.export ffi_closure_pa32,code
+	.import ffi_closure_inner_pa32,code
 
-	.type ffi_closure_LINUX, @function
+	.type ffi_closure_pa32, @function
 .LFB2:
-ffi_closure_LINUX:
+ffi_closure_pa32:
 	.proc
 	.callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3
 	.entry
@@ -228,7 +278,7 @@
 	stw %arg3, -48(%r3)
 
 	copy %r21, %arg0
-	bl ffi_closure_inner_LINUX, %r2
+	bl ffi_closure_inner_pa32, %r2
 	copy %r3, %arg1
 
 	ldwm -64(%sp), %r3
@@ -299,7 +349,7 @@
 	.sleb128 -5
 
 	.byte   0x4     ;# DW_CFA_advance_loc4
-	.word   .LCFI12-.LCFI11
+	.word   .LCFI22-.LCFI21
 	.byte   0xd     ;# DW_CFA_def_cfa_register = r3
 	.uleb128 0x3
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffi.c	Fri Feb 22 09:37:07 2008
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   ffi.c - Copyright (c) 2002, 2003, 2004, 2005 Kaz Kojima
+   ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007 Kaz Kojima
    
    SuperH Foreign Function Interface 
 
@@ -14,13 +14,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
 #include <ffi.h>
@@ -106,9 +107,7 @@
 /* ffi_prep_args is called by the assembly routine once stack space
    has been allocated for the function's arguments */
 
-/*@-exportheader@*/
 void ffi_prep_args(char *stack, extended_cif *ecif)
-/*@=exportheader@*/
 {
   register unsigned int i;
   register int tmp;
@@ -406,20 +405,10 @@
   return FFI_OK;
 }
 
-/*@-declundef@*/
-/*@-exportheader@*/
-extern void ffi_call_SYSV(void (*)(char *, extended_cif *), 
-			  /*@out@*/ extended_cif *, 
-			  unsigned, unsigned, 
-			  /*@out@*/ unsigned *, 
-			  void (*fn)());
-/*@=declundef@*/
-/*@=exportheader@*/
-
-void ffi_call(/*@dependent@*/ ffi_cif *cif, 
-	      void (*fn)(), 
-	      /*@out@*/ void *rvalue, 
-	      /*@dependent@*/ void **avalue)
+extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *,
+			  unsigned, unsigned, unsigned *, void (*fn)(void));
+
+void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
   extended_cif ecif;
   UINT64 trvalue;
@@ -436,9 +425,7 @@
   else if ((rvalue == NULL) && 
       (cif->rtype->type == FFI_TYPE_STRUCT))
     {
-      /*@-sysunrecog@*/
       ecif.rvalue = alloca(cif->rtype->size);
-      /*@=sysunrecog@*/
     }
   else
     ecif.rvalue = rvalue;
@@ -446,10 +433,8 @@
   switch (cif->abi) 
     {
     case FFI_SYSV:
-      /*@-usedef@*/
-      ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, 
-		    cif->flags, ecif.rvalue, fn);
-      /*@=usedef@*/
+      ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue,
+		    fn);
       break;
     default:
       FFI_ASSERT(0);
@@ -468,10 +453,11 @@
 #endif
 
 ffi_status
-ffi_prep_closure (ffi_closure* closure,
-		  ffi_cif* cif,
-		  void (*fun)(ffi_cif*, void*, void**, void*),
-		  void *user_data)
+ffi_prep_closure_loc (ffi_closure* closure,
+		      ffi_cif* cif,
+		      void (*fun)(ffi_cif*, void*, void**, void*),
+		      void *user_data,
+		      void *codeloc)
 {
   unsigned int *tramp;
   unsigned short insn;
@@ -491,7 +477,7 @@
   tramp[0] = 0xd102d301;
   tramp[1] = 0x412b0000 | insn;
 #endif
-  *(void **) &tramp[2] = (void *)closure;          /* ctx */
+  *(void **) &tramp[2] = (void *)codeloc;          /* ctx */
   *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */
 
   closure->cif = cif;
@@ -500,7 +486,7 @@
 
 #if defined(__SH4__)
   /* Flush the icache.  */
-  __ic_invalidate(&closure->tramp[0]);
+  __ic_invalidate(codeloc);
 #endif
 
   return FFI_OK;
@@ -535,7 +521,6 @@
   int freg = 0;
 #endif
   ffi_cif *cif; 
-  double temp; 
 
   cif = closure->cif;
   avalue = alloca(cif->nargs * sizeof(void *));
@@ -544,7 +529,7 @@
      returns the data directly to the caller.  */
   if (cif->rtype->type == FFI_TYPE_STRUCT && STRUCT_VALUE_ADDRESS_WITH_ARG)
     {
-      rvalue = *pgr++;
+      rvalue = (void *) *pgr++;
       ireg = 1;
     }
   else
@@ -611,6 +596,8 @@
 	{
 	  if (freg + 1 >= NFREGARG)
 	    continue;
+	  if (freg & 1)
+	    pfr++;
 	  freg = (freg + 1) & ~1;
 	  freg += 2;
 	  avalue[i] = pfr;

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/ffitarget.h	Fri Feb 22 09:37:07 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/sysv.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/sysv.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh/sysv.S	Fri Feb 22 09:37:07 2008
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------
-   sysv.S - Copyright (c) 2002, 2003, 2004 Kaz Kojima
+   sysv.S - Copyright (c) 2002, 2003, 2004, 2006 Kaz Kojima
    
    SuperH Foreign Function Interface 
 
@@ -17,7 +17,8 @@
    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+	ANY CLAIM, DAMAGES OR
    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.
@@ -829,13 +830,13 @@
 	.byte	0x6	/* uleb128 0x6 */
 	.byte	0x8e	/* DW_CFA_offset, column 0xe */
 	.byte	0x5	/* uleb128 0x5 */
-	.byte	0x8b	/* DW_CFA_offset, column 0xb */
+	.byte	0x84	/* DW_CFA_offset, column 0x4 */
 	.byte	0x4	/* uleb128 0x4 */
-	.byte	0x8a	/* DW_CFA_offset, column 0xa */
+	.byte	0x85	/* DW_CFA_offset, column 0x5 */
 	.byte	0x3	/* uleb128 0x3 */
-	.byte	0x89	/* DW_CFA_offset, column 0x9 */
+	.byte	0x86	/* DW_CFA_offset, column 0x6 */
 	.byte	0x2	/* uleb128 0x2 */
-	.byte	0x88	/* DW_CFA_offset, column 0x8 */
+	.byte	0x87	/* DW_CFA_offset, column 0x7 */
 	.byte	0x1	/* uleb128 0x1 */
 	.byte	0x4	/* DW_CFA_advance_loc4 */
 	.4byte	.LCFIE-.LCFID

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffi.c
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffi.c	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffi.c	Fri Feb 22 09:37:07 2008
@@ -14,13 +14,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
    ----------------------------------------------------------------------- */
 
 #include <ffi.h>
@@ -238,12 +239,12 @@
 			  /*@out@*/ extended_cif *, 
 			  unsigned, unsigned, long long,
 			  /*@out@*/ unsigned *, 
-			  void (*fn)());
+			  void (*fn)(void));
 /*@=declundef@*/
 /*@=exportheader@*/
 
 void ffi_call(/*@dependent@*/ ffi_cif *cif, 
-	      void (*fn)(), 
+	      void (*fn)(void), 
 	      /*@out@*/ void *rvalue, 
 	      /*@dependent@*/ void **avalue)
 {

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffitarget.h
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffitarget.h	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/ffitarget.h	Fri Feb 22 09:37:07 2008
@@ -13,13 +13,14 @@
    The above copyright notice and this permission notice shall be included
    in all copies or substantial portions of the Software.
 
-   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
-   OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
-   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
-   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
-   OTHER DEALINGS IN THE SOFTWARE.
+   THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND,
+   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+   NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+   HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+   WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+   OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+   DEALINGS IN THE SOFTWARE.
 
    ----------------------------------------------------------------------- */
 

Modified: python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/sysv.S
==============================================================================
--- python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/sysv.S	(original)
+++ python/branches/libffi3-branch/Modules/_ctypes/libffi/src/sh64/sysv.S	Fri Feb 22 09:37:07 2008
@@ -17,7 +17,8 @@
    THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS
    OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
    MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-   IN NO EVENT SHALL CYGNUS SOLUTIONS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+   IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
+	ANY CLAIM, DAMAGES OR
    OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
    ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
    OTHER DEALINGS IN THE SOFTWARE.


More information about the Python-checkins mailing list