]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/ProcessorAsms.S
Fixed issues compiling for Apple gcc on IA-32
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Pei / PeiLib / X64 / ProcessorAsms.S
index 48e4b19c8811aabe38e442e1c0ef7499682fc5e0..543bed9fd13f261be462d6a03915a5ae6e39f0e1 100644 (file)
-#------------------------------------------------------------------------------\r
-#\r
-# Copyright (c) 2008, Intel Corporation                                                         \r
-# All rights reserved. This program and the accompanying materials                          \r
-# are licensed and made available under the terms and conditions of the BSD License         \r
-# which accompanies this distribution.  The full text of the license may be found at        \r
-# http://opensource.org/licenses/bsd-license.php                                            \r
-#                                                                                           \r
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,                     \r
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.             \r
-# \r
-# Module Name:\r
-#   ProcessorAsms.S\r
-#\r
-# Abstract:\r
-#   This is separated from processor.c to allow this functions to be built with /O1\r
-#\r
-#\r
-#------------------------------------------------------------------------------\r
-#include <EfiBind.h>\r
-\r
-    .text\r
-\r
-.global ASM_PFX(SwitchStacks)\r
-.global ASM_PFX(TransferControlSetJump)\r
-.global ASM_PFX(TransferControlLongJump)\r
-\r
-#\r
-# Routine Description:\r
-#   This allows the caller to switch the stack and goes to the new entry point\r
-#\r
-# Arguments:\r
-#   EntryPoint      - Pointer to the location to enter // rcx\r
-#   Parameter       - Parameter to pass in             // rdx\r
-#   NewStack        - New Location of the stack        // r8\r
-#   NewBsp          - New BSP                          // r9 - not used\r
-#\r
-# Returns:\r
-#   Nothing. Goes to the Entry Point passing in the new parameters\r
-#\r
-ASM_PFX(SwitchStacks):\r
-\r
-    # Adjust stack for\r
-    #   1) leave 4 registers space\r
-    #   2) let it 16 bytes aligned after call\r
-    sub    $0x20,%r8\r
-    and    -0x10,%r8w   # do not assume 16 bytes aligned\r
-\r
-       mov    %r8,%rsp\r
-       mov    %rcx,%r10\r
-       mov    %rdx,%rcx\r
-       callq  *%r10\r
-\r
- #\r
- # no ret as we have a new stack and we jumped to the new location\r
- #     \r
-    ret\r
-\r
-#SwitchStacks ENDP\r
-\r
-\r
-.equ                            EFI_SUCCESS, 0\r
-.equ                            EFI_WARN_RETURN_FROM_LONG_JUMP, 5\r
-\r
-#\r
-#Routine Description:\r
-#\r
-#  This routine implements the x64 variant of the SetJump call.  Its\r
-#  responsibility is to store system state information for a possible\r
-#  subsequent LongJump.\r
-#\r
-#Arguments:\r
-#\r
-#  Pointer to CPU context save buffer.\r
-#\r
-#Returns:\r
-#\r
-#  EFI_SUCCESS\r
-#\r
-# EFI_STATUS\r
-# EFIAPI\r
-# TransferControlLongJump (\r
-#   IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,\r
-#   IN EFI_JUMP_BUFFER                    *Jump\r
-#   );\r
-#\r
-# rcx - *This\r
-# rdx - JumpBuffer\r
-#\r
-ASM_PFX(TransferControlSetJump):\r
-      mov    %rbx,(%rdx)\r
-      mov    %rsp,0x8(%rdx)\r
-      mov    %rbp,0x10(%rdx)\r
-      mov    %rdi,0x18(%rdx)\r
-      mov    %rsi,0x20(%rdx)\r
-      mov    %r10,0x28(%rdx)\r
-      mov    %r11,0x30(%rdx)\r
-      mov    %r12,0x38(%rdx)\r
-      mov    %r13,0x40(%rdx)\r
-      mov    %r14,0x48(%rdx)\r
-      mov    %r15,0x50(%rdx)\r
-      mov    (%rsp),%rax\r
-      mov    %rax,0x58(%rdx)\r
-      mov    $0x0,%rax\r
-      retq   \r
-\r
-\r
-#\r
-# EFI_STATUS\r
-# EFIAPI\r
-# TransferControlLongJump (\r
-#   IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,  // rcx\r
-#   IN EFI_JUMP_BUFFER                    *Jump   // rdx\r
-#   );\r
-#\r
-#\r
-ASM_PFX(TransferControlLongJump):\r
-  # set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP\r
-      mov    $0x5,%rax\r
-      mov    (%rdx),%rbx\r
-      mov    0x8(%rdx),%rsp\r
-      mov    0x10(%rdx),%rbp\r
-      mov    0x18(%rdx),%rdi\r
-      mov    0x20(%rdx),%rsi\r
-      mov    0x28(%rdx),%r10\r
-      mov    0x30(%rdx),%r11\r
-      mov    0x38(%rdx),%r12\r
-      mov    0x40(%rdx),%r13\r
-      mov    0x48(%rdx),%r14\r
-      mov    0x50(%rdx),%r15\r
-      add    $0x8,%rsp\r
-      jmpq   *0x58(%rdx)\r
-      mov    $0x5,%rax\r
-      retq   \r
-\r
+#------------------------------------------------------------------------------
+#
+# Copyright (c) 2008, Intel Corporation                                                         
+# All rights reserved. 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:
+#   ProcessorAsms.S
+#
+# Abstract:
+#   This is separated from processor.c to allow this functions to be built with /O1
+#
+#
+#------------------------------------------------------------------------------
+#include <EfiBind.h>
+
+    .text
+
+.globl ASM_PFX(SwitchStacks)
+.globl ASM_PFX(TransferControlSetJump)
+.globl ASM_PFX(TransferControlLongJump)
+
+#
+# Routine Description:
+#   This allows the caller to switch the stack and goes to the new entry point
+#
+# Arguments:
+#   EntryPoint      - Pointer to the location to enter // rcx
+#   Parameter       - Parameter to pass in             // rdx
+#   NewStack        - New Location of the stack        // r8
+#   NewBsp          - New BSP                          // r9 - not used
+#
+# Returns:
+#   Nothing. Goes to the Entry Point passing in the new parameters
+#
+ASM_PFX(SwitchStacks):
+
+    # Adjust stack for
+    #   1) leave 4 registers space
+    #   2) let it 16 bytes aligned after call
+    sub    $0x20,%r8
+    and    -0x10,%r8w   # do not assume 16 bytes aligned
+
+       mov    %r8,%rsp
+       mov    %rcx,%r10
+       mov    %rdx,%rcx
+       callq  *%r10
+
+ #
+ # no ret as we have a new stack and we jumped to the new location
+ #     
+    ret
+
+#SwitchStacks ENDP
+
+
+.equ                            EFI_SUCCESS, 0
+.equ                            EFI_WARN_RETURN_FROM_LONG_JUMP, 5
+
+#
+#Routine Description:
+#
+#  This routine implements the x64 variant of the SetJump call.  Its
+#  responsibility is to store system state information for a possible
+#  subsequent LongJump.
+#
+#Arguments:
+#
+#  Pointer to CPU context save buffer.
+#
+#Returns:
+#
+#  EFI_SUCCESS
+#
+# EFI_STATUS
+# EFIAPI
+# TransferControlLongJump (
+#   IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,
+#   IN EFI_JUMP_BUFFER                    *Jump
+#   );
+#
+# rcx - *This
+# rdx - JumpBuffer
+#
+ASM_PFX(TransferControlSetJump):
+      mov    %rbx,(%rdx)
+      mov    %rsp,0x8(%rdx)
+      mov    %rbp,0x10(%rdx)
+      mov    %rdi,0x18(%rdx)
+      mov    %rsi,0x20(%rdx)
+      mov    %r10,0x28(%rdx)
+      mov    %r11,0x30(%rdx)
+      mov    %r12,0x38(%rdx)
+      mov    %r13,0x40(%rdx)
+      mov    %r14,0x48(%rdx)
+      mov    %r15,0x50(%rdx)
+      mov    (%rsp),%rax
+      mov    %rax,0x58(%rdx)
+      mov    $0x0,%rax
+      retq   
+
+
+#
+# EFI_STATUS
+# EFIAPI
+# TransferControlLongJump (
+#   IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,  // rcx
+#   IN EFI_JUMP_BUFFER                    *Jump   // rdx
+#   );
+#
+#
+ASM_PFX(TransferControlLongJump):
+  # set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
+      mov    $0x5,%rax
+      mov    (%rdx),%rbx
+      mov    0x8(%rdx),%rsp
+      mov    0x10(%rdx),%rbp
+      mov    0x18(%rdx),%rdi
+      mov    0x20(%rdx),%rsi
+      mov    0x28(%rdx),%r10
+      mov    0x30(%rdx),%r11
+      mov    0x38(%rdx),%r12
+      mov    0x40(%rdx),%r13
+      mov    0x48(%rdx),%r14
+      mov    0x50(%rdx),%r15
+      add    $0x8,%rsp
+      jmpq   *0x58(%rdx)
+      mov    $0x5,%rax
+      retq   
+