diff options
author | jyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-11-21 08:35:14 +0000 |
---|---|---|
committer | jyao1 <jyao1@6f19259b-4bc3-4df7-8a09-765794883524> | 2011-11-21 08:35:14 +0000 |
commit | fa97cbf4ef6f4fd2dc0312c09b6b5003780facb8 (patch) | |
tree | ef755da1081954d431c37d23934cd67d481fe067 /MdeModulePkg/Universal/EbcDxe/X64 | |
parent | ea71453f72e9a1990aaf7af76689a3f69c7b603f (diff) | |
download | edk2-platforms-fa97cbf4ef6f4fd2dc0312c09b6b5003780facb8.tar.xz |
1) Fix GCC version EBC interpreter bug.
Add missing EFIPAI for EbcInterpret and ExecuteEbcImageEntryPoint().
Get return value in EbcLLCALLEXNative(), remove EbcLLGetReturnValue().
2) Fix IA32 EBC interpreter bug on MOVsnw and MOVsnd.
3) Some cleanup
Add missing ReturnEBCStack() for IA32 build.
Remove unnecessary EbcLLGetStackPointer() for X64 and IPF build.
Remove deadcode EbcLLGetStackPointer() and EbcLLGetReturnValue() in IA32/X64/IPF ASM code.
Dump more info in CommonEbcExceptionHandler().
Signed-off-by: jyao1
Reviewed-by: Elvinli
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12745 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'MdeModulePkg/Universal/EbcDxe/X64')
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S | 52 | ||||
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm | 60 | ||||
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c | 14 |
3 files changed, 14 insertions, 112 deletions
diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S b/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S index e94e8cefac..eb2b9cd085 100644 --- a/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S +++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.S @@ -3,7 +3,7 @@ # This code provides low level routines that support the Virtual Machine
# for option ROMs.
#
-# Copyright (c) 2007 - 2008, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2007 - 2011, Intel Corporation. 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
@@ -18,9 +18,7 @@ # Equate files needed.
#---------------------------------------------------------------------------
-#---------------------------------------------------------------------------
-##GenericPostSegment SEGMENT USE16
-#---------------------------------------------------------------------------
+ASM_GLOBAL ASM_PFX(CopyMem);
#****************************************************************************
# EbcLLCALLEX
@@ -33,8 +31,6 @@ #
# Destroys no working registers.
#****************************************************************************
-ASM_GLOBAL _CopyMem;
-
# VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative);
ASM_PFX(EbcLLCALLEXNative):
@@ -88,47 +84,3 @@ ASM_GLOBAL ASM_PFX(EbcLLGetEbcEntryPoint); ASM_PFX(EbcLLGetEbcEntryPoint):
mov %r10, %rax
ret
-
-#/*++
-#
-#Routine Description:
-#
-# Return the caller's value of the stack pointer.
-#
-#Arguments:
-#
-# None.
-#
-#Returns:
-#
-# The current value of the stack pointer for the caller. We
-# adjust it by 4 here because when they called us, the return address
-# is put on the stack, thereby lowering it by 4 bytes.
-#
-#--*/
-
-# UINTN EbcLLGetStackPointer()
-ASM_GLOBAL ASM_PFX(EbcLLGetStackPointer);
-ASM_PFX(EbcLLGetStackPointer):
- mov %rsp, %rax
- # Stack adjusted by this much when we were called,
- # For this function, it's 4.
- add $4, %rax
- ret
-
-ASM_GLOBAL ASM_PFX(EbcLLGetReturnValue);
-ASM_PFX(EbcLLGetReturnValue):
-# UINT64 EbcLLGetReturnValue(VOID);
-# Routine Description:
-# When EBC calls native, on return the VM has to stuff the return
-# value into a VM register. It's assumed here that the value is still
-# in the register, so simply return and the caller should get the
-# return result properly.
-#
-# Arguments:
-# None.
-#
-# Returns:
-# The unmodified value returned by the native code.
-#
- ret
diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm b/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm index c2e91ff117..19fc35b0fc 100644 --- a/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm +++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcLowLevel.asm @@ -3,7 +3,7 @@ ; This code provides low level routines that support the Virtual Machine.
; for option ROMs.
;
-; Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
+; Copyright (c) 2006 - 2011, Intel Corporation. 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
@@ -21,11 +21,9 @@ ; Equate files needed.
;---------------------------------------------------------------------------
-text SEGMENT
+.CODE
-;---------------------------------------------------------------------------
-;;GenericPostSegment SEGMENT USE16
-;---------------------------------------------------------------------------
+CopyMem PROTO Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
;****************************************************************************
; EbcLLCALLEX
@@ -38,11 +36,7 @@ text SEGMENT ;
; Destroys no working registers.
;****************************************************************************
-; VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
-
-CopyMem PROTO Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
-
-
+; INT64 EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
EbcLLCALLEXNative PROC PUBLIC
push rbp
push rbx
@@ -92,54 +86,10 @@ EbcLLCALLEXNative ENDP ; The contents of the register in which the entry point is passed.
;
EbcLLGetEbcEntryPoint PROC PUBLIC
+ ; The EbcEntryPoint is saved to R10.
mov rax, r10
ret
EbcLLGetEbcEntryPoint ENDP
-;/*++
-;
-;Routine Description:
-;
-; Return the caller's value of the stack pointer.
-;
-;Arguments:
-;
-; None.
-;
-;Returns:
-;
-; The current value of the stack pointer for the caller. We
-; adjust it by 4 here because when they called us, the return address
-; is put on the stack, thereby lowering it by 4 bytes.
-;
-;--*/
-
-; UINTN EbcLLGetStackPointer()
-EbcLLGetStackPointer PROC PUBLIC
- mov rax, rsp ; get current stack pointer
- ; Stack adjusted by this much when we were called,
- ; For this function, it's 4.
- add rax, 4
- ret
-EbcLLGetStackPointer ENDP
-
-; UINT64 EbcLLGetReturnValue(VOID);
-; Routine Description:
-; When EBC calls native, on return the VM has to stuff the return
-; value into a VM register. It's assumed here that the value is still
-; in the register, so simply return and the caller should get the
-; return result properly.
-;
-; Arguments:
-; None.
-;
-; Returns:
-; The unmodified value returned by the native code.
-;
-EbcLLGetReturnValue PROC PUBLIC
- ret
-EbcLLGetReturnValue ENDP
-
-text ENDS
END
diff --git a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c index 5266122b76..184c672f16 100644 --- a/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c +++ b/MdeModulePkg/Universal/EbcDxe/X64/EbcSupport.c @@ -2,7 +2,7 @@ This module contains EBC support routines that are customized based on
the target x64 processor.
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2011, Intel Corporation. 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
@@ -81,6 +81,7 @@ PushU64 ( **/
UINT64
+EFIAPI
EbcInterpret (
IN OUT UINTN Arg1,
IN OUT UINTN Arg2,
@@ -129,7 +130,6 @@ EbcInterpret ( // Initialize the stack pointer for the EBC. Get the current system stack
// pointer and adjust it down by the max needed for the interpreter.
//
- Addr = EbcLLGetStackPointer ();
//
// Adjust the VM's stack pointer down.
@@ -233,6 +233,7 @@ EbcInterpret ( **/
UINT64
+EFIAPI
ExecuteEbcImageEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -273,7 +274,6 @@ ExecuteEbcImageEntryPoint ( // Initialize the stack pointer for the EBC. Get the current system stack
// pointer and adjust it down by the max needed for the interpreter.
//
- Addr = EbcLLGetStackPointer ();
Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
if (EFI_ERROR(Status)) {
@@ -586,14 +586,14 @@ Action: VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
} else {
//
- // The callee is not a thunk to EBC, call native code.
+ // The callee is not a thunk to EBC, call native code,
+ // and get return value.
//
- EbcLLCALLEXNative (FuncAddr, NewStackPointer, FramePtr);
+ VmPtr->Gpr[7] = EbcLLCALLEXNative (FuncAddr, NewStackPointer, FramePtr);
//
- // Get return value and advance the IP.
+ // Advance the IP.
//
- VmPtr->Gpr[7] = EbcLLGetReturnValue ();
VmPtr->Ip += Size;
}
}
|