]> git.proxmox.com Git - mirror_edk2.git/commitdiff
UnixPkg: Enable gasket functions for all X64 toolchains
authorjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Oct 2010 07:06:42 +0000 (07:06 +0000)
committerjljusten <jljusten@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 13 Oct 2010 07:06:42 +0000 (07:06 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10924 6f19259b-4bc3-4df7-8a09-765794883524

UnixPkg/Sec/SecMain.c
UnixPkg/Sec/UnixThunk.c
UnixPkg/Sec/X64/MangleGasket.S

index 06dbccb18ed2dc8fd03986bc80294014784be2de..da83e3fa5cc8f15dc22483e4f3a8679f83c920d4 100644 (file)
@@ -48,7 +48,7 @@ char *gGdbWorkingFileName = NULL;
 //
 // Globals
 //
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(MDE_CPU_X64)
 UNIX_PEI_LOAD_FILE_PPI                    mSecUnixLoadFilePpi        = { GasketSecUnixPeiLoadFile };
 PEI_UNIX_AUTOSCAN_PPI                     mSecUnixAutoScanPpi        = { GasketSecUnixPeiAutoScan };
 PEI_UNIX_THUNK_PPI                        mSecUnixThunkPpi           = { GasketSecUnixUnixThunkAddress };
@@ -143,7 +143,7 @@ MapFile (
   IN OUT  EFI_PHYSICAL_ADDRESS  *BaseAddress,
   OUT UINT64                    *Length
   );
-  
+
 EFI_STATUS
 EFIAPI
 SecNt32PeCoffRelocateImage (
@@ -237,7 +237,7 @@ Returns:
   //  Set InitialStackMemory to zero so UnixOpenFile will allocate a new mapping
   //
   InitialStackMemorySize  = STACK_SIZE;
-  InitialStackMemory = (UINTN)MapMemory(0, 
+  InitialStackMemory = (UINTN)MapMemory(0,
           (UINT32) InitialStackMemorySize,
           PROT_READ | PROT_WRITE | PROT_EXEC,
           MAP_ANONYMOUS | MAP_PRIVATE);
@@ -249,7 +249,7 @@ Returns:
   printf ("  SEC passing in %u KB of temp RAM at 0x%08lx to PEI\n",
     (unsigned int)(InitialStackMemorySize / 1024),
     (unsigned long)InitialStackMemory);
-    
+
   for (StackPointer = (UINTN*) (UINTN) InitialStackMemory;
      StackPointer < (UINTN*)(UINTN)((UINTN) InitialStackMemory + (UINT64) InitialStackMemorySize);
      StackPointer ++) {
@@ -422,12 +422,12 @@ Returns:
        {
          close (fd);
          return EFI_DEVICE_ERROR;
-       }      
+       }
     }
 #endif
 
   res = MapMemory(fd, FileSize, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE);
-  
+
   close (fd);
 
   if (res == MAP_FAILED)
@@ -493,7 +493,7 @@ Returns:
 
   } else if (ReportStatusCodeExtractDebugInfo (Data, &ErrorLevel, &Marker, &Format)) {
     //
-    // Process DEBUG () macro 
+    // Process DEBUG () macro
     //
     AsciiBSPrint (PrintBuffer, BYTES_PER_RECORD, Format, Marker);
     printf ("%s", PrintBuffer);
@@ -560,17 +560,17 @@ Returns:
   // |           |
   // |  Stack    |
   // |-----------| <---- TemporaryRamBase
-  // 
+  //
   TopOfStack  = (VOID *)(LargestRegion + PeiStackSize);
   TopOfMemory = LargestRegion + PeiStackSize;
 
   //
   // Reservet space for storing PeiCore's parament in stack.
-  // 
+  //
   TopOfStack  = (VOID *)((UINTN)TopOfStack - sizeof (EFI_SEC_PEI_HAND_OFF) - CPU_STACK_ALIGNMENT);
   TopOfStack  = ALIGN_POINTER (TopOfStack, CPU_STACK_ALIGNMENT);
 
-  
+
   //
   // Bind this information into the SEC hand-off state
   //
@@ -578,7 +578,7 @@ Returns:
   SecCoreData->DataSize               = sizeof(EFI_SEC_PEI_HAND_OFF);
   SecCoreData->BootFirmwareVolumeBase = (VOID*)BootFirmwareVolumeBase;
   SecCoreData->BootFirmwareVolumeSize = PcdGet32 (PcdUnixFirmwareFdSize);
-  SecCoreData->TemporaryRamBase       = (VOID*)(UINTN)LargestRegion; 
+  SecCoreData->TemporaryRamBase       = (VOID*)(UINTN)LargestRegion;
   SecCoreData->TemporaryRamSize       = STACK_SIZE;
   SecCoreData->StackBase              = SecCoreData->TemporaryRamBase;
   SecCoreData->StackSize              = PeiStackSize;
@@ -597,21 +597,21 @@ Returns:
   if (EFI_ERROR (Status)) {
     return ;
   }
-  
+
   DispatchTableSize = sizeof (gPrivateDispatchTable);
   DispatchTableSize += OverrideDispatchTableExtraSize ();
-  
+
   DispatchTable = malloc (DispatchTableSize);
   if (DispatchTable == NULL) {
     return;
   }
-  
+
   //
   // Allow an override for extra PPIs to be passed up to PEI
   // This is an easy way to enable OS specific customizations
   //
   OverrideDispatchTable (&gPrivateDispatchTable[0], sizeof (gPrivateDispatchTable), DispatchTable, DispatchTableSize);
-  
+
   //
   // Transfer control to the PEI Core
   //
@@ -735,13 +735,13 @@ Returns:
   if (EFI_ERROR (Status)) {
     return Status;
   }
-  
-  
+
+
   //
   // Allocate space in UNIX (not emulator) memory. Extra space is for alignment
   //
   ImageContext.ImageAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) MapMemory (
-    0, 
+    0,
     (UINT32) (ImageContext.ImageSize + (ImageContext.SectionAlignment * 2)),
     PROT_READ | PROT_WRITE | PROT_EXEC,
     MAP_ANONYMOUS | MAP_PRIVATE
@@ -749,7 +749,7 @@ Returns:
   if (ImageContext.ImageAddress == 0) {
     return EFI_OUT_OF_RESOURCES;
   }
-    
+
   //
   // Align buffer on section boundry
   //
@@ -761,12 +761,12 @@ Returns:
   if (EFI_ERROR (Status)) {
     return Status;
   }
-       
+
   Status = PeCoffLoaderRelocateImage (&ImageContext);
   if (EFI_ERROR (Status)) {
     return Status;
   }
-       
+
 
   SecPeCoffRelocateImageExtraAction (&ImageContext);
 
@@ -842,7 +842,7 @@ Returns:
 
   if (Index == 0) {
     //
-    // FD 0 has XIP code and well known PCD values 
+    // FD 0 has XIP code and well known PCD values
     // If the memory buffer could not be allocated at the FD build address
     // the Fixup is the difference.
     //
@@ -930,16 +930,16 @@ AddHandle (
 
 Routine Description:
   Store the ModHandle in an array indexed by the Pdb File name.
-  The ModHandle is needed to unload the image. 
+  The ModHandle is needed to unload the image.
 
 Arguments:
-  ImageContext - Input data returned from PE Laoder Library. Used to find the 
+  ImageContext - Input data returned from PE Laoder Library. Used to find the
                  .PDB file name of the PE Image.
-  ModHandle    - Returned from LoadLibraryEx() and stored for call to 
+  ModHandle    - Returned from LoadLibraryEx() and stored for call to
                  FreeLibrary().
 
 Returns:
-  EFI_SUCCESS - ModHandle was stored. 
+  EFI_SUCCESS - ModHandle was stored.
 
 --*/
 {
@@ -959,9 +959,9 @@ Returns:
       return EFI_SUCCESS;
     }
   }
-  
+
   //
-  // No free space in mImageContextModHandleArray so grow it by 
+  // No free space in mImageContextModHandleArray so grow it by
   // IMAGE_CONTEXT_TO_MOD_HANDLE entires. realloc will
   // copy the old values to the new locaiton. But it does
   // not zero the new memory area.
@@ -974,9 +974,9 @@ Returns:
     ASSERT (FALSE);
     return EFI_OUT_OF_RESOURCES;
   }
-  
+
   memset (mImageContextModHandleArray + PreviousSize, 0, MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE * sizeof (IMAGE_CONTEXT_TO_MOD_HANDLE));
+
   return AddHandle (ImageContext, ModHandle);
 }
 
@@ -991,7 +991,7 @@ Routine Description:
   Return the ModHandle and delete the entry in the array.
 
 Arguments:
-  ImageContext - Input data returned from PE Laoder Library. Used to find the 
+  ImageContext - Input data returned from PE Laoder Library. Used to find the
                  .PDB file name of the PE Image.
 
 Returns:
@@ -1027,7 +1027,7 @@ Returns:
 
 
 //
-// Target for gdb breakpoint in a script that uses gGdbWorkingFileName to source a 
+// Target for gdb breakpoint in a script that uses gGdbWorkingFileName to source a
 // add-symbol-file command. Hey what can you say scripting in gdb is not that great....
 //
 // Put .gdbinit in the CWD where you do gdb SecMain.dll for source level debug
@@ -1069,13 +1069,13 @@ IsPdbFile (
   if ((Len < 5)|| (PdbFileName[Len - 4] != '.')) {
     return FALSE;
   }
-  
+
   if ((PdbFileName[Len - 3] == 'P' || PdbFileName[Len - 3] == 'p') &&
       (PdbFileName[Len - 2] == 'D' || PdbFileName[Len - 2] == 'd') &&
       (PdbFileName[Len - 1] == 'B' || PdbFileName[Len - 1] == 'b')) {
     return TRUE;
   }
-  
+
   return FALSE;
 }
 
@@ -1090,14 +1090,14 @@ PrintLoadAddress (
   if (ImageContext->PdbPointer == NULL) {
     fprintf (stderr,
       "0x%08lx Loading NO DEBUG with entry point 0x%08lx\n",
-      (unsigned long)(ImageContext->ImageAddress),   
+      (unsigned long)(ImageContext->ImageAddress),
       (unsigned long)ImageContext->EntryPoint
       );
   } else {
     fprintf (stderr,
       "0x%08lx Loading %s with entry point 0x%08lx\n",
       (unsigned long)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders),
-      ImageContext->PdbPointer,   
+      ImageContext->PdbPointer,
       (unsigned long)ImageContext->EntryPoint
       );
   }
@@ -1112,7 +1112,7 @@ SecPeCoffRelocateImageExtraAction (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT         *ImageContext
   )
 {
-    
+
 #ifdef __APPLE__
   PrintLoadAddress (ImageContext);
 
@@ -1122,7 +1122,7 @@ SecPeCoffRelocateImageExtraAction (
   // .dSYM files for the PE/COFF images that can be used by gdb for source level debugging.
   //
   FILE  *GdbTempFile;
-  
+
   //
   // In the Mach-O to PE/COFF conversion the size of the PE/COFF headers is not accounted for.
   // Thus we need to skip over the PE/COFF header when giving load addresses for our symbol table.
@@ -1131,27 +1131,27 @@ SecPeCoffRelocateImageExtraAction (
     //
     // Now we have a database of the images that are currently loaded
     //
-    
+
     //
-    // 'symbol-file' will clear out currnet symbol mappings in gdb. 
-    // you can do a 'add-symbol-file filename address' for every image we loaded to get source 
-    // level debug in gdb. Note Sec, being a true application will work differently. 
+    // 'symbol-file' will clear out currnet symbol mappings in gdb.
+    // you can do a 'add-symbol-file filename address' for every image we loaded to get source
+    // level debug in gdb. Note Sec, being a true application will work differently.
+    //
+    // We add the PE/COFF header size into the image as the mach-O does not have a header in
+    // loaded into system memory.
     //
-    // We add the PE/COFF header size into the image as the mach-O does not have a header in 
-    // loaded into system memory. 
-    // 
     // This gives us a data base of gdb commands and after something is unloaded that entry will be
-    // removed. We don't yet have the scheme of how to comunicate with gdb, but we have the 
+    // removed. We don't yet have the scheme of how to comunicate with gdb, but we have the
     // data base of info ready to roll.
     //
-    // We could use qXfer:libraries:read, but OS X GDB does not currently support it. 
-    //  <library-list> 
+    // We could use qXfer:libraries:read, but OS X GDB does not currently support it.
+    //  <library-list>
     //    <library name="/lib/libc.so.6">   // ImageContext->PdbPointer
     //      <segment address="0x10000000"/> // ImageContext->ImageAddress + ImageContext->SizeOfHeaders
-    //    </library> 
-    //  </library-list> 
+    //    </library>
+    //  </library-list>
     //
-    
+
     //
     // Write the file we need for the gdb script
     //
@@ -1159,37 +1159,45 @@ SecPeCoffRelocateImageExtraAction (
     if (GdbTempFile != NULL) {
       fprintf (GdbTempFile, "add-symbol-file %s 0x%08lx\n", ImageContext->PdbPointer, (long unsigned int)(ImageContext->ImageAddress + ImageContext->SizeOfHeaders));
       fclose (GdbTempFile);
-      
+
       //
-      // Target for gdb breakpoint in a script that uses gGdbWorkingFileName to set a breakpoint. 
+      // Target for gdb breakpoint in a script that uses gGdbWorkingFileName to set a breakpoint.
       // Hey what can you say scripting in gdb is not that great....
       //
       SecGdbScriptBreak ();
     }
 
     AddHandle (ImageContext, ImageContext->PdbPointer);
-    
+
   }
-  
+
 #else
-  
+
   void        *Handle = NULL;
   void        *Entry = NULL;
-  fprintf (stderr, 
+
+  if (ImageContext->PdbPointer == NULL) {
+    return;
+  }
+
+  if (!IsPdbFile (ImageContext->PdbPointer)) {
+    return;
+  }
+
+  fprintf (stderr,
      "Loading %s 0x%08lx - entry point 0x%08lx\n",
      ImageContext->PdbPointer,
      (unsigned long)ImageContext->ImageAddress,
      (unsigned long)ImageContext->EntryPoint);
 
   Handle = dlopen (ImageContext->PdbPointer, RTLD_NOW);
-  
+
   if (Handle) {
     Entry = dlsym (Handle, "_ModuleEntryPoint");
   } else {
-    printf("%s\n", dlerror());  
+    printf("%s\n", dlerror());
   }
-  
+
   if (Entry != NULL) {
     ImageContext->EntryPoint = (UINTN)Entry;
     printf("Change %s Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, (unsigned long)Entry);
@@ -1215,12 +1223,12 @@ SecPeCoffLoaderUnloadImageExtraAction (
 
 #ifdef __APPLE__
   FILE  *GdbTempFile;
-  
+
   if (Handle != NULL) {
     //
     // Need to skip .PDB files created from VC++
     //
-    if (!IsPdbFile (ImageContext->PdbPointer)) {      
+    if (!IsPdbFile (ImageContext->PdbPointer)) {
       //
       // Write the file we need for the gdb script
       //
@@ -1228,16 +1236,16 @@ SecPeCoffLoaderUnloadImageExtraAction (
       if (GdbTempFile != NULL) {
         fprintf (GdbTempFile, "remove-symbol-file %s\n", ImageContext->PdbPointer);
         fclose (GdbTempFile);
-  
+
         //
-        // Target for gdb breakpoint in a script that uses gGdbWorkingFileName to set a breakpoint. 
+        // Target for gdb breakpoint in a script that uses gGdbWorkingFileName to set a breakpoint.
         // Hey what can you say scripting in gdb is not that great....
         //
         SecGdbScriptBreak ();
       }
     }
   }
-  
+
 #else
   //
   // Don't want to confuse gdb with symbols for something that got unloaded
@@ -1268,32 +1276,32 @@ SecTemporaryRamSupport (
 {
   //
   // Migrate the whole temporary memory to permenent memory.
-  // 
+  //
   CopyMem (
-    (VOID*)(UINTN)PermanentMemoryBase, 
-    (VOID*)(UINTN)TemporaryMemoryBase, 
+    (VOID*)(UINTN)PermanentMemoryBase,
+    (VOID*)(UINTN)TemporaryMemoryBase,
     CopySize
     );
 
   //
   // SecSwitchStack function must be invoked after the memory migration
-  // immediatly, also we need fixup the stack change caused by new call into 
+  // immediatly, also we need fixup the stack change caused by new call into
   // permenent memory.
-  // 
+  //
   SecSwitchStack (
     (UINT32) TemporaryMemoryBase,
     (UINT32) PermanentMemoryBase
     );
 
   //
-  // We need *not* fix the return address because currently, 
+  // We need *not* fix the return address because currently,
   // The PeiCore is excuted in flash.
   //
 
   //
   // Simulate to invalid temporary memory, terminate temporary memory
-  // 
+  //
   //ZeroMem ((VOID*)(UINTN)TemporaryMemoryBase, CopySize);
-  
+
   return EFI_SUCCESS;
 }
index 6c9bb74ce0dcd6e2073c6693ce46256f4d8b9557..874f26fa89ee3af872361417dc52461f9772ab93 100644 (file)
@@ -2,13 +2,13 @@
 
 Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
 Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>
-This program and the accompanying materials                          
-are licensed and made available under the terms and conditions of the BSD License         
-which accompanies this distribution.  The full text of the license may be found at        
-http://opensource.org/licenses/bsd-license.php                                            
-                                                                                          
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution.  The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 Module Name:
 
@@ -16,7 +16,7 @@ Module Name:
 
 Abstract:
 
-  Since the SEC is the only program in our emulation we 
+  Since the SEC is the only program in our emulation we
   must use a Tiano mechanism to export APIs to other modules.
   This is the role of the EFI_UNIX_THUNK_PROTOCOL.
 
@@ -25,7 +25,7 @@ Abstract:
   are not added. It looks like adding a element to end and not initializing
   it may cause the table to be initaliized with the members at the end being
   set to zero. This is bad as jumping to zero will crash.
-  
+
 
   gUnix is a a public exported global that contains the initialized
   data.
@@ -36,7 +36,7 @@ Abstract:
 #include "Uefi.h"
 #include "Library/UnixLib.h"
 
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(MDE_CPU_X64)
 #include "Gasket.h"
 #endif
 
@@ -52,12 +52,12 @@ settimer_handler (int sig)
 
   gettimeofday (&timeval, NULL);
   delta = ((UINT64)timeval.tv_sec * 1000) + (timeval.tv_usec / 1000)
-    - ((UINT64)settimer_timeval.tv_sec * 1000) 
+    - ((UINT64)settimer_timeval.tv_sec * 1000)
     - (settimer_timeval.tv_usec / 1000);
   settimer_timeval = timeval;
-  
+
   if (settimer_callback) {
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(MDE_CPU_X64)
    ReverseGasketUint64 (settimer_callback, delta);
 #else
    (*settimer_callback)(delta);
@@ -90,7 +90,7 @@ SetTimer (UINT64 PeriodMs, VOID (*CallBack)(UINT64 DeltaMs))
   timerval.it_value.tv_usec = remainder * 1000;
   timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
   timerval.it_interval = timerval.it_value;
-  
+
   if (setitimer (ITIMER_REAL, &timerval, NULL) != 0) {
     printf ("SetTimer: setitimer error %s\n", strerror (errno));
   }
@@ -110,8 +110,8 @@ msSleep (unsigned long Milliseconds)
       break;
     }
     rq = rm;
-  } 
-    
+  }
+
 }
 
 void
@@ -171,10 +171,10 @@ UgaCreate(struct _EFI_UNIX_UGA_IO_PROTOCOL **UgaIo, CONST CHAR16 *Title);
 
 EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
   EFI_UNIX_THUNK_PROTOCOL_SIGNATURE,
-#ifdef __APPLE__
+#if defined(__APPLE__) || defined(MDE_CPU_X64)
 //
 // Mac OS X requires the stack to be 16-byte aligned for IA-32. So on an OS X build
-// we add an assembly wrapper that makes sure the stack ges aligned. 
+// we add an assembly wrapper that makes sure the stack ges aligned.
 // This has the nice benfit of being able to run EFI ABI code, like the EFI shell
 // that is checked in to source control in the OS X version of the emulator
 //
@@ -217,9 +217,9 @@ EFI_UNIX_THUNK_PROTOCOL mUnixThunkTable = {
   Gasketcfsetospeed,
   Gaskettcgetattr,
   Gaskettcsetattr,
-  GasketUnixPeCoffGetEntryPoint,                
-  GasketUnixPeCoffRelocateImageExtraAction,     
-  GasketUnixPeCoffUnloadImageExtraAction  
+  GasketUnixPeCoffGetEntryPoint,
+  GasketUnixPeCoffRelocateImageExtraAction,
+  GasketUnixPeCoffUnloadImageExtraAction
 
 #else
   msSleep, /* Sleep */
index f29b1e314d71ba553a2f3f459064c8b39d8a15fb..383a8830dae47bc1bf89eaf35e4b902717bb57be 100644 (file)
@@ -2,14 +2,14 @@
 #
 # This template was generated from GasketEfiTemplate.c Unix x86_64 ABI
 #
-# The EFI_UNIX_THUNK_PROTOCOL member functions call these these generic assembly 
-# routines.  
+# The EFI_UNIX_THUNK_PROTOCOL member functions call these these generic assembly
+# routines.
 #
 # Some OS X POSIX calls get name mangled in C code and we need to fill in a C global
 # to get the correct binding (does not work from assembly). So we have 4 functions
 # that do an indirect call, while the others call POSIX APIs directly
 #
-# movq _gUnixRmDir@GOTPCREL(%rip), %rax 
+# movq _gUnixRmDir@GOTPCREL(%rip), %rax
 #
 #
 # UNIX Arg passing: RCX, RDX,  R8,  R9
 
 // 32 byte shadow to spill rcx-r9, 8 bytes to align stack on 16 byte boundry
 // Any call with 0 - 4 arguments allocates 40 bytes on the stack.
-// For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56, 
+// For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56,
 // 7 or 8 args is 72, and 9 or 10 args is 88
-#define EFI_STACK_SHADOW_SPACE          40  
-#define EFI_STACK_SHADOW_SPACE_5_6      56  
-#define EFI_STACK_SHADOW_SPACE_7_8      72 
-#define EFI_STACK_SHADOW_SPACE_9_10     88 
+#define EFI_STACK_SHADOW_SPACE          40
+#define EFI_STACK_SHADOW_SPACE_5_6      56
+#define EFI_STACK_SHADOW_SPACE_7_8      72
+#define EFI_STACK_SHADOW_SPACE_9_10     88
 
 
 
        .text
 
 
-.globl _Gasketrmdir
-_Gasketrmdir:
+ASM_GLOBAL ASM_PFX(Gasketrmdir)
+ASM_PFX(Gasketrmdir):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
 
-       movq    _gUnixRmDir@GOTPCREL(%rip), %rax  // Get function name mangled by C
+       movq    ASM_PFX(gUnixRmDir)@GOTPCREL(%rip), %rax  // Get function name mangled by C
        movq    (%rax), %rax
        call    *%rax
-    
+
        pushq     %rdi          // restore state
        pushq     %rsi
        ret
 
 
-.globl _Gasketopendir
-_Gasketopendir:
+ASM_GLOBAL ASM_PFX(Gasketopendir)
+ASM_PFX(Gasketopendir):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
 
-       movq    _gUnixOpenDir@GOTPCREL(%rip), %rax  // Get function name mangled by C
+       movq    ASM_PFX(gUnixOpenDir)@GOTPCREL(%rip), %rax  // Get function name mangled by C
        movq    (%rax), %rax
        call    *%rax
-       
+
        popq  %rdi             // restore state
        popq  %rsi
   ret
 
 
 
-.globl _Gasketstat
-_Gasketstat:
+ASM_GLOBAL ASM_PFX(Gasketstat)
+ASM_PFX(Gasketstat):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
 
-       movq    _gUnixStat@GOTPCREL(%rip), %rax   // Get function name mangled by C
+       movq    ASM_PFX(gUnixStat)@GOTPCREL(%rip), %rax   // Get function name mangled by C
        movq    (%rax), %rax
        call    *%rax
-       
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
-       
-       
-.globl _Gasketstatfs
-_Gasketstatfs:
+
+
+ASM_GLOBAL ASM_PFX(Gasketstatfs)
+ASM_PFX(Gasketstatfs):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
 
-       movq    _gUnixStatFs@GOTPCREL(%rip), %rax   // Get function name mangled by C
+       movq    ASM_PFX(gUnixStatFs)@GOTPCREL(%rip), %rax   // Get function name mangled by C
        movq    (%rax), %rax
        call    *%rax
-       
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
-       
-.globl _Gasketrewinddir
-_Gasketrewinddir:
+
+ASM_GLOBAL ASM_PFX(Gasketrewinddir)
+ASM_PFX(Gasketrewinddir):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
 
-       movq    _gUnixRewinddir@GOTPCREL(%rip), %rax   // Get function name mangled by C
+       movq    ASM_PFX(gUnixRewinddir)@GOTPCREL(%rip), %rax   // Get function name mangled by C
        movq    (%rax), %rax
        call    *%rax
-       
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
-       
-.globl _Gasketreaddir
-_Gasketreaddir:
+
+ASM_GLOBAL ASM_PFX(Gasketreaddir)
+ASM_PFX(Gasketreaddir):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
 
-       movq    _gUnixReaddir@GOTPCREL(%rip), %rax   // Get function name mangled by C
+       movq    ASM_PFX(gUnixReaddir)@GOTPCREL(%rip), %rax   // Get function name mangled by C
        movq    (%rax), %rax
        call    *%rax
-       
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
-       
 
-.globl _GasketmsSleep
-_GasketmsSleep:
+
+ASM_GLOBAL ASM_PFX(GasketmsSleep)
+ASM_PFX(GasketmsSleep):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call    ASM_PFX(msSleep)
 
-       call    _msSleep
-       
        popq  %rdi            // restore state
        popq  %rsi
   ret
-       
-       
-.globl _Gasketexit
-_Gasketexit:
-  movq    %rcx, %rdi    // Swizzle args 
-       call    _exit           // Less to do as we will never return to EFI ABI world
+
+
+ASM_GLOBAL ASM_PFX(Gasketexit)
+ASM_PFX(Gasketexit):
+  movq    %rcx, %rdi    // Swizzle args
+       call    ASM_PFX(exit)           // Less to do as we will never return to EFI ABI world
 LDEAD_LOOP:
   jmp  LDEAD_LOOP       // _exit should never return
 
 
 
-.globl _GasketSetTimer
-_GasketSetTimer:
+ASM_GLOBAL ASM_PFX(GasketSetTimer)
+ASM_PFX(GasketSetTimer):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call    ASM_PFX(SetTimer)
 
-       call    _SetTimer
-       
        popq  %rdi            // restore state
        popq  %rsi
   ret
 
-       
-.globl _GasketGetLocalTime
-_GasketGetLocalTime:
+
+ASM_GLOBAL ASM_PFX(GasketGetLocalTime)
+ASM_PFX(GasketGetLocalTime):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call    ASM_PFX(GetLocalTime)
 
-       call    _GetLocalTime
-       
        popq  %rdi            // restore state
        popq  %rsi
   ret
 
-       
 
-.globl _Gasketgmtime
-_Gasketgmtime:
+
+ASM_GLOBAL ASM_PFX(Gasketgmtime)
+ASM_PFX(Gasketgmtime):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call    ASM_PFX(localtime)
 
-       call    _localtime
-       
        popq  %rdi            // restore state
        popq  %rsi
   ret
 
 
 
-.globl _GasketGetTimeZone
-_GasketGetTimeZone:
+ASM_GLOBAL ASM_PFX(GasketGetTimeZone)
+ASM_PFX(GasketGetTimeZone):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-       call    _GetTimeZone
-       
+       call    ASM_PFX(GetTimeZone)
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
 
-       
-.globl _GasketGetDayLight
-_GasketGetDayLight:
+
+ASM_GLOBAL ASM_PFX(GasketGetDayLight)
+ASM_PFX(GasketGetDayLight):
 LFB26:
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-       call    _GetDayLight
-       
+       call    ASM_PFX(GetDayLight)
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
 
 
-.globl _Gasketpoll
-_Gasketpoll:
+ASM_GLOBAL ASM_PFX(Gasketpoll)
+ASM_PFX(Gasketpoll):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _poll
-       
+       call      ASM_PFX(poll)
+
        popq  %rdi            // restore state
        popq  %rsi
   ret
 
 
 
-.globl _Gasketread
-_Gasketread:
+ASM_GLOBAL ASM_PFX(Gasketread)
+ASM_PFX(Gasketread):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _read
-       
+       call      ASM_PFX(read)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketwrite
-_Gasketwrite:
+ASM_GLOBAL ASM_PFX(Gasketwrite)
+ASM_PFX(Gasketwrite):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _write
-       
+       call      ASM_PFX(write)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketgetenv
-_Gasketgetenv:
+ASM_GLOBAL ASM_PFX(Gasketgetenv)
+ASM_PFX(Gasketgetenv):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(getenv)
 
-       call      _getenv
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketopen
-_Gasketopen:
+ASM_GLOBAL ASM_PFX(Gasketopen)
+ASM_PFX(Gasketopen):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _open
-       
+       call      ASM_PFX(open)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketlseek
-_Gasketlseek:
+ASM_GLOBAL ASM_PFX(Gasketlseek)
+ASM_PFX(Gasketlseek):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _lseek
-       
+       call      ASM_PFX(lseek)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketftruncate
-_Gasketftruncate:
+ASM_GLOBAL ASM_PFX(Gasketftruncate)
+ASM_PFX(Gasketftruncate):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _ftruncate
-       
+       call      ASM_PFX(ftruncate)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketclose
-_Gasketclose:
+ASM_GLOBAL ASM_PFX(Gasketclose)
+ASM_PFX(Gasketclose):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(close)
 
-       call      _close
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
 
-.globl _Gasketmkdir
-_Gasketmkdir:
+ASM_GLOBAL ASM_PFX(Gasketmkdir)
+ASM_PFX(Gasketmkdir):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(mkdir)
 
-       call      _mkdir
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketunlink
-_Gasketunlink:
+ASM_GLOBAL ASM_PFX(Gasketunlink)
+ASM_PFX(Gasketunlink):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(unlink)
 
-       call      _unlink
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketGetErrno
-_GasketGetErrno:
+ASM_GLOBAL ASM_PFX(GasketGetErrno)
+ASM_PFX(GasketGetErrno):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-       call    _GetErrno
-       
+       call    ASM_PFX(GetErrno)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
-.globl _Gasketclosedir
-_Gasketclosedir:
+ASM_GLOBAL ASM_PFX(Gasketclosedir)
+ASM_PFX(Gasketclosedir):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(closedir)
 
-       call      _closedir
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketrename
-_Gasketrename:
+ASM_GLOBAL ASM_PFX(Gasketrename)
+ASM_PFX(Gasketrename):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(rename)
 
-       call      _rename
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketmktime
-_Gasketmktime:
+ASM_GLOBAL ASM_PFX(Gasketmktime)
+ASM_PFX(Gasketmktime):
 LFB42:
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(mktime)
 
-       call      _mktime
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketfsync
-_Gasketfsync:
+ASM_GLOBAL ASM_PFX(Gasketfsync)
+ASM_PFX(Gasketfsync):
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(fsync)
 
-       call      _fsync
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketchmod
-_Gasketchmod:
+ASM_GLOBAL ASM_PFX(Gasketchmod)
+ASM_PFX(Gasketchmod):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(chmod)
 
-       call      _chmod
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketutime
-_Gasketutime:
+ASM_GLOBAL ASM_PFX(Gasketutime)
+ASM_PFX(Gasketutime):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(utime)
 
-       call      _utime
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gaskettcflush
-_Gaskettcflush:
+ASM_GLOBAL ASM_PFX(Gaskettcflush)
+ASM_PFX(Gaskettcflush):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(tcflush)
 
-       call      _tcflush
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUgaCreate
-_GasketUgaCreate:
+ASM_GLOBAL ASM_PFX(GasketUgaCreate)
+ASM_PFX(GasketUgaCreate):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(UgaCreate)
 
-       call      _UgaCreate
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketperror
-_Gasketperror:
+ASM_GLOBAL ASM_PFX(Gasketperror)
+ASM_PFX(Gasketperror):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(perror)
 
-       call      _perror
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketioctl
-_Gasketioctl:
+ASM_GLOBAL ASM_PFX(Gasketioctl)
+ASM_PFX(Gasketioctl):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _UnixIoCtl1
-       
+       call      ASM_PFX(UnixIoCtl1)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gasketfcntl
-_Gasketfcntl:
+ASM_GLOBAL ASM_PFX(Gasketfcntl)
+ASM_PFX(Gasketfcntl):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _UnixFcntl1
-       
+       call      ASM_PFX(UnixFcntl1)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
 
-.globl _Gasketcfsetispeed
-_Gasketcfsetispeed:
+ASM_GLOBAL ASM_PFX(Gasketcfsetispeed)
+ASM_PFX(Gasketcfsetispeed):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(cfsetispeed)
 
-       call      _cfsetispeed
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
 
-.globl _Gasketcfsetospeed
-_Gasketcfsetospeed:
+ASM_GLOBAL ASM_PFX(Gasketcfsetospeed)
+ASM_PFX(Gasketcfsetospeed):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(cfsetospeed)
 
-       call      _cfsetospeed
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gaskettcgetattr
-_Gaskettcgetattr:
+ASM_GLOBAL ASM_PFX(Gaskettcgetattr)
+ASM_PFX(Gaskettcgetattr):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _tcgetattr
-       
+       call      ASM_PFX(tcgetattr)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _Gaskettcsetattr
-_Gaskettcsetattr:
+ASM_GLOBAL ASM_PFX(Gaskettcsetattr)
+ASM_PFX(Gaskettcsetattr):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _tcsetattr
-       
+       call      ASM_PFX(tcsetattr)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUnixPeCoffGetEntryPoint
-_GasketUnixPeCoffGetEntryPoint:
+ASM_GLOBAL ASM_PFX(GasketUnixPeCoffGetEntryPoint)
+ASM_PFX(GasketUnixPeCoffGetEntryPoint):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(SecPeCoffGetEntryPoint)
 
-       call      _SecPeCoffGetEntryPoint
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
 
-.globl _GasketUnixPeCoffRelocateImageExtraAction
-_GasketUnixPeCoffRelocateImageExtraAction:
+ASM_GLOBAL ASM_PFX(GasketUnixPeCoffRelocateImageExtraAction)
+ASM_PFX(GasketUnixPeCoffRelocateImageExtraAction):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(SecPeCoffRelocateImageExtraAction)
 
-       call      _SecPeCoffRelocateImageExtraAction
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUnixPeCoffUnloadImageExtraAction
-_GasketUnixPeCoffUnloadImageExtraAction:
+ASM_GLOBAL ASM_PFX(GasketUnixPeCoffUnloadImageExtraAction)
+ASM_PFX(GasketUnixPeCoffUnloadImageExtraAction):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(SecPeCoffLoaderUnloadImageExtraAction)
 
-       call      _SecPeCoffLoaderUnloadImageExtraAction
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUgaClose
-_GasketUgaClose:
+ASM_GLOBAL ASM_PFX(GasketUgaClose)
+ASM_PFX(GasketUgaClose):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(UgaClose)
 
-       call      _UgaClose
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUgaSize
-_GasketUgaSize:
+ASM_GLOBAL ASM_PFX(GasketUgaSize)
+ASM_PFX(GasketUgaSize):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _UgaSize
-       
+       call      ASM_PFX(UgaSize)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUgaCheckKey
-_GasketUgaCheckKey:
+ASM_GLOBAL ASM_PFX(GasketUgaCheckKey)
+ASM_PFX(GasketUgaCheckKey):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
+  movq    %rcx, %rdi    // Swizzle args
+
+       call      ASM_PFX(UgaCheckKey)
 
-       call      _UgaCheckKey
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUgaGetKey
-_GasketUgaGetKey:
+ASM_GLOBAL ASM_PFX(GasketUgaGetKey)
+ASM_PFX(GasketUgaGetKey):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
+
+       call      ASM_PFX(UgaGetKey)
 
-       call      _UgaGetKey
-       
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketUgaBlt
-_GasketUgaBlt:
+ASM_GLOBAL ASM_PFX(GasketUgaBlt)
+ASM_PFX(GasketUgaBlt):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
   movq    %r9,  %rcx
 
-       call      _UgaBlt
-       
+       call      ASM_PFX(UgaBlt)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
@@ -766,10 +766,10 @@ _GasketUgaBlt:
 //   UINTN Arg2,
 //   UINTN Arg3
 //   );
-.globl _ReverseGasketUint64
-_ReverseGasketUint64:
-  movq    %rdi, %rax    // Swizzle args 
-  movq    %rsi, %r9     
+ASM_GLOBAL ASM_PFX(ReverseGasketUint64)
+ASM_PFX(ReverseGasketUint64):
+  movq    %rdi, %rax    // Swizzle args
+  movq    %rsi, %r9
 //  movq    %rdx, %rdx
   movq    %rcx, %r8
   movq    %r9,  %rcx
@@ -779,86 +779,86 @@ _ReverseGasketUint64:
   addq  $40, %rsp
 
        ret
-       
+
 
 // Sec PPI Callbacks
 
-.globl _GasketSecUnixPeiLoadFile
-_GasketSecUnixPeiLoadFile:
+ASM_GLOBAL ASM_PFX(GasketSecUnixPeiLoadFile)
+ASM_PFX(GasketSecUnixPeiLoadFile):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
   movq    %r9,  %rcx
 
-       call      _SecUnixPeiLoadFile
-       
+       call      ASM_PFX(SecUnixPeiLoadFile)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
 
-.globl _GasketSecUnixPeiAutoScan
-_GasketSecUnixPeiAutoScan:
+ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan)
+ASM_PFX(GasketSecUnixPeiAutoScan):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
 
-       call      _SecUnixPeiAutoScan
-       
+       call      ASM_PFX(SecUnixPeiAutoScan)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
-.globl _GasketSecUnixUnixThunkAddress
-_GasketSecUnixUnixThunkAddress:
+ASM_GLOBAL ASM_PFX(GasketSecUnixUnixThunkAddress)
+ASM_PFX(GasketSecUnixUnixThunkAddress):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-       call      _SecUnixUnixThunkAddress
-       
+       call      ASM_PFX(SecUnixUnixThunkAddress)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketSecPeiReportStatusCode
-_GasketSecPeiReportStatusCode:
+ASM_GLOBAL ASM_PFX(GasketSecPeiReportStatusCode)
+ASM_PFX(GasketSecPeiReportStatusCode):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
   movq    %r9,  %rcx
   movq    $0,   %r8     // BugBug: This should come from the stack
   movq    $0,   %r9     //         But we can cheat since they are optional for bringup....
 
-       call      _SecPeiReportStatusCode
-       
+       call      ASM_PFX(SecPeiReportStatusCode)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
 
 
-.globl _GasketSecUnixFdAddress
-_GasketSecUnixFdAddress:
+ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress)
+ASM_PFX(GasketSecUnixFdAddress):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
   movq    %r9,  %rcx
 
-       call      _SecUnixFdAddress
-       
+       call      ASM_PFX(SecUnixFdAddress)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret
@@ -866,18 +866,18 @@ _GasketSecUnixFdAddress:
 
 
 
-.globl _GasketSecTemporaryRamSupport
-_GasketSecTemporaryRamSupport:
+ASM_GLOBAL ASM_PFX(GasketSecTemporaryRamSupport)
+ASM_PFX(GasketSecTemporaryRamSupport):
        pushq     %rsi          // %rsi & %rdi are volatie in Unix and callee-save in EFI ABI
        pushq     %rdi
 
-  movq    %rcx, %rdi    // Swizzle args 
-  movq    %rdx, %rsi     
+  movq    %rcx, %rdi    // Swizzle args
+  movq    %rdx, %rsi
   movq    %r8,  %rdx
   movq    %r9,  %rcx
 
-       call      _SecTemporaryRamSupport
-       
+       call      ASM_PFX(SecTemporaryRamSupport)
+
        popq    %rdi          // restore state
        popq    %rsi
   ret