Renamed remotely
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@6020 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2005, 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:
|
||||
|
||||
EfiJump.h
|
||||
|
||||
Abstract:
|
||||
|
||||
This is the Setjump/Longjump pair for an x64 processor.
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _EFI_JUMP_H_
|
||||
#define _EFI_JUMP_H_
|
||||
|
||||
typedef struct {
|
||||
UINT64 Rbx;
|
||||
UINT64 Rsp;
|
||||
UINT64 Rbp;
|
||||
UINT64 Rdi;
|
||||
UINT64 Rsi;
|
||||
UINT64 R10;
|
||||
UINT64 R11;
|
||||
UINT64 R12;
|
||||
UINT64 R13;
|
||||
UINT64 R14;
|
||||
UINT64 R15;
|
||||
UINT64 Rip;
|
||||
} EFI_JUMP_BUFFER;
|
||||
|
||||
#endif
|
@@ -0,0 +1,41 @@
|
||||
/*++
|
||||
|
||||
Copyright 2005, 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:
|
||||
|
||||
IdtDumb.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "Tiano.h"
|
||||
|
||||
UINTN
|
||||
ReadIdtBase (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
UpdateIdt (
|
||||
UINT32 IdtBase,
|
||||
UINT16 IdtLimit
|
||||
)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
117
EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/Math.c
Normal file
117
EdkCompatibilityPkg/Foundation/Library/Pei/PeiLib/X64/Math.c
Normal file
@@ -0,0 +1,117 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2005, 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:
|
||||
|
||||
Math.c
|
||||
|
||||
Abstract:
|
||||
|
||||
64-bit Math worker functions for x64
|
||||
|
||||
--*/
|
||||
|
||||
#include "Efi.h"
|
||||
#include "Pei.h"
|
||||
#include "PeiLib.h"
|
||||
|
||||
|
||||
UINT64
|
||||
LShiftU64 (
|
||||
IN UINT64 Operand,
|
||||
IN UINTN Count
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine allows a 64 bit value to be left shifted by 32 bits and returns the
|
||||
shifted value.
|
||||
Count is valid up 63. (Only Bits 0-5 is valid for Count)
|
||||
|
||||
Arguments:
|
||||
|
||||
Operand - Value to be shifted
|
||||
|
||||
Count - Number of times to shift left.
|
||||
|
||||
Returns:
|
||||
|
||||
Value shifted left identified by the Count.
|
||||
|
||||
--*/
|
||||
{
|
||||
return Operand << Count;
|
||||
}
|
||||
|
||||
|
||||
UINT64
|
||||
MultU64x32 (
|
||||
IN UINT64 Multiplicand,
|
||||
IN UINTN Multiplier
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine allows a 64 bit value to be multiplied with a 32 bit value returns
|
||||
64bit result.
|
||||
No checking if the result is greater than 64bits
|
||||
|
||||
Arguments:
|
||||
|
||||
Multiplicand -
|
||||
|
||||
Multiplier -
|
||||
|
||||
Returns:
|
||||
|
||||
Multiplicand * Multiplier
|
||||
|
||||
--*/
|
||||
{
|
||||
return Multiplicand * Multiplier;
|
||||
}
|
||||
}
|
||||
|
||||
UINT64
|
||||
DivU64x32 (
|
||||
IN UINT64 Dividend,
|
||||
IN UINTN Divisor,
|
||||
OUT UINTN *Remainder OPTIONAL
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine allows a 64 bit value to be divided with a 32 bit value returns
|
||||
64bit result and the Remainder.
|
||||
|
||||
Arguments:
|
||||
|
||||
Dividend -
|
||||
|
||||
Divisor -
|
||||
|
||||
Remainder -
|
||||
|
||||
Returns:
|
||||
|
||||
Dividend / Divisor
|
||||
Remainder = Dividend mod Divisor
|
||||
|
||||
N.B. only works for 31bit divisors!!
|
||||
|
||||
--*/
|
||||
{
|
||||
return Dividend/Divisor;
|
||||
}
|
||||
|
@@ -0,0 +1,87 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2005 - 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:
|
||||
|
||||
PeCoffLoaderEx.c
|
||||
|
||||
Abstract:
|
||||
|
||||
x64 Specific relocation fixups
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#include "TianoCommon.h"
|
||||
#include "EfiImage.h"
|
||||
|
||||
EFI_STATUS
|
||||
PeCoffLoaderRelocateImageEx (
|
||||
IN UINT16 *Reloc,
|
||||
IN OUT CHAR8 *Fixup,
|
||||
IN OUT CHAR8 **FixupData,
|
||||
IN UINT64 Adjust
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
Performs an x64 specific relocation fixup
|
||||
|
||||
Arguments:
|
||||
Reloc - Pointer to the relocation record
|
||||
Fixup - Pointer to the address to fix up
|
||||
FixupData - Pointer to a buffer to log the fixups
|
||||
Adjust - The offset to adjust the fixup
|
||||
|
||||
Returns:
|
||||
EFI_UNSUPPORTED - relocate unsupported
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
PeCoffLoaderImageFormatSupported (
|
||||
IN UINT16 Machine
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
|
||||
Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
||||
does not mean the image can be executed it means the PE/COFF loader supports
|
||||
loading and relocating of the image type. It's up to the caller to support
|
||||
the entry point.
|
||||
|
||||
This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
|
||||
& X64 images. Calling the entry point in a correct mannor is up to the
|
||||
consumer of this library.
|
||||
|
||||
Arguments:
|
||||
|
||||
Machine - Machine type from the PE Header.
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE - if this PE/COFF loader can load the image
|
||||
FALSE - if this PE/COFF loader cannot load the image
|
||||
|
||||
--*/
|
||||
{
|
||||
if ((Machine == EFI_IMAGE_MACHINE_IA32) || (Machine == EFI_IMAGE_MACHINE_X64) ||
|
||||
(Machine == EFI_IMAGE_MACHINE_EBC)) {
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
@@ -0,0 +1,85 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2004 - 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:
|
||||
|
||||
PeCoffLoaderEx.h
|
||||
|
||||
Abstract:
|
||||
|
||||
x64 Specific relocation fixups
|
||||
|
||||
Revision History
|
||||
|
||||
--*/
|
||||
|
||||
#ifndef _PE_COFF_LOADER_EX_H_
|
||||
#define _PE_COFF_LOADER_EX_H_
|
||||
|
||||
EFI_STATUS
|
||||
PeCoffLoaderRelocateImageEx (
|
||||
IN UINT16 *Reloc,
|
||||
IN OUT CHAR8 *Fixup,
|
||||
IN OUT CHAR8 **FixupData,
|
||||
IN UINT64 Adjust
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Performs an x64 specific relocation fixup
|
||||
|
||||
Arguments:
|
||||
|
||||
Reloc - Pointer to the relocation record
|
||||
|
||||
Fixup - Pointer to the address to fix up
|
||||
|
||||
FixupData - Pointer to a buffer to log the fixups
|
||||
|
||||
Adjust - The offset to adjust the fixup
|
||||
|
||||
Returns:
|
||||
|
||||
EFI_UNSUPPORTED - relocate unsupported
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
BOOLEAN
|
||||
PeCoffLoaderImageFormatSupported (
|
||||
IN UINT16 Machine
|
||||
)
|
||||
/*++
|
||||
Routine Description:
|
||||
|
||||
Returns TRUE if the machine type of PE/COFF image is supported. Supported
|
||||
does not mean the image can be executed it means the PE/COFF loader supports
|
||||
loading and relocating of the image type. It's up to the caller to support
|
||||
the entry point.
|
||||
|
||||
This function implies the basic PE/COFF loader/relocator supports IA32, EBC,
|
||||
& X64 images. Calling the entry point in a correct mannor is up to the
|
||||
consumer of this library.
|
||||
|
||||
Arguments:
|
||||
|
||||
Machine - Machine type from the PE Header.
|
||||
|
||||
Returns:
|
||||
|
||||
TRUE - if this PE/COFF loader can load the image
|
||||
FALSE - if this PE/COFF loader cannot load the image
|
||||
|
||||
--*/
|
||||
;
|
||||
|
||||
#endif
|
@@ -0,0 +1,98 @@
|
||||
/*++
|
||||
|
||||
Copyright 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.
|
||||
|
||||
|
||||
Module Name:
|
||||
|
||||
PeiServicePointer.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "Tiano.h"
|
||||
#include "PeiApi.h"
|
||||
|
||||
|
||||
#if (PI_SPECIFICATION_VERSION >= 0x00010000)
|
||||
|
||||
VOID
|
||||
SetPeiServicesTablePointer (
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Save PeiService pointer so that it can be retrieved anywhere.
|
||||
|
||||
Arguments:
|
||||
|
||||
PeiServices - The direct pointer to PeiServiceTable.
|
||||
PhyscialAddress - The physcial address of variable PeiServices.
|
||||
|
||||
Returns:
|
||||
NONE
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EFI_PEI_SERVICES **
|
||||
GetPeiServicesTablePointer (
|
||||
VOID
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Get PeiService pointer.
|
||||
|
||||
Arguments:
|
||||
|
||||
NONE.
|
||||
|
||||
Returns:
|
||||
The direct pointer to PeiServiceTable.
|
||||
|
||||
--*/
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
MigrateIdtTable (
|
||||
IN EFI_PEI_SERVICES **PeiServices
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Migrate IDT from CAR to real memory where preceded with 4 bytes for
|
||||
storing PeiService pointer.
|
||||
|
||||
Arguments:
|
||||
|
||||
PeiServices - The direct pointer to PeiServiceTable.
|
||||
|
||||
Returns:
|
||||
|
||||
NONE.
|
||||
|
||||
--*/
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@@ -0,0 +1,34 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2005, 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:
|
||||
|
||||
PerformancePrimitives.c
|
||||
|
||||
Abstract:
|
||||
|
||||
Support for Performance library
|
||||
|
||||
--*/
|
||||
|
||||
#include "TianoCommon.h"
|
||||
#include "CpuIA32.h"
|
||||
|
||||
EFI_STATUS
|
||||
GetTimerValue (
|
||||
OUT UINT64 *TimerValue
|
||||
)
|
||||
{
|
||||
*TimerValue = EfiReadTsc ();
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -0,0 +1,149 @@
|
||||
/*++
|
||||
|
||||
Copyright 2005 - 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.
|
||||
|
||||
|
||||
Module Name:
|
||||
|
||||
Processor.c
|
||||
|
||||
Abstract:
|
||||
|
||||
--*/
|
||||
|
||||
#include "Tiano.h"
|
||||
#include "EfiJump.h"
|
||||
#include EFI_GUID_DEFINITION (PeiFlushInstructionCache)
|
||||
#include EFI_GUID_DEFINITION (PeiTransferControl)
|
||||
|
||||
//
|
||||
// Prototypes
|
||||
//
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TransferControlSetJump (
|
||||
IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
|
||||
IN VOID *Jump
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
TransferControlLongJump (
|
||||
IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
|
||||
IN VOID *Jump
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FlushInstructionCacheFlush (
|
||||
IN EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL *This,
|
||||
IN EFI_PHYSICAL_ADDRESS Start,
|
||||
IN UINT64 Length
|
||||
);
|
||||
|
||||
//
|
||||
// Table declarations
|
||||
//
|
||||
EFI_PEI_TRANSFER_CONTROL_PROTOCOL mTransferControl = {
|
||||
TransferControlSetJump,
|
||||
TransferControlLongJump,
|
||||
sizeof (EFI_JUMP_BUFFER)
|
||||
};
|
||||
|
||||
EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL mFlushInstructionCache = {
|
||||
FlushInstructionCacheFlush
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InstallEfiPeiTransferControl(
|
||||
IN OUT EFI_PEI_TRANSFER_CONTROL_PROTOCOL **This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Installs the pointer to the transfer control mechanism
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to transfer control mechanism.
|
||||
|
||||
Returns:
|
||||
|
||||
This - Pointer to transfer control mechanism.
|
||||
|
||||
--*/
|
||||
{
|
||||
*This = &mTransferControl;
|
||||
mTransferControl.SetJump = TransferControlSetJump;
|
||||
mTransferControl.LongJump = TransferControlLongJump;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
InstallEfiPeiFlushInstructionCache (
|
||||
IN OUT EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL **This
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
Installs the pointer to the flush instruction cache mechanism
|
||||
|
||||
Arguments:
|
||||
|
||||
This - Pointer to flush instruction cache mechanism.
|
||||
|
||||
Returns:
|
||||
|
||||
This - Pointer to flush instruction cache mechanism.
|
||||
|
||||
--*/
|
||||
{
|
||||
*This = &mFlushInstructionCache;
|
||||
mFlushInstructionCache.Flush = FlushInstructionCacheFlush;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
FlushInstructionCacheFlush (
|
||||
IN EFI_PEI_FLUSH_INSTRUCTION_CACHE_PROTOCOL *This,
|
||||
IN EFI_PHYSICAL_ADDRESS Start,
|
||||
IN UINT64 Length
|
||||
)
|
||||
/*++
|
||||
|
||||
Routine Description:
|
||||
|
||||
This routine would provide support for flushing the CPU instruction cache.
|
||||
In the case of IA32, this flushing is not necessary and is thus not implemented.
|
||||
|
||||
Arguments:
|
||||
|
||||
Pointer to CPU Architectural Protocol interface
|
||||
Start adddress in memory to flush
|
||||
Length of memory to flush
|
||||
|
||||
Returns:
|
||||
|
||||
Status
|
||||
EFI_SUCCESS
|
||||
|
||||
--*/
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
@@ -0,0 +1,158 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; Copyright (c) 2005 - 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.
|
||||
;
|
||||
; Module Name:
|
||||
; ProcessorAsms.Asm
|
||||
;
|
||||
; Abstract:
|
||||
; This is separated from processor.c to allow this functions to be built with /O1
|
||||
;
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
text SEGMENT
|
||||
|
||||
|
||||
;
|
||||
; 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 // rcx
|
||||
; Parameter - Parameter to pass in // rdx
|
||||
; NewStack - New Location of the stack // r8
|
||||
; NewBsp - New BSP // r9 - not used
|
||||
;
|
||||
; Returns:
|
||||
; Nothing. Goes to the Entry Point passing in the new parameters
|
||||
;
|
||||
SwitchStacks PROC PUBLIC
|
||||
|
||||
; Adjust stack for
|
||||
; 1) leave 4 registers space
|
||||
; 2) let it 16 bytes aligned after call
|
||||
sub r8, 20h
|
||||
and r8w, 0fff0h ; do not assume 16 bytes aligned
|
||||
|
||||
mov rsp, r8 ; rsp = NewStack
|
||||
mov r10, rcx ; save EntryPoint
|
||||
mov rcx, rdx ; Arg1 = Parameter
|
||||
call r10 ; r10 = copy of EntryPoint
|
||||
;
|
||||
; no ret as we have a new stack and we jumped to the new location
|
||||
;
|
||||
ret
|
||||
|
||||
SwitchStacks ENDP
|
||||
|
||||
|
||||
EFI_SUCCESS equ 0
|
||||
EFI_WARN_RETURN_FROM_LONG_JUMP equ 5
|
||||
|
||||
;
|
||||
; Generated by h2inc run manually
|
||||
;
|
||||
_EFI_JUMP_BUFFER STRUCT 2t
|
||||
_rbx QWORD ?
|
||||
_rsp QWORD ?
|
||||
_rbp QWORD ?
|
||||
_rdi QWORD ?
|
||||
_rsi QWORD ?
|
||||
_r10 QWORD ?
|
||||
_r11 QWORD ?
|
||||
_r12 QWORD ?
|
||||
_r13 QWORD ?
|
||||
_r14 QWORD ?
|
||||
_r15 QWORD ?
|
||||
_rip QWORD ?
|
||||
_EFI_JUMP_BUFFER ENDS
|
||||
|
||||
EFI_JUMP_BUFFER TYPEDEF _EFI_JUMP_BUFFER
|
||||
|
||||
|
||||
;
|
||||
;Routine Description:
|
||||
;
|
||||
; This routine implements the x64 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
|
||||
;
|
||||
; EFI_STATUS
|
||||
; EFIAPI
|
||||
; TransferControlLongJump (
|
||||
; IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
|
||||
; IN EFI_JUMP_BUFFER *Jump
|
||||
; );
|
||||
;
|
||||
; rcx - *This
|
||||
; rdx - JumpBuffer
|
||||
;
|
||||
PUBLIC TransferControlSetJump
|
||||
TransferControlSetJump PROC
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._rbx, rbx
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._rsp, rsp
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._rbp, rbp
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._rdi, rdi
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._rsi, rsi
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._r10, r10
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._r11, r11
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._r12, r12
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._r13, r13
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._r14, r14
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._r15, r15
|
||||
mov rax, QWORD PTR [rsp+0]
|
||||
mov (EFI_JUMP_BUFFER PTR [rdx])._rip, rax
|
||||
mov rax, EFI_SUCCESS
|
||||
ret
|
||||
|
||||
TransferControlSetJump ENDP
|
||||
|
||||
;
|
||||
; EFI_STATUS
|
||||
; EFIAPI
|
||||
; TransferControlLongJump (
|
||||
; IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This, // rcx
|
||||
; IN EFI_JUMP_BUFFER *Jump // rdx
|
||||
; );
|
||||
;
|
||||
;
|
||||
PUBLIC TransferControlLongJump
|
||||
TransferControlLongJump PROC
|
||||
; set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
|
||||
mov rax, EFI_WARN_RETURN_FROM_LONG_JUMP
|
||||
mov rbx, (EFI_JUMP_BUFFER PTR [rdx])._rbx
|
||||
mov rsp, (EFI_JUMP_BUFFER PTR [rdx])._rsp
|
||||
mov rbp, (EFI_JUMP_BUFFER PTR [rdx])._rbp
|
||||
mov rdi, (EFI_JUMP_BUFFER PTR [rdx])._rdi
|
||||
mov rsi, (EFI_JUMP_BUFFER PTR [rdx])._rsi
|
||||
mov r10, (EFI_JUMP_BUFFER PTR [rdx])._r10
|
||||
mov r11, (EFI_JUMP_BUFFER PTR [rdx])._r11
|
||||
mov r12, (EFI_JUMP_BUFFER PTR [rdx])._r12
|
||||
mov r13, (EFI_JUMP_BUFFER PTR [rdx])._r13
|
||||
mov r14, (EFI_JUMP_BUFFER PTR [rdx])._r14
|
||||
mov r15, (EFI_JUMP_BUFFER PTR [rdx])._r15
|
||||
add rsp, 8 ;pop the eip
|
||||
jmp QWORD PTR (EFI_JUMP_BUFFER PTR [rdx])._rip
|
||||
; set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
|
||||
mov rax, EFI_WARN_RETURN_FROM_LONG_JUMP
|
||||
ret
|
||||
TransferControlLongJump ENDP
|
||||
|
||||
text ENDS
|
||||
END
|
@@ -0,0 +1,135 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 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.
|
||||
#
|
||||
# Module Name:
|
||||
# ProcessorAsms.S
|
||||
#
|
||||
# Abstract:
|
||||
# This is separated from processor.c to allow this functions to be built with /O1
|
||||
#
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#include <EfiBind.h>
|
||||
|
||||
.text
|
||||
|
||||
.global ASM_PFX(SwitchStacks)
|
||||
.global ASM_PFX(TransferControlSetJump)
|
||||
.global ASM_PFX(TransferControlLongJump)
|
||||
|
||||
#
|
||||
# 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 // rcx
|
||||
# Parameter - Parameter to pass in // rdx
|
||||
# NewStack - New Location of the stack // r8
|
||||
# NewBsp - New BSP // r9 - not used
|
||||
#
|
||||
# Returns:
|
||||
# Nothing. Goes to the Entry Point passing in the new parameters
|
||||
#
|
||||
ASM_PFX(SwitchStacks):
|
||||
|
||||
# Adjust stack for
|
||||
# 1) leave 4 registers space
|
||||
# 2) let it 16 bytes aligned after call
|
||||
sub $0x20,%r8
|
||||
and -0x10,%r8w # do not assume 16 bytes aligned
|
||||
|
||||
mov %r8,%rsp
|
||||
mov %rcx,%r10
|
||||
mov %rdx,%rcx
|
||||
callq *%r10
|
||||
|
||||
#
|
||||
# no ret as we have a new stack and we jumped to the new location
|
||||
#
|
||||
ret
|
||||
|
||||
#SwitchStacks ENDP
|
||||
|
||||
|
||||
.equ EFI_SUCCESS, 0
|
||||
.equ EFI_WARN_RETURN_FROM_LONG_JUMP, 5
|
||||
|
||||
#
|
||||
#Routine Description:
|
||||
#
|
||||
# This routine implements the x64 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
|
||||
#
|
||||
# EFI_STATUS
|
||||
# EFIAPI
|
||||
# TransferControlLongJump (
|
||||
# IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This,
|
||||
# IN EFI_JUMP_BUFFER *Jump
|
||||
# );
|
||||
#
|
||||
# rcx - *This
|
||||
# rdx - JumpBuffer
|
||||
#
|
||||
ASM_PFX(TransferControlSetJump):
|
||||
mov %rbx,(%rdx)
|
||||
mov %rsp,0x8(%rdx)
|
||||
mov %rbp,0x10(%rdx)
|
||||
mov %rdi,0x18(%rdx)
|
||||
mov %rsi,0x20(%rdx)
|
||||
mov %r10,0x28(%rdx)
|
||||
mov %r11,0x30(%rdx)
|
||||
mov %r12,0x38(%rdx)
|
||||
mov %r13,0x40(%rdx)
|
||||
mov %r14,0x48(%rdx)
|
||||
mov %r15,0x50(%rdx)
|
||||
mov (%rsp),%rax
|
||||
mov %rax,0x58(%rdx)
|
||||
mov $0x0,%rax
|
||||
retq
|
||||
|
||||
|
||||
#
|
||||
# EFI_STATUS
|
||||
# EFIAPI
|
||||
# TransferControlLongJump (
|
||||
# IN EFI_PEI_TRANSFER_CONTROL_PROTOCOL *This, // rcx
|
||||
# IN EFI_JUMP_BUFFER *Jump // rdx
|
||||
# );
|
||||
#
|
||||
#
|
||||
ASM_PFX(TransferControlLongJump):
|
||||
# set return from SetJump to EFI_WARN_RETURN_FROM_LONG_JUMP
|
||||
mov $0x5,%rax
|
||||
mov (%rdx),%rbx
|
||||
mov 0x8(%rdx),%rsp
|
||||
mov 0x10(%rdx),%rbp
|
||||
mov 0x18(%rdx),%rdi
|
||||
mov 0x20(%rdx),%rsi
|
||||
mov 0x28(%rdx),%r10
|
||||
mov 0x30(%rdx),%r11
|
||||
mov 0x38(%rdx),%r12
|
||||
mov 0x40(%rdx),%r13
|
||||
mov 0x48(%rdx),%r14
|
||||
mov 0x50(%rdx),%r15
|
||||
add $0x8,%rsp
|
||||
jmpq *0x58(%rdx)
|
||||
mov $0x5,%rax
|
||||
retq
|
||||
|
@@ -0,0 +1,78 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 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.
|
||||
#
|
||||
# Module Name:
|
||||
#
|
||||
# SupportItpDebug.S
|
||||
#
|
||||
# Abstract:
|
||||
#
|
||||
# This is the code for debuging X64, to add a break hook at loading every module
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
#include <EfiBind.h>
|
||||
|
||||
.text
|
||||
|
||||
.global ASM_PFX(AsmEfiSetBreakSupport)
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# VOID
|
||||
# AsmEfiSetBreakSupport (
|
||||
# IN UINTN LoadAddr // rcx
|
||||
# )
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
ASM_PFX(AsmEfiSetBreakSupport):
|
||||
|
||||
movw $60000, %dx
|
||||
outl %eax, %dx
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
ret
|
||||
|
||||
|
||||
|
||||
|
@@ -0,0 +1,76 @@
|
||||
;------------------------------------------------------------------------------
|
||||
;
|
||||
; 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:
|
||||
;
|
||||
; SupportItpDebug.asm
|
||||
;
|
||||
; Abstract:
|
||||
;
|
||||
; This is the code for debuging X64, to add a break hook at loading every module
|
||||
;
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
; PROC:PRIVATE
|
||||
.CODE
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; VOID
|
||||
; AsmEfiSetBreakSupport (
|
||||
; IN UINTN LoadAddr // rcx
|
||||
; )
|
||||
;------------------------------------------------------------------------------
|
||||
|
||||
AsmEfiSetBreakSupport PROC PUBLIC
|
||||
|
||||
mov dx, 60000
|
||||
out dx, eax
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
nop
|
||||
ret
|
||||
|
||||
AsmEfiSetBreakSupport ENDP
|
||||
END
|
||||
|
Reference in New Issue
Block a user