Commit b55baf0b500ccc7636a8a55e0506d9da787ad2dd

Anthony Green 2018-05-09T13:21:02

Handle FFI_GNUW64 on non-Windows systems (EFI)

diff --git a/src/x86/ffi64.c b/src/x86/ffi64.c
index e46974d..41d6acd 100644
--- a/src/x86/ffi64.c
+++ b/src/x86/ffi64.c
@@ -1,6 +1,6 @@
 /* -----------------------------------------------------------------------
-   ffi64.c - Copyright (c) 2013  The Written Word, Inc.
-             Copyright (c) 2011  Anthony Green
+   ffi64.c - Copyright (c) 2011, 2018  Anthony Green
+             Copyright (c) 2013  The Written Word, Inc.
              Copyright (c) 2008, 2010  Red Hat, Inc.
              Copyright (c) 2002, 2007  Bo Thorsen <bo@suse.de>
 
@@ -404,7 +404,7 @@ ffi_prep_cif_machdep (ffi_cif *cif)
   ffi_type *rtype;
 
 #ifndef __ILP32__
-  if (cif->abi == FFI_EFI64)
+  if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
     return ffi_prep_cif_machdep_efi64(cif);
 #endif
   if (cif->abi != FFI_UNIX64)
@@ -677,7 +677,7 @@ void
 ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue)
 {
 #ifndef __ILP32__
-  if (cif->abi == FFI_EFI64)
+  if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
     {
       ffi_call_efi64(cif, fn, rvalue, avalue);
       return;
@@ -697,7 +697,7 @@ ffi_call_go (ffi_cif *cif, void (*fn)(void), void *rvalue,
 	     void **avalue, void *closure)
 {
 #ifndef __ILP32__
-  if (cif->abi == FFI_EFI64)
+  if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
     {
       ffi_call_go_efi64(cif, fn, rvalue, avalue, closure);
       return;
@@ -738,7 +738,7 @@ ffi_prep_closure_loc (ffi_closure* closure,
   char *tramp = closure->tramp;
 
 #ifndef __ILP32__
-  if (cif->abi == FFI_EFI64)
+  if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
     return ffi_prep_closure_loc_efi64(closure, cif, fun, user_data, codeloc);
 #endif
   if (cif->abi != FFI_UNIX64)
@@ -866,7 +866,7 @@ ffi_prep_go_closure (ffi_go_closure* closure, ffi_cif* cif,
 		     void (*fun)(ffi_cif*, void*, void**, void*))
 {
 #ifndef __ILP32__
-  if (cif->abi == FFI_EFI64)
+  if (cif->abi == FFI_EFI64 || cif->abi == FFI_GNUW64)
     return ffi_prep_go_closure_efi64(closure, cif, fun);
 #endif
   if (cif->abi != FFI_UNIX64)