1. add public functions header.
2. apply for doxgen format for file header. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@5043 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -1,15 +1,17 @@
|
||||
#****************************************************************************
|
||||
#*
|
||||
#* Copyright (c) 2006, 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.
|
||||
#*
|
||||
#****************************************************************************
|
||||
##/**@file
|
||||
# Low level IA32 specific EBC support routines.
|
||||
#
|
||||
# Copyright (c) 2007 - 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.
|
||||
#
|
||||
#**/
|
||||
|
||||
.globl ASM_PFX(CopyMem)
|
||||
|
||||
.globl ASM_PFX(EbcLLCALLEXNative)
|
||||
@@ -37,18 +39,18 @@ ASM_PFX(EbcLLCALLEXNative):
|
||||
mov %ebp,%esp
|
||||
pop %ebx
|
||||
pop %ebp
|
||||
ret
|
||||
ret
|
||||
|
||||
.globl ASM_PFX(EbcLLGetEbcEntryPoint)
|
||||
ASM_PFX(EbcLLGetEbcEntryPoint):
|
||||
ret
|
||||
ret
|
||||
|
||||
.globl ASM_PFX(EbcLLGetStackPointer)
|
||||
ASM_PFX(EbcLLGetStackPointer):
|
||||
mov %esp,%eax
|
||||
add $0x4,%eax
|
||||
ret
|
||||
ret
|
||||
|
||||
.globl ASM_PFX(EbcLLGetReturnValue)
|
||||
ASM_PFX(EbcLLGetReturnValue):
|
||||
ret
|
||||
ret
|
||||
|
@@ -1,31 +1,20 @@
|
||||
;/** @file
|
||||
; This code provides low level routines that support the Virtual Machine
|
||||
; for option ROMs.
|
||||
;
|
||||
; Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
; 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.
|
||||
;
|
||||
;**/
|
||||
|
||||
page ,132
|
||||
title VM ASSEMBLY LANGUAGE ROUTINES
|
||||
;****************************************************************************
|
||||
;*
|
||||
;* Copyright (c) 2006 - 2007, 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.
|
||||
;*
|
||||
;****************************************************************************
|
||||
;****************************************************************************
|
||||
; REV 1.0
|
||||
;****************************************************************************
|
||||
;
|
||||
; Rev Date Description
|
||||
; --- -------- ------------------------------------------------------------
|
||||
; 1.0 03/14/01 Initial creation of file.
|
||||
;
|
||||
;****************************************************************************
|
||||
|
||||
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
; This code provides low level routines that support the Virtual Machine
|
||||
; for option ROMs.
|
||||
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Equate files needed.
|
||||
@@ -40,8 +29,8 @@
|
||||
;---------------------------------------------------------------------------
|
||||
|
||||
.686p
|
||||
.model flat
|
||||
.code
|
||||
.model flat
|
||||
.code
|
||||
;---------------------------------------------------------------------------
|
||||
;;GenericPostSegment SEGMENT USE16
|
||||
;---------------------------------------------------------------------------
|
||||
@@ -51,9 +40,9 @@ CopyMem PROTO C Destination:PTR DWORD, Source:PTR DWORD, Count:DWORD
|
||||
; EbcLLCALLEXNative
|
||||
;
|
||||
; This function is called to execute an EBC CALLEX instruction
|
||||
; to native code.
|
||||
; to native code.
|
||||
; This instruction requires that we thunk out to external native
|
||||
; code. For IA32, we simply switch stacks and jump to the
|
||||
; code. For IA32, we simply switch stacks and jump to the
|
||||
; specified function. On return, we restore the stack pointer
|
||||
; to its original location.
|
||||
;
|
||||
@@ -64,17 +53,17 @@ _EbcLLCALLEXNative PROC NEAR PUBLIC
|
||||
push ebp
|
||||
push ebx
|
||||
mov ebp, esp ; standard function prolog
|
||||
|
||||
|
||||
; Get function address in a register
|
||||
; mov ecx, FuncAddr => mov ecx, dword ptr [FuncAddr]
|
||||
mov ecx, dword ptr [esp]+0Ch
|
||||
|
||||
|
||||
; Set stack pointer to new value
|
||||
; mov eax, NewStackPointer => mov eax, dword ptr [NewSp]
|
||||
mov eax, dword ptr [esp] + 14h
|
||||
mov edx, dword ptr [esp] + 10h
|
||||
sub eax, edx
|
||||
sub esp, eax
|
||||
sub esp, eax
|
||||
mov ebx, esp
|
||||
push ecx
|
||||
push eax
|
||||
@@ -88,7 +77,7 @@ _EbcLLCALLEXNative PROC NEAR PUBLIC
|
||||
|
||||
; Now call the external routine
|
||||
call ecx
|
||||
|
||||
|
||||
; ebp is preserved by the callee. In this function it
|
||||
; equals the original esp, so set them equal
|
||||
mov esp, ebp
|
||||
@@ -105,7 +94,7 @@ _EbcLLCALLEXNative ENDP
|
||||
; Routine Description:
|
||||
; The VM thunk code stuffs an EBC entry point into a processor
|
||||
; register. Since we can't use inline assembly to get it from
|
||||
; the interpreter C code, stuff it into the return value
|
||||
; the interpreter C code, stuff it into the return value
|
||||
; register and return.
|
||||
;
|
||||
; Arguments:
|
||||
@@ -121,7 +110,7 @@ _EbcLLGetEbcEntryPoint ENDP
|
||||
;/*++
|
||||
;
|
||||
;Routine Description:
|
||||
;
|
||||
;
|
||||
; Return the caller's value of the stack pointer.
|
||||
;
|
||||
;Arguments:
|
||||
@@ -136,7 +125,7 @@ _EbcLLGetEbcEntryPoint ENDP
|
||||
;
|
||||
;--*/
|
||||
|
||||
; UINTN EbcLLGetStackPointer()
|
||||
; 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
|
||||
|
@@ -1,24 +1,19 @@
|
||||
//++
|
||||
// Copyright (c) 2006, 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:
|
||||
//
|
||||
// EbcLowLevel.s
|
||||
//
|
||||
// Abstract:
|
||||
//
|
||||
// Contains low level routines for the Virtual Machine implementation
|
||||
// on an Itanium-based platform.
|
||||
//
|
||||
//
|
||||
//--
|
||||
/// @file
|
||||
/// Contains low level routines for the Virtual Machine implementation
|
||||
/// on an Itanium-based platform.
|
||||
///
|
||||
/// Copyright (c) 2006, 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: EbcLowLevel.s
|
||||
///
|
||||
///
|
||||
|
||||
.file "EbcLowLevel.s"
|
||||
|
||||
@@ -40,7 +35,7 @@ name::
|
||||
mov ar##.##pfs=loc1 ;;\
|
||||
br##.##ret##.##dpnt b0;;
|
||||
|
||||
.type CopyMem, @function;
|
||||
.type CopyMem, @function;
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
//++
|
||||
@@ -51,16 +46,16 @@ name::
|
||||
// calls the native function. On return it restores the original
|
||||
// stack pointer and returns to the caller.
|
||||
//
|
||||
// Arguments :
|
||||
// Arguments :
|
||||
//
|
||||
// On Entry :
|
||||
// in0 = Address of native code to call
|
||||
// in1 = New stack pointer
|
||||
//
|
||||
// Return Value:
|
||||
//
|
||||
// As per static calling conventions.
|
||||
//
|
||||
// Return Value:
|
||||
//
|
||||
// As per static calling conventions.
|
||||
//
|
||||
//--
|
||||
//---------------------------------------------------------------------------
|
||||
;// void EbcAsmLLCALLEX (UINTN FunctionAddr, UINTN EbcStackPointer)
|
||||
@@ -75,7 +70,7 @@ PROCEDURE_ENTRY(EbcAsmLLCALLEX)
|
||||
mov r8 = in1;;
|
||||
|
||||
//
|
||||
// Copy stack arguments from EBC stack into registers.
|
||||
// Copy stack arguments from EBC stack into registers.
|
||||
// Assume worst case and copy 8.
|
||||
//
|
||||
ld8 out0 = [r8], 8;;
|
||||
@@ -98,7 +93,7 @@ PROCEDURE_ENTRY(EbcAsmLLCALLEX)
|
||||
or loc3 = r1, r0
|
||||
|
||||
//
|
||||
// Set the new aligned stack pointer. Reserve space for the required
|
||||
// Set the new aligned stack pointer. Reserve space for the required
|
||||
// 16-bytes of scratch area as well.
|
||||
//
|
||||
add r12 = 48, in1
|
||||
@@ -129,13 +124,13 @@ PROCEDURE_EXIT(EbcAsmLLCALLEX)
|
||||
|
||||
PROCEDURE_ENTRY(EbcLLCALLEXNative)
|
||||
NESTED_SETUP (3,6,3,0)
|
||||
|
||||
|
||||
mov loc2 = in2;;
|
||||
mov loc3 = in1;;
|
||||
sub loc2 = loc2, loc3
|
||||
mov loc4 = r12;;
|
||||
or loc5 = r1, r0
|
||||
|
||||
|
||||
sub r12 = r12, loc2
|
||||
mov out2 = loc2;;
|
||||
|
||||
@@ -145,13 +140,13 @@ PROCEDURE_ENTRY(EbcLLCALLEXNative)
|
||||
adds r12 = -0x8, r12
|
||||
(p0) br.call.dptk.many b0 = CopyMem;;
|
||||
adds r12 = 0x8, r12
|
||||
|
||||
|
||||
mov out0 = in0;;
|
||||
mov out1 = r12;;
|
||||
(p0) br.call.dptk.many b0 = EbcAsmLLCALLEX;;
|
||||
mov r12 = loc4;;
|
||||
or r1 = loc5, r0
|
||||
|
||||
|
||||
NESTED_RETURN
|
||||
PROCEDURE_EXIT(EbcLLCALLEXNative)
|
||||
|
||||
@@ -186,7 +181,7 @@ PROCEDURE_EXIT(EbcLLGetReturnValue)
|
||||
PROCEDURE_ENTRY(EbcLLGetStackPointer)
|
||||
mov r8 = r12 ;;
|
||||
br.ret.sptk b0 ;;
|
||||
br.sptk.few b6
|
||||
br.sptk.few b6
|
||||
PROCEDURE_EXIT(EbcLLGetStackPointer)
|
||||
|
||||
|
||||
|
@@ -1,29 +1,17 @@
|
||||
#****************************************************************************
|
||||
#*
|
||||
#* Copyright (c) 2006, 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.
|
||||
#*
|
||||
#****************************************************************************
|
||||
#****************************************************************************
|
||||
# REV 1.0
|
||||
#****************************************************************************
|
||||
#
|
||||
# Rev Date Description
|
||||
# --- -------- ------------------------------------------------------------
|
||||
# 1.0 05/09/12 Initial creation of file.
|
||||
#
|
||||
#****************************************************************************
|
||||
|
||||
#* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
##/**@file
|
||||
# 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. 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.
|
||||
#
|
||||
#**/
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Equate files needed.
|
||||
@@ -36,10 +24,10 @@
|
||||
#****************************************************************************
|
||||
# EbcLLCALLEX
|
||||
#
|
||||
# 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
|
||||
# code. For x64, we switch stacks, copy the arguments to the stack
|
||||
# and jump to the specified function.
|
||||
# and jump to the specified function.
|
||||
# On return, we restore the stack pointer to its original location.
|
||||
#
|
||||
# Destroys no working registers.
|
||||
@@ -62,7 +50,7 @@ _EbcLLCALLEXNative:
|
||||
sub %rsp, %r8
|
||||
mov %rsp, %rcx
|
||||
sub %rsp, 0x20
|
||||
call _CopyMem
|
||||
call _CopyMem
|
||||
add %rsp, 0x20
|
||||
|
||||
# Considering the worst case, load 4 potiential arguments
|
||||
@@ -86,7 +74,7 @@ _EbcLLCALLEXNative:
|
||||
# Routine Description:
|
||||
# The VM thunk code stuffs an EBC entry point into a processor
|
||||
# register. Since we can't use inline assembly to get it from
|
||||
# the interpreter C code, stuff it into the return value
|
||||
# the interpreter C code, stuff it into the return value
|
||||
# register and return.
|
||||
#
|
||||
# Arguments:
|
||||
@@ -102,7 +90,7 @@ _EbcLLGetEbcEntryPoint:
|
||||
#/*++
|
||||
#
|
||||
#Routine Description:
|
||||
#
|
||||
#
|
||||
# Return the caller's value of the stack pointer.
|
||||
#
|
||||
#Arguments:
|
||||
@@ -117,7 +105,7 @@ _EbcLLGetEbcEntryPoint:
|
||||
#
|
||||
#--*/
|
||||
|
||||
# UINTN EbcLLGetStackPointer()
|
||||
# UINTN EbcLLGetStackPointer()
|
||||
.global _EbcLLGetStackPointer;
|
||||
_EbcLLGetStackPointer:
|
||||
mov %rsp, %rax
|
||||
|
@@ -1,31 +1,21 @@
|
||||
;/** @file
|
||||
; This code provides low level routines that support the Virtual Machine.
|
||||
; for option ROMs.
|
||||
;
|
||||
; Copyright (c) 2006 - 2008, Intel Corporation. <BR>
|
||||
; 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.
|
||||
;
|
||||
;**/
|
||||
|
||||
|
||||
page ,132
|
||||
title VM ASSEMBLY LANGUAGE ROUTINES
|
||||
;****************************************************************************
|
||||
;*
|
||||
;* Copyright (c) 2006, 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.
|
||||
;*
|
||||
;****************************************************************************
|
||||
;****************************************************************************
|
||||
; REV 1.0
|
||||
;****************************************************************************
|
||||
;
|
||||
; Rev Date Description
|
||||
; --- -------- ------------------------------------------------------------
|
||||
; 1.0 05/09/12 Initial creation of file.
|
||||
;
|
||||
;****************************************************************************
|
||||
|
||||
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
; This code provides low level routines that support the Virtual Machine
|
||||
; for option ROMs.
|
||||
;* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Equate files needed.
|
||||
@@ -40,10 +30,10 @@ text SEGMENT
|
||||
;****************************************************************************
|
||||
; EbcLLCALLEX
|
||||
;
|
||||
; 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
|
||||
; code. For x64, we switch stacks, copy the arguments to the stack
|
||||
; and jump to the specified function.
|
||||
; and jump to the specified function.
|
||||
; On return, we restore the stack pointer to its original location.
|
||||
;
|
||||
; Destroys no working registers.
|
||||
@@ -58,7 +48,7 @@ EbcLLCALLEXNative PROC PUBLIC
|
||||
push rbx
|
||||
mov rbp, rsp
|
||||
; Function prolog
|
||||
|
||||
|
||||
; Copy FuncAddr to a preserved register.
|
||||
mov rbx, rcx
|
||||
|
||||
@@ -67,9 +57,9 @@ EbcLLCALLEXNative PROC PUBLIC
|
||||
sub rsp, r8
|
||||
mov rcx, rsp
|
||||
sub rsp, 20h
|
||||
call CopyMem
|
||||
call CopyMem
|
||||
add rsp, 20h
|
||||
|
||||
|
||||
; Considering the worst case, load 4 potiential arguments
|
||||
; into registers.
|
||||
mov rcx, qword ptr [rsp]
|
||||
@@ -79,7 +69,7 @@ EbcLLCALLEXNative PROC PUBLIC
|
||||
|
||||
; Now call the external routine
|
||||
call rbx
|
||||
|
||||
|
||||
; Function epilog
|
||||
mov rsp, rbp
|
||||
pop rbx
|
||||
@@ -92,7 +82,7 @@ EbcLLCALLEXNative ENDP
|
||||
; Routine Description:
|
||||
; The VM thunk code stuffs an EBC entry point into a processor
|
||||
; register. Since we can't use inline assembly to get it from
|
||||
; the interpreter C code, stuff it into the return value
|
||||
; the interpreter C code, stuff it into the return value
|
||||
; register and return.
|
||||
;
|
||||
; Arguments:
|
||||
@@ -108,7 +98,7 @@ EbcLLGetEbcEntryPoint ENDP
|
||||
;/*++
|
||||
;
|
||||
;Routine Description:
|
||||
;
|
||||
;
|
||||
; Return the caller's value of the stack pointer.
|
||||
;
|
||||
;Arguments:
|
||||
@@ -123,7 +113,7 @@ EbcLLGetEbcEntryPoint ENDP
|
||||
;
|
||||
;--*/
|
||||
|
||||
; UINTN EbcLLGetStackPointer()
|
||||
; UINTN EbcLLGetStackPointer()
|
||||
EbcLLGetStackPointer PROC PUBLIC
|
||||
mov rax, rsp ; get current stack pointer
|
||||
; Stack adjusted by this much when we were called,
|
||||
|
Reference in New Issue
Block a user