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/Ia32 | |
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/Ia32')
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S | 12 | ||||
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.asm | 54 | ||||
-rw-r--r-- | MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c | 13 |
3 files changed, 14 insertions, 65 deletions
diff --git a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S index 5dde824e94..056885678b 100644 --- a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S +++ b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.S @@ -2,7 +2,7 @@ #
# Low level IA32 specific EBC support routines.
#
-# 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
@@ -45,13 +45,3 @@ ASM_PFX(EbcLLCALLEXNative): ASM_GLOBAL ASM_PFX(EbcLLGetEbcEntryPoint)
ASM_PFX(EbcLLGetEbcEntryPoint):
ret
-
-ASM_GLOBAL ASM_PFX(EbcLLGetStackPointer)
-ASM_PFX(EbcLLGetStackPointer):
- mov %esp,%eax
- add $0x4,%eax
- ret
-
-ASM_GLOBAL ASM_PFX(EbcLLGetReturnValue)
-ASM_PFX(EbcLLGetReturnValue):
- ret
diff --git a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.asm b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.asm index 7596c56ccb..73d48e7c7f 100644 --- a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcLowLevel.asm +++ b/MdeModulePkg/Universal/EbcDxe/Ia32/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
@@ -32,9 +32,6 @@ .686p
.model flat
.code
-;---------------------------------------------------------------------------
-;;GenericPostSegment SEGMENT USE16
-;---------------------------------------------------------------------------
CopyMem PROTO C Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
;****************************************************************************
@@ -49,8 +46,8 @@ CopyMem PROTO C Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD ;
; Destroys no working registers.
;****************************************************************************
-; VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
-_EbcLLCALLEXNative PROC NEAR PUBLIC
+; INT64 EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
+_EbcLLCALLEXNative PROC PUBLIC
push ebp
push ebx
mov ebp, esp ; standard function prolog
@@ -104,50 +101,9 @@ _EbcLLCALLEXNative ENDP ; Returns:
; The contents of the register in which the entry point is passed.
;
-_EbcLLGetEbcEntryPoint PROC NEAR PUBLIC
+_EbcLLGetEbcEntryPoint PROC PUBLIC
+ ; The EbcEntryPoint is saved to EAX, so just return here.
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 NEAR PUBLIC
- mov eax, esp ; get current stack pointer
- add eax, 4 ; stack adjusted by this much when we were called
- 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 NEAR PUBLIC
- ret
-_EbcLLGetReturnValue ENDP
-
END
diff --git a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c index 3205d8fc8a..549b04afd2 100644 --- a/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c +++ b/MdeModulePkg/Universal/EbcDxe/Ia32/EbcSupport.c @@ -2,7 +2,7 @@ This module contains EBC support routines that are customized based on
the target 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
@@ -117,14 +117,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;
}
}
@@ -160,6 +160,7 @@ Action: **/
UINT64
+EFIAPI
EbcInterpret (
IN OUT UINTN Arg1,
IN OUT UINTN Arg2,
@@ -308,6 +309,7 @@ EbcInterpret ( **/
UINT64
+EFIAPI
ExecuteEbcImageEntryPoint (
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable
@@ -394,6 +396,7 @@ ExecuteEbcImageEntryPoint ( //
// Return the value in R[7] unless there was an error
//
+ ReturnEBCStack(StackIndex);
return (UINT64) VmContext.Gpr[7];
}
|