]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/Ia32/ProcessorAsms.S
Fixed issues compiling for Apple gcc on IA-32
[mirror_edk2.git] / EdkCompatibilityPkg / Foundation / Library / Pei / PeiLib / Ia32 / ProcessorAsms.S
index 01eec19f39b6a90567f1e2326649e97a8585d4d4..2766986c6a3e3869867ae3f96d9e95d5c76fc0fc 100644 (file)
-#\r
-# Copyright (c) 2004, 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
-# \r
-#    ProcessorAsms.Asm\r
-#\r
-#\r
-#\r
-#include "EfiBind.h"\r
-#------------------------------------------------------------------------------\r
-\r
-  .686P: \r
-  .MMX: \r
-  #.MODEL SMALL\r
-  .CODE: \r
-#------------------------------------------------------------------------------\r
-  \r
-.globl ASM_PFX(TransferControlSetJump)  \r
-.globl ASM_PFX(TransferControlLongJump)\r
-.globl ASM_PFX(SwitchStacks)\r
-.globl ASM_PFX(SwitchIplStacks)\r
-\r
-.equ                            EFI_SUCCESS, 0\r
-.equ                            EFI_WARN_RETURN_FROM_LONG_JUMP, 5\r
-\r
-#\r
-# typedef struct {\r
-#  UINT32  ebx;\r
-#  UINT32  esi;\r
-#  UINT32  edi;\r
-#  UINT32  ebp;\r
-#  UINT32  esp;\r
-#  UINT32  eip;\r
-#} EFI_JUMP_BUFFER;\r
-#\r
-\r
-#typedef \r
-#EFI_STATUS\r
-#(EFIAPI *EFI_PEI_TRANSFER_CONTROL_SET_JUMP) (\r
-#  IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,\r
-#  OUT EFI_JUMP_BUFFER                   *Context\r
-#  );\r
-#\r
-#Routine Description:\r
-#\r
-#  This routine implements the IA32 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
-ASM_PFX(TransferControlSetJump):\r
-  push   %ebp\r
-  mov    %esp,%ebp\r
-  mov    0x8(%ebp),%eax\r
-  mov    0xc(%ebp),%ecx\r
-  mov    %ebx,(%ecx)\r
-  mov    %esi,0x4(%ecx)\r
-  mov    %edi,0x8(%ecx)\r
-  mov    0x0(%ebp),%eax\r
-  mov    %eax,0xc(%ecx)\r
-  lea    0x4(%ebp),%eax\r
-  mov    %eax,0x10(%ecx)\r
-  mov    0x4(%ebp),%eax\r
-  mov    %eax,0x14(%ecx)\r
-  mov    $0x0,%eax\r
-  leave  \r
-  ret    \r
-\r
-#typedef \r
-#EFI_STATUS\r
-#(EFIAPI *EFI_PEI_TRANSFER_CONTROL_LONG_JUMP) (\r
-#  IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,\r
-#  IN EFI_JUMP_BUFFER                    *Context\r
-#  );\r
-#\r
-# Routine Description:\r
-# \r
-#  This routine implements the IA32 variant of the LongJump call.  Its\r
-#  responsibility is restore the system state to the Context Buffer and\r
-#  pass control back.\r
-#\r
-# Arguments:\r
-# \r
-#  Pointer to CPU context save buffer.\r
-#\r
-# Returns:\r
-#\r
-#  EFI_WARN_RETURN_FROM_LONG_JUMP\r
-#\r
-\r
-ASM_PFX(TransferControlLongJump):\r
-  push   %ebp\r
-  mov    %esp,%ebp\r
-  push   %ebx\r
-  push   %esi\r
-  push   %edi\r
-  mov    0x8(%ebp),%eax\r
-  mov    $0x5,%eax\r
-  mov    0xc(%ebp),%ecx\r
-  mov    (%ecx),%ebx\r
-  mov    0x4(%ecx),%esi\r
-  mov    0x8(%ecx),%edi\r
-  mov    0xc(%ecx),%ebp\r
-  mov    0x10(%ecx),%esp\r
-  add    $0x4,%esp\r
-  jmp    *0x14(%ecx)\r
-  mov    $0x5,%eax\r
-  pop    %edi\r
-  pop    %esi\r
-  pop    %ebx\r
-  leave  \r
-  ret    \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\r
-#       Parameter       - Parameter to pass in\r
-#       NewStack        - New Location of the stack\r
-#       NewBsp          - New BSP\r
-#\r
-# Returns:\r
-#\r
-#       Nothing. Goes to the Entry Point passing in the new parameters\r
-#\r
-#SwitchStacks    PROC  C \\r
-#  EntryPoint:PTR DWORD, \\r
-#  Parameter:DWORD, \\r
-#  NewStack:PTR DWORD, \\r
-#  NewBsp:PTR DWORD\r
-ASM_PFX(SwitchStacks):\r
-  push   %ebp\r
-  mov    %esp,%ebp\r
-  push   %ebx\r
-  mov    0x14(%ebp),%eax\r
-  mov    0xc(%ebp),%ebx\r
-  mov    0x8(%ebp),%ecx\r
-  mov    0x10(%ebp),%eax\r
-  mov    %eax,%esp\r
-  push   %ebx\r
-  push   $0x0\r
-  jmp    *%ecx\r
-  pop    %ebx\r
-  leave  \r
-  ret    \r
-\r
-\r
-\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\r
-#       Parameter1/Parameter2   - Parameter to pass in\r
-#       NewStack                - New Location of the stack\r
-#       NewBsp                  - New BSP\r
-#\r
-# Returns:\r
-#\r
-#       Nothing. Goes to the Entry Point passing in the new parameters\r
-#\r
-#SwitchIplStacks PROC  C \\r
-#  EntryPoint:PTR DWORD, \\r
-#  Parameter1:DWORD, \\r
-#  Parameter2:DWORD, \\r
-#  NewStack:PTR DWORD, \\r
-#  NewBsp:PTR DWORD\r
-ASM_PFX(SwitchIplStacks):\r
-  push   %ebp\r
-  mov    %esp,%ebp\r
-  push   %ebx\r
-  mov    0x18(%ebp),%eax\r
-  mov    0xc(%ebp),%ebx\r
-  mov    0x10(%ebp),%edx\r
-  mov    0x8(%ebp),%ecx\r
-  mov    0x14(%ebp),%eax\r
-  mov    %eax,%esp\r
-  push   %edx\r
-  push   %ebx\r
-  call   *%ecx\r
-  pop    %ebx\r
-  leave  \r
-  ret    \r
-\r
-#SwitchIplStacks ENDP\r
-\r
-\r
-\r
+#
+# Copyright (c) 2004, 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.Asm
+#
+#
+#
+#include "EfiBind.h"
+#------------------------------------------------------------------------------
+
+  .686P: 
+  .MMX: 
+  #.MODEL SMALL
+  .CODE: 
+#------------------------------------------------------------------------------
+  
+.globl ASM_PFX(TransferControlSetJump)  
+.globl ASM_PFX(TransferControlLongJump)
+.globl ASM_PFX(SwitchStacks)
+.globl ASM_PFX(SwitchIplStacks)
+
+#define EFI_SUCCESS                     0
+#define EFI_WARN_RETURN_FROM_LONG_JUMP  5
+
+#
+# typedef struct {
+#  UINT32  ebx;
+#  UINT32  esi;
+#  UINT32  edi;
+#  UINT32  ebp;
+#  UINT32  esp;
+#  UINT32  eip;
+#} EFI_JUMP_BUFFER;
+#
+
+#typedef 
+#EFI_STATUS
+#(EFIAPI *EFI_PEI_TRANSFER_CONTROL_SET_JUMP) (
+#  IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,
+#  OUT EFI_JUMP_BUFFER                   *Context
+#  );
+#
+#Routine Description:
+#
+#  This routine implements the IA32 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
+#
+ASM_PFX(TransferControlSetJump):
+  push   %ebp
+  mov    %esp,%ebp
+  mov    0x8(%ebp),%eax
+  mov    0xc(%ebp),%ecx
+  mov    %ebx,(%ecx)
+  mov    %esi,0x4(%ecx)
+  mov    %edi,0x8(%ecx)
+  mov    0x0(%ebp),%eax
+  mov    %eax,0xc(%ecx)
+  lea    0x4(%ebp),%eax
+  mov    %eax,0x10(%ecx)
+  mov    0x4(%ebp),%eax
+  mov    %eax,0x14(%ecx)
+  mov    $0x0,%eax
+  leave  
+  ret    
+
+#typedef 
+#EFI_STATUS
+#(EFIAPI *EFI_PEI_TRANSFER_CONTROL_LONG_JUMP) (
+#  IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL  *This,
+#  IN EFI_JUMP_BUFFER                    *Context
+#  );
+#
+# Routine Description:
+# 
+#  This routine implements the IA32 variant of the LongJump call.  Its
+#  responsibility is restore the system state to the Context Buffer and
+#  pass control back.
+#
+# Arguments:
+# 
+#  Pointer to CPU context save buffer.
+#
+# Returns:
+#
+#  EFI_WARN_RETURN_FROM_LONG_JUMP
+#
+
+ASM_PFX(TransferControlLongJump):
+  push   %ebp
+  mov    %esp,%ebp
+  push   %ebx
+  push   %esi
+  push   %edi
+  mov    0x8(%ebp),%eax
+  mov    $0x5,%eax
+  mov    0xc(%ebp),%ecx
+  mov    (%ecx),%ebx
+  mov    0x4(%ecx),%esi
+  mov    0x8(%ecx),%edi
+  mov    0xc(%ecx),%ebp
+  mov    0x10(%ecx),%esp
+  add    $0x4,%esp
+  jmp    *0x14(%ecx)
+  mov    $0x5,%eax
+  pop    %edi
+  pop    %esi
+  pop    %ebx
+  leave  
+  ret    
+
+#
+# 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
+#       Parameter       - Parameter to pass in
+#       NewStack        - New Location of the stack
+#       NewBsp          - New BSP
+#
+# Returns:
+#
+#       Nothing. Goes to the Entry Point passing in the new parameters
+#
+#SwitchStacks    PROC  C \
+#  EntryPoint:PTR DWORD, \
+#  Parameter:DWORD, \
+#  NewStack:PTR DWORD, \
+#  NewBsp:PTR DWORD
+ASM_PFX(SwitchStacks):
+  push   %ebp
+  mov    %esp,%ebp
+  push   %ebx
+  mov    0x14(%ebp),%eax
+  mov    0xc(%ebp),%ebx
+  mov    0x8(%ebp),%ecx
+  mov    0x10(%ebp),%eax
+  mov    %eax,%esp
+  push   %ebx
+  push   $0x0
+  jmp    *%ecx
+  pop    %ebx
+  leave  
+  ret    
+
+
+
+
+#
+# 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
+#       Parameter1/Parameter2   - Parameter to pass in
+#       NewStack                - New Location of the stack
+#       NewBsp                  - New BSP
+#
+# Returns:
+#
+#       Nothing. Goes to the Entry Point passing in the new parameters
+#
+#SwitchIplStacks PROC  C \
+#  EntryPoint:PTR DWORD, \
+#  Parameter1:DWORD, \
+#  Parameter2:DWORD, \
+#  NewStack:PTR DWORD, \
+#  NewBsp:PTR DWORD
+ASM_PFX(SwitchIplStacks):
+  push   %ebp
+  mov    %esp,%ebp
+  push   %ebx
+  mov    0x18(%ebp),%eax
+  mov    0xc(%ebp),%ebx
+  mov    0x10(%ebp),%edx
+  mov    0x8(%ebp),%ecx
+  mov    0x14(%ebp),%eax
+  mov    %eax,%esp
+  push   %edx
+  push   %ebx
+  call   *%ecx
+  pop    %ebx
+  leave  
+  ret    
+
+#SwitchIplStacks ENDP
+
+
+