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
This commit is contained in:
jyao1 2011-11-21 08:35:14 +00:00
parent ea71453f72
commit fa97cbf4ef
11 changed files with 96 additions and 241 deletions

View File

@ -2546,9 +2546,9 @@ ExecuteMOVsnw (
// //
// Get the data from the source. // Get the data from the source.
// //
Op2 = (UINT64) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index); Op2 = (UINT64)(INT64)(INTN)(VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index);
if (OPERAND2_INDIRECT (Operands)) { if (OPERAND2_INDIRECT (Operands)) {
Op2 = (UINT64) VmReadMemN (VmPtr, (UINTN) Op2); Op2 = (UINT64)(INT64)(INTN)VmReadMemN (VmPtr, (UINTN) Op2);
} }
// //
// Now write back the result. // Now write back the result.
@ -2639,9 +2639,9 @@ ExecuteMOVsnd (
// //
// Get the data from the source. // Get the data from the source.
// //
Op2 = (UINT64) (VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index); Op2 = (UINT64)(INT64)(INTN)(INT64)(VmPtr->Gpr[OPERAND2_REGNUM (Operands)] + Op2Index);
if (OPERAND2_INDIRECT (Operands)) { if (OPERAND2_INDIRECT (Operands)) {
Op2 = (UINT64) VmReadMemN (VmPtr, (UINTN) Op2); Op2 = (UINT64)(INT64)(INTN)(INT64)VmReadMemN (VmPtr, (UINTN) Op2);
} }
// //
// Now write back the result. // Now write back the result.

View File

@ -874,10 +874,63 @@ CommonEbcExceptionHandler (
IN EFI_SYSTEM_CONTEXT SystemContext IN EFI_SYSTEM_CONTEXT SystemContext
) )
{ {
//
// We print debug information to let user know what happen.
//
DEBUG ((
EFI_D_ERROR,
"EBC Interrupter Version - 0x%016lx\n",
(UINT64) (((VM_MAJOR_VERSION & 0xFFFF) << 16) | ((VM_MINOR_VERSION & 0xFFFF)))
));
DEBUG ((
EFI_D_ERROR,
"Exception Type - 0x%016lx\n",
(UINT64)(UINTN)InterruptType
));
DEBUG ((
EFI_D_ERROR,
" R0 - 0x%016lx, R1 - 0x%016lx\n",
SystemContext.SystemContextEbc->R0,
SystemContext.SystemContextEbc->R1
));
DEBUG ((
EFI_D_ERROR,
" R2 - 0x%016lx, R3 - 0x%016lx\n",
SystemContext.SystemContextEbc->R2,
SystemContext.SystemContextEbc->R3
));
DEBUG ((
EFI_D_ERROR,
" R4 - 0x%016lx, R5 - 0x%016lx\n",
SystemContext.SystemContextEbc->R4,
SystemContext.SystemContextEbc->R5
));
DEBUG ((
EFI_D_ERROR,
" R6 - 0x%016lx, R7 - 0x%016lx\n",
SystemContext.SystemContextEbc->R6,
SystemContext.SystemContextEbc->R7
));
DEBUG ((
EFI_D_ERROR,
" Flags - 0x%016lx\n",
SystemContext.SystemContextEbc->Flags
));
DEBUG ((
EFI_D_ERROR,
" ControlFlags - 0x%016lx\n",
SystemContext.SystemContextEbc->ControlFlags
));
DEBUG ((
EFI_D_ERROR,
" Ip - 0x%016lx\n\n",
SystemContext.SystemContextEbc->Ip
));
// //
// We deadloop here to make it easy to debug this issue. // We deadloop here to make it easy to debug this issue.
// //
ASSERT (FALSE); CpuDeadLoop ();
return ; return ;
} }

View File

@ -145,21 +145,6 @@ EbcLLGetEbcEntryPoint (
VOID VOID
); );
/**
Returns the caller's value of the stack pointer.
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.
@return The current value of the stack pointer for the caller.
**/
UINTN
EFIAPI
EbcLLGetStackPointer (
VOID
);
/** /**
This function is called to execute an EBC CALLEX instruction. This function is called to execute an EBC CALLEX instruction.
This instruction requires that we thunk out to external native This instruction requires that we thunk out to external native
@ -172,8 +157,10 @@ EbcLLGetStackPointer (
@param EbcSp The new EBC stack pointer. @param EbcSp The new EBC stack pointer.
@param FramePtr The frame pointer. @param FramePtr The frame pointer.
@return The unmodified value returned by the native code.
**/ **/
VOID INT64
EFIAPI EFIAPI
EbcLLCALLEXNative ( EbcLLCALLEXNative (
IN UINTN CallAddr, IN UINTN CallAddr,
@ -205,21 +192,6 @@ EbcLLCALLEX (
IN UINT8 Size IN UINT8 Size
); );
/**
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.
@return The unmodified value returned by the native code.
**/
INT64
EFIAPI
EbcLLGetReturnValue (
VOID
);
/** /**
Returns the stack index and buffer assosicated with the Handle parameter. Returns the stack index and buffer assosicated with the Handle parameter.

View File

@ -2,7 +2,7 @@
# #
# Low level IA32 specific EBC support routines. # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # 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_GLOBAL ASM_PFX(EbcLLGetEbcEntryPoint)
ASM_PFX(EbcLLGetEbcEntryPoint): ASM_PFX(EbcLLGetEbcEntryPoint):
ret 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

View File

@ -3,7 +3,7 @@
; This code provides low level routines that support the Virtual Machine ; This code provides low level routines that support the Virtual Machine
; for option ROMs. ; 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 ; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License ; 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 ; which accompanies this distribution. The full text of the license may be found at
@ -32,9 +32,6 @@
.686p .686p
.model flat .model flat
.code .code
;---------------------------------------------------------------------------
;;GenericPostSegment SEGMENT USE16
;---------------------------------------------------------------------------
CopyMem PROTO C Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD 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. ; Destroys no working registers.
;**************************************************************************** ;****************************************************************************
; VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr) ; INT64 EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
_EbcLLCALLEXNative PROC NEAR PUBLIC _EbcLLCALLEXNative PROC PUBLIC
push ebp push ebp
push ebx push ebx
mov ebp, esp ; standard function prolog mov ebp, esp ; standard function prolog
@ -104,50 +101,9 @@ _EbcLLCALLEXNative ENDP
; Returns: ; Returns:
; The contents of the register in which the entry point is passed. ; 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 ret
_EbcLLGetEbcEntryPoint ENDP _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 END

View File

@ -2,7 +2,7 @@
This module contains EBC support routines that are customized based on This module contains EBC support routines that are customized based on
the target processor. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -117,14 +117,14 @@ Action:
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr; VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
} else { } 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; VmPtr->Ip += Size;
} }
} }
@ -160,6 +160,7 @@ Action:
**/ **/
UINT64 UINT64
EFIAPI
EbcInterpret ( EbcInterpret (
IN OUT UINTN Arg1, IN OUT UINTN Arg1,
IN OUT UINTN Arg2, IN OUT UINTN Arg2,
@ -308,6 +309,7 @@ EbcInterpret (
**/ **/
UINT64 UINT64
EFIAPI
ExecuteEbcImageEntryPoint ( ExecuteEbcImageEntryPoint (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
@ -394,6 +396,7 @@ ExecuteEbcImageEntryPoint (
// //
// Return the value in R[7] unless there was an error // Return the value in R[7] unless there was an error
// //
ReturnEBCStack(StackIndex);
return (UINT64) VmContext.Gpr[7]; return (UINT64) VmContext.Gpr[7];
} }

View File

@ -3,7 +3,7 @@
// Contains low level routines for the Virtual Machine implementation // Contains low level routines for the Virtual Machine implementation
// on an Itanium-based platform. // on an Itanium-based platform.
// //
// 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 // This program and the accompanying materials
// are licensed and made available under the terms and conditions of the BSD License // 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 // which accompanies this distribution. The full text of the license may be found at
@ -198,27 +198,6 @@ PROCEDURE_ENTRY(EbcLLGetEbcEntryPoint)
br.ret.sptk b0 ;; br.ret.sptk b0 ;;
PROCEDURE_EXIT(EbcLLGetEbcEntryPoint) PROCEDURE_EXIT(EbcLLGetEbcEntryPoint)
//
// INT64 EbcLLGetReturnValue(VOID)
//
// Description:
// This function is called to get the value returned by native code
// to EBC. It simply returns because the return value should still
// be in the register, so the caller just gets the unmodified value.
//
PROCEDURE_ENTRY(EbcLLGetReturnValue)
br.ret.sptk b0 ;;
PROCEDURE_EXIT(EbcLLGetReturnValue)
//
// UINTN EbcLLGetStackPointer(VOID)
//
PROCEDURE_ENTRY(EbcLLGetStackPointer)
mov r8 = r12 ;;
br.ret.sptk b0 ;;
br.sptk.few b6
PROCEDURE_EXIT(EbcLLGetStackPointer)

View File

@ -2,7 +2,7 @@
This module contains EBC support routines that are customized based on This module contains EBC support routines that are customized based on
the target processor. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -238,6 +238,7 @@ EbcInterpret (
**/ **/
UINT64 UINT64
EFIAPI
ExecuteEbcImageEntryPoint ( ExecuteEbcImageEntryPoint (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
@ -277,7 +278,6 @@ ExecuteEbcImageEntryPoint (
// //
// Get the stack pointer. This is the bottom of the upper stack. // Get the stack pointer. This is the bottom of the upper stack.
// //
Addr = EbcLLGetStackPointer ();
Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex); Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
@ -865,14 +865,14 @@ Action:
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr; VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
} else { } 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; VmPtr->Ip += Size;
} }
} }

View File

@ -3,7 +3,7 @@
# This code provides low level routines that support the Virtual Machine # This code provides low level routines that support the Virtual Machine
# for option ROMs. # 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 # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
@ -18,9 +18,7 @@
# Equate files needed. # Equate files needed.
#--------------------------------------------------------------------------- #---------------------------------------------------------------------------
#--------------------------------------------------------------------------- ASM_GLOBAL ASM_PFX(CopyMem);
##GenericPostSegment SEGMENT USE16
#---------------------------------------------------------------------------
#**************************************************************************** #****************************************************************************
# EbcLLCALLEX # EbcLLCALLEX
@ -33,8 +31,6 @@
# #
# Destroys no working registers. # Destroys no working registers.
#**************************************************************************** #****************************************************************************
ASM_GLOBAL _CopyMem;
# VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr) # VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative); ASM_GLOBAL ASM_PFX(EbcLLCALLEXNative);
ASM_PFX(EbcLLCALLEXNative): ASM_PFX(EbcLLCALLEXNative):
@ -88,47 +84,3 @@ ASM_GLOBAL ASM_PFX(EbcLLGetEbcEntryPoint);
ASM_PFX(EbcLLGetEbcEntryPoint): ASM_PFX(EbcLLGetEbcEntryPoint):
mov %r10, %rax mov %r10, %rax
ret 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

View File

@ -3,7 +3,7 @@
; This code provides low level routines that support the Virtual Machine. ; This code provides low level routines that support the Virtual Machine.
; for option ROMs. ; 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 ; This program and the accompanying materials
; are licensed and made available under the terms and conditions of the BSD License ; 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 ; which accompanies this distribution. The full text of the license may be found at
@ -21,11 +21,9 @@
; Equate files needed. ; Equate files needed.
;--------------------------------------------------------------------------- ;---------------------------------------------------------------------------
text SEGMENT .CODE
;--------------------------------------------------------------------------- CopyMem PROTO Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
;;GenericPostSegment SEGMENT USE16
;---------------------------------------------------------------------------
;**************************************************************************** ;****************************************************************************
; EbcLLCALLEX ; EbcLLCALLEX
@ -38,11 +36,7 @@ text SEGMENT
; ;
; Destroys no working registers. ; Destroys no working registers.
;**************************************************************************** ;****************************************************************************
; VOID EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr) ; INT64 EbcLLCALLEXNative(UINTN FuncAddr, UINTN NewStackPointer, VOID *FramePtr)
CopyMem PROTO Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
EbcLLCALLEXNative PROC PUBLIC EbcLLCALLEXNative PROC PUBLIC
push rbp push rbp
push rbx push rbx
@ -92,54 +86,10 @@ EbcLLCALLEXNative ENDP
; The contents of the register in which the entry point is passed. ; The contents of the register in which the entry point is passed.
; ;
EbcLLGetEbcEntryPoint PROC PUBLIC EbcLLGetEbcEntryPoint PROC PUBLIC
; The EbcEntryPoint is saved to R10.
mov rax, r10 mov rax, r10
ret ret
EbcLLGetEbcEntryPoint ENDP 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 END

View File

@ -2,7 +2,7 @@
This module contains EBC support routines that are customized based on This module contains EBC support routines that are customized based on
the target x64 processor. 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 This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -81,6 +81,7 @@ PushU64 (
**/ **/
UINT64 UINT64
EFIAPI
EbcInterpret ( EbcInterpret (
IN OUT UINTN Arg1, IN OUT UINTN Arg1,
IN OUT UINTN Arg2, IN OUT UINTN Arg2,
@ -129,7 +130,6 @@ EbcInterpret (
// Initialize the stack pointer for the EBC. Get the current system stack // Initialize the stack pointer for the EBC. Get the current system stack
// pointer and adjust it down by the max needed for the interpreter. // pointer and adjust it down by the max needed for the interpreter.
// //
Addr = EbcLLGetStackPointer ();
// //
// Adjust the VM's stack pointer down. // Adjust the VM's stack pointer down.
@ -233,6 +233,7 @@ EbcInterpret (
**/ **/
UINT64 UINT64
EFIAPI
ExecuteEbcImageEntryPoint ( ExecuteEbcImageEntryPoint (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
@ -273,7 +274,6 @@ ExecuteEbcImageEntryPoint (
// Initialize the stack pointer for the EBC. Get the current system stack // Initialize the stack pointer for the EBC. Get the current system stack
// pointer and adjust it down by the max needed for the interpreter. // pointer and adjust it down by the max needed for the interpreter.
// //
Addr = EbcLLGetStackPointer ();
Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex); Status = GetEBCStack(ImageHandle, &VmContext.StackPool, &StackIndex);
if (EFI_ERROR(Status)) { if (EFI_ERROR(Status)) {
@ -586,14 +586,14 @@ Action:
VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr; VmPtr->Ip = (VMIP) (UINTN) TargetEbcAddr;
} else { } 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; VmPtr->Ip += Size;
} }
} }