InOsEmuPkg: Rename package to EmulatorPkg & Sec to Host
* Rename InOsEmuPkg to EmulatorPkg * Rename Unix/Sec to Unix/Host Signed-off-by: jljusten Reviewed-by: andrewfish Reviewed-by: geekboy15a git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11918 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
8
EmulatorPkg/Unix/.gdbinit
Normal file
8
EmulatorPkg/Unix/.gdbinit
Normal file
@@ -0,0 +1,8 @@
|
||||
set confirm off
|
||||
set output-radix 16
|
||||
b SecGdbScriptBreak
|
||||
command
|
||||
silent
|
||||
source SecMain.gdb
|
||||
c
|
||||
end
|
79
EmulatorPkg/Unix/GdbRun
Normal file
79
EmulatorPkg/Unix/GdbRun
Normal file
@@ -0,0 +1,79 @@
|
||||
## @file
|
||||
# GDB startup script
|
||||
#
|
||||
# Copyright (c) 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
|
||||
# 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.
|
||||
#
|
||||
##
|
||||
|
||||
#
|
||||
# Gdb will set $_exitcode when the program exits. Pre-init it to an unlikely
|
||||
# return value.
|
||||
#
|
||||
set $_exitcode = 42
|
||||
|
||||
#
|
||||
# Gdb will call hook-stop on each break. Check to see if $_exitcode was
|
||||
# changed from the value we pre-initialized it to. If so, the program
|
||||
# had exited, so gdb should now quit.
|
||||
#
|
||||
define hook-stop
|
||||
if $_exitcode != 42
|
||||
quit
|
||||
else
|
||||
source SecMain.gdb
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# We keep track of the number of symbol files we have loaded via gdb
|
||||
# scripts in the $SymbolFilesAdded variable
|
||||
#
|
||||
set $SymbolFileChangesCount = 0
|
||||
|
||||
#
|
||||
# This macro adds a symbols file for gdb
|
||||
#
|
||||
# @param $arg0 - Symbol file changes number
|
||||
# @param $arg1 - Symbol file name
|
||||
# @param $arg2 - Image address
|
||||
#
|
||||
define AddFirmwareSymbolFile
|
||||
if $SymbolFileChangesCount < $arg0
|
||||
add-symbol-file $arg1 $arg2
|
||||
set $SymbolFileChangesCount = $arg0
|
||||
end
|
||||
end
|
||||
|
||||
#
|
||||
# This macro removes a symbols file for gdb
|
||||
#
|
||||
# @param $arg0 - Symbol file changes number
|
||||
# @param $arg1 - Symbol file name
|
||||
#
|
||||
define RemoveFirmwareSymbolFile
|
||||
if $SymbolFileChangesCount < $arg0
|
||||
#
|
||||
# Currently there is not a method to remove a single symbol file
|
||||
#
|
||||
set $SymbolFileChangesCount = $arg0
|
||||
end
|
||||
end
|
||||
|
||||
if gInXcode == 1
|
||||
# in Xcode the program is already runing. Issuing a run command
|
||||
# will cause a fatal debugger error. The break point sciprt that
|
||||
# is used to source this script sets gInCode to 1.
|
||||
else
|
||||
#
|
||||
# Start the program running
|
||||
#
|
||||
run
|
||||
end
|
1111
EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c
Normal file
1111
EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c
Normal file
File diff suppressed because it is too large
Load Diff
706
EmulatorPkg/Unix/Host/BlockIo.c
Normal file
706
EmulatorPkg/Unix/Host/BlockIo.c
Normal file
@@ -0,0 +1,706 @@
|
||||
/**@file
|
||||
|
||||
Copyright (c) 2004 - 2009, 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
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#include "SecMain.h"
|
||||
|
||||
#define EMU_BLOCK_IO_PRIVATE_SIGNATURE SIGNATURE_32 ('E', 'M', 'b', 'k')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL *Thunk;
|
||||
|
||||
char *Filename;
|
||||
UINTN ReadMode;
|
||||
UINTN Mode;
|
||||
|
||||
int fd;
|
||||
|
||||
BOOLEAN RemovableMedia;
|
||||
BOOLEAN WriteProtected;
|
||||
|
||||
UINT64 NumberOfBlocks;
|
||||
UINT32 BlockSize;
|
||||
|
||||
EMU_BLOCK_IO_PROTOCOL EmuBlockIo;
|
||||
EFI_BLOCK_IO_MEDIA *Media;
|
||||
|
||||
} EMU_BLOCK_IO_PRIVATE;
|
||||
|
||||
#define EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, EMU_BLOCK_IO_PRIVATE, EmuBlockIo, EMU_BLOCK_IO_PRIVATE_SIGNATURE)
|
||||
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoReset (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
|
||||
/*++
|
||||
|
||||
This function extends the capability of SetFilePointer to accept 64 bit parameters
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
SetFilePointer64 (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private,
|
||||
IN INT64 DistanceToMove,
|
||||
OUT UINT64 *NewFilePointer,
|
||||
IN INT32 MoveMethod
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
off_t res;
|
||||
off_t offset = DistanceToMove;
|
||||
|
||||
Status = EFI_SUCCESS;
|
||||
res = lseek (Private->fd, offset, (int)MoveMethod);
|
||||
if (res == -1) {
|
||||
Status = EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
if (NewFilePointer != NULL) {
|
||||
*NewFilePointer = res;
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoOpenDevice (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINT64 FileSize;
|
||||
struct statfs buf;
|
||||
|
||||
|
||||
//
|
||||
// If the device is already opened, close it
|
||||
//
|
||||
if (Private->fd >= 0) {
|
||||
EmuBlockIoReset (&Private->EmuBlockIo, FALSE);
|
||||
}
|
||||
|
||||
//
|
||||
// Open the device
|
||||
//
|
||||
Private->fd = open (Private->Filename, Private->Mode, 0644);
|
||||
if (Private->fd < 0) {
|
||||
printf ("EmuOpenBlock: Could not open %s: %s\n", Private->Filename, strerror(errno));
|
||||
Private->Media->MediaPresent = FALSE;
|
||||
Status = EFI_NO_MEDIA;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (!Private->Media->MediaPresent) {
|
||||
//
|
||||
// BugBug: try to emulate if a CD appears - notify drivers to check it out
|
||||
//
|
||||
Private->Media->MediaPresent = TRUE;
|
||||
}
|
||||
|
||||
//
|
||||
// get the size of the file
|
||||
//
|
||||
Status = SetFilePointer64 (Private, 0, &FileSize, SEEK_END);
|
||||
if (EFI_ERROR (Status)) {
|
||||
printf ("EmuOpenBlock: Could not get filesize of %s\n", Private->Filename);
|
||||
Status = EFI_UNSUPPORTED;
|
||||
goto Done;
|
||||
}
|
||||
|
||||
if (FileSize == 0) {
|
||||
// lseek fails on a real device. ioctl calls are OS specific
|
||||
#if __APPLE__
|
||||
{
|
||||
UINT32 BlockSize;
|
||||
|
||||
if (ioctl (Private->fd, DKIOCGETBLOCKSIZE, &BlockSize) == 0) {
|
||||
Private->Media->BlockSize = BlockSize;
|
||||
}
|
||||
if (ioctl (Private->fd, DKIOCGETBLOCKCOUNT, &Private->NumberOfBlocks) == 0) {
|
||||
if ((Private->NumberOfBlocks == 0) && (BlockSize == 0x800)) {
|
||||
// A DVD is ~ 4.37 GB so make up a number
|
||||
Private->Media->LastBlock = (0x100000000ULL/0x800) - 1;
|
||||
} else {
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
}
|
||||
}
|
||||
ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
|
||||
}
|
||||
#else
|
||||
{
|
||||
size_t BlockSize;
|
||||
UINT64 DiskSize;
|
||||
|
||||
if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {
|
||||
Private->Media->BlockSize = BlockSize;
|
||||
}
|
||||
if (ioctl (Private->fd, BLKGETSIZE64, &DiskSize) == 0) {
|
||||
Private->NumberOfBlocks = DivU64x32 (DiskSize, (UINT32)BlockSize);
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
} else {
|
||||
Private->Media->BlockSize = Private->BlockSize;
|
||||
Private->NumberOfBlocks = DivU64x32 (FileSize, Private->Media->BlockSize);
|
||||
Private->Media->LastBlock = Private->NumberOfBlocks - 1;
|
||||
|
||||
if (fstatfs (Private->fd, &buf) == 0) {
|
||||
#if __APPLE__
|
||||
Private->Media->OptimalTransferLengthGranularity = buf.f_iosize/buf.f_bsize;
|
||||
#else
|
||||
Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
DEBUG ((EFI_D_INIT, "%HEmuOpenBlock: opened %a%N\n", Private->Filename));
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
if (EFI_ERROR (Status)) {
|
||||
if (Private->fd >= 0) {
|
||||
EmuBlockIoReset (&Private->EmuBlockIo, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoCreateMapping (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN EFI_BLOCK_IO_MEDIA *Media
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
|
||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
Private->Media = Media;
|
||||
|
||||
Media->MediaId = 0;
|
||||
Media->RemovableMedia = Private->RemovableMedia;
|
||||
Media->MediaPresent = TRUE;
|
||||
Media->LogicalPartition = FALSE;
|
||||
Media->ReadOnly = Private->WriteProtected;
|
||||
Media->WriteCaching = FALSE;
|
||||
Media->IoAlign = 1;
|
||||
Media->LastBlock = 0; // Filled in by OpenDevice
|
||||
|
||||
// EFI_BLOCK_IO_PROTOCOL_REVISION2
|
||||
Media->LowestAlignedLba = 0;
|
||||
Media->LogicalBlocksPerPhysicalBlock = 0;
|
||||
|
||||
|
||||
// EFI_BLOCK_IO_PROTOCOL_REVISION3
|
||||
Media->OptimalTransferLengthGranularity = 0;
|
||||
|
||||
Status = EmuBlockIoOpenDevice (Private);
|
||||
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoError (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
BOOLEAN ReinstallBlockIoFlag;
|
||||
|
||||
|
||||
switch (errno) {
|
||||
|
||||
case EAGAIN:
|
||||
Status = EFI_NO_MEDIA;
|
||||
Private->Media->ReadOnly = FALSE;
|
||||
Private->Media->MediaPresent = FALSE;
|
||||
ReinstallBlockIoFlag = FALSE;
|
||||
break;
|
||||
|
||||
case EACCES:
|
||||
Private->Media->ReadOnly = FALSE;
|
||||
Private->Media->MediaPresent = TRUE;
|
||||
Private->Media->MediaId += 1;
|
||||
ReinstallBlockIoFlag = TRUE;
|
||||
Status = EFI_MEDIA_CHANGED;
|
||||
break;
|
||||
|
||||
case EROFS:
|
||||
Private->Media->ReadOnly = TRUE;
|
||||
ReinstallBlockIoFlag = FALSE;
|
||||
Status = EFI_WRITE_PROTECTED;
|
||||
break;
|
||||
|
||||
default:
|
||||
ReinstallBlockIoFlag = FALSE;
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
break;
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoReadWriteCommon (
|
||||
IN EMU_BLOCK_IO_PRIVATE *Private,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA Lba,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer,
|
||||
IN CHAR8 *CallerName
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
UINTN BlockSize;
|
||||
UINT64 LastBlock;
|
||||
INT64 DistanceToMove;
|
||||
UINT64 DistanceMoved;
|
||||
|
||||
if (Private->fd < 0) {
|
||||
Status = EmuBlockIoOpenDevice (Private);
|
||||
if (EFI_ERROR (Status)) {
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Private->Media->MediaPresent) {
|
||||
DEBUG ((EFI_D_INIT, "%s: No Media\n", CallerName));
|
||||
return EFI_NO_MEDIA;
|
||||
}
|
||||
|
||||
if (Private->Media->MediaId != MediaId) {
|
||||
return EFI_MEDIA_CHANGED;
|
||||
}
|
||||
|
||||
if ((UINTN) Buffer % Private->Media->IoAlign != 0) {
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
//
|
||||
// Verify buffer size
|
||||
//
|
||||
BlockSize = Private->Media->BlockSize;
|
||||
if (BufferSize == 0) {
|
||||
DEBUG ((EFI_D_INIT, "%s: Zero length read\n", CallerName));
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
if ((BufferSize % BlockSize) != 0) {
|
||||
DEBUG ((EFI_D_INIT, "%s: Invalid read size\n", CallerName));
|
||||
return EFI_BAD_BUFFER_SIZE;
|
||||
}
|
||||
|
||||
LastBlock = Lba + (BufferSize / BlockSize) - 1;
|
||||
if (LastBlock > Private->Media->LastBlock) {
|
||||
DEBUG ((EFI_D_INIT, "ReadBlocks: Attempted to read off end of device\n"));
|
||||
return EFI_INVALID_PARAMETER;
|
||||
}
|
||||
//
|
||||
// Seek to End of File
|
||||
//
|
||||
DistanceToMove = MultU64x32 (Lba, BlockSize);
|
||||
Status = SetFilePointer64 (Private, DistanceToMove, &DistanceMoved, SEEK_SET);
|
||||
|
||||
if (EFI_ERROR (Status)) {
|
||||
DEBUG ((EFI_D_INIT, "WriteBlocks: SetFilePointer failed\n"));
|
||||
return EmuBlockIoError (Private);
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Read BufferSize bytes from Lba into Buffer.
|
||||
|
||||
This function reads the requested number of blocks from the device. All the
|
||||
blocks are read, or an error is returned.
|
||||
If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_or EFI_MEDIA_CHANGED is returned and
|
||||
non-blocking I/O is being used, the Event associated with this request will
|
||||
not be signaled.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] MediaId Id of the media, changes every time the media is
|
||||
replaced.
|
||||
@param[in] Lba The starting Logical Block Address to read from.
|
||||
@param[in, out] Token A pointer to the token associated with the transaction.
|
||||
@param[in] BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param[out] Buffer A pointer to the destination buffer for the data. The
|
||||
caller is responsible for either having implicit or
|
||||
explicit ownership of the buffer.
|
||||
|
||||
@retval EFI_SUCCESS The read request was queued if Token->Event is
|
||||
not NULL.The data was read correctly from the
|
||||
device if the Token->Event is NULL.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing
|
||||
the read.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
||||
@retval EFI_BAD_BUFFER_SIZE The BufferSize parameter is not a multiple of the
|
||||
intrinsic block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The read request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
||||
of resources.
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuBlockIoReadBlocks (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
EFI_STATUS Status;
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
ssize_t len;
|
||||
|
||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixReadBlocks");
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
len = read (Private->fd, Buffer, BufferSize);
|
||||
if (len != BufferSize) {
|
||||
DEBUG ((EFI_D_INIT, "ReadBlocks: ReadFile failed.\n"));
|
||||
Status = EmuBlockIoError (Private);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// If we read then media is present.
|
||||
//
|
||||
Private->Media->MediaPresent = TRUE;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
if (Token != NULL) {
|
||||
if (Token->Event != NULL) {
|
||||
// Caller is responcible for signaling EFI Event
|
||||
Token->TransactionStatus = Status;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Write BufferSize bytes from Lba into Buffer.
|
||||
|
||||
This function writes the requested number of blocks to the device. All blocks
|
||||
are written, or an error is returned.If EFI_DEVICE_ERROR, EFI_NO_MEDIA,
|
||||
EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED is returned and non-blocking I/O is
|
||||
being used, the Event associated with this request will not be signaled.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] MediaId The media ID that the write request is for.
|
||||
@param[in] Lba The starting logical block address to be written. The
|
||||
caller is responsible for writing to only legitimate
|
||||
locations.
|
||||
@param[in, out] Token A pointer to the token associated with the transaction.
|
||||
@param[in] BufferSize Size of Buffer, must be a multiple of device block size.
|
||||
@param[in] Buffer A pointer to the source buffer for the data.
|
||||
|
||||
@retval EFI_SUCCESS The write request was queued if Event is not NULL.
|
||||
The data was written correctly to the device if
|
||||
the Event is NULL.
|
||||
@retval EFI_WRITE_PROTECTED The device can not be written to.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHNAGED The MediaId does not matched the current device.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while performing the write.
|
||||
@retval EFI_BAD_BUFFER_SIZE The Buffer was not a multiple of the block size of the device.
|
||||
@retval EFI_INVALID_PARAMETER The write request contains LBAs that are not valid,
|
||||
or the buffer is not on proper alignment.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
||||
of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuBlockIoWriteBlocks (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
ssize_t len;
|
||||
EFI_STATUS Status;
|
||||
|
||||
|
||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
Status = EmuBlockIoReadWriteCommon (Private, MediaId, LBA, BufferSize, Buffer, "UnixWriteBlocks");
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Done;
|
||||
}
|
||||
|
||||
len = write (Private->fd, Buffer, BufferSize);
|
||||
if (len != BufferSize) {
|
||||
DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed.\n"));
|
||||
Status = EmuBlockIoError (Private);
|
||||
goto Done;
|
||||
}
|
||||
|
||||
//
|
||||
// If the write succeeded, we are not write protected and media is present.
|
||||
//
|
||||
Private->Media->MediaPresent = TRUE;
|
||||
Private->Media->ReadOnly = FALSE;
|
||||
Status = EFI_SUCCESS;
|
||||
|
||||
Done:
|
||||
if (Token != NULL) {
|
||||
if (Token->Event != NULL) {
|
||||
// Caller is responcible for signaling EFI Event
|
||||
Token->TransactionStatus = Status;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Flush the Block Device.
|
||||
|
||||
If EFI_DEVICE_ERROR, EFI_NO_MEDIA,_EFI_WRITE_PROTECTED or EFI_MEDIA_CHANGED
|
||||
is returned and non-blocking I/O is being used, the Event associated with
|
||||
this request will not be signaled.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in,out] Token A pointer to the token associated with the transaction
|
||||
|
||||
@retval EFI_SUCCESS The flush request was queued if Event is not NULL.
|
||||
All outstanding data was written correctly to the
|
||||
device if the Event is NULL.
|
||||
@retval EFI_DEVICE_ERROR The device reported an error while writting back
|
||||
the data.
|
||||
@retval EFI_WRITE_PROTECTED The device cannot be written to.
|
||||
@retval EFI_NO_MEDIA There is no media in the device.
|
||||
@retval EFI_MEDIA_CHANGED The MediaId is not for the current media.
|
||||
@retval EFI_OUT_OF_RESOURCES The request could not be completed due to a lack
|
||||
of resources.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuBlockIoFlushBlocks (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
)
|
||||
{
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
|
||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (Private->fd >= 0) {
|
||||
fsync (Private->fd);
|
||||
#if __APPLE__
|
||||
fcntl (Private->fd, F_FULLFSYNC);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
if (Token != NULL) {
|
||||
if (Token->Event != NULL) {
|
||||
// Caller is responcible for signaling EFI Event
|
||||
Token->TransactionStatus = EFI_SUCCESS;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reset the block device hardware.
|
||||
|
||||
@param[in] This Indicates a pointer to the calling context.
|
||||
@param[in] ExtendedVerification Indicates that the driver may perform a more
|
||||
exhausive verfication operation of the device
|
||||
during reset.
|
||||
|
||||
@retval EFI_SUCCESS The device was reset.
|
||||
@retval EFI_DEVICE_ERROR The device is not functioning properly and could
|
||||
not be reset.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuBlockIoReset (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
{
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
|
||||
Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
if (Private->fd >= 0) {
|
||||
close (Private->fd);
|
||||
Private->fd = -1;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
char *
|
||||
StdDupUnicodeToAscii (
|
||||
IN CHAR16 *Str
|
||||
)
|
||||
{
|
||||
UINTN Size;
|
||||
char *Ascii;
|
||||
char *Ptr;
|
||||
|
||||
Size = StrLen (Str) + 1;
|
||||
Ascii = malloc (Size);
|
||||
if (Ascii == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
for (Ptr = Ascii; *Str != '\0'; Ptr++, Str++) {
|
||||
*Ptr = *Str;
|
||||
}
|
||||
*Ptr = 0;
|
||||
|
||||
return Ascii;
|
||||
}
|
||||
|
||||
|
||||
EMU_BLOCK_IO_PROTOCOL gEmuBlockIoProtocol = {
|
||||
GasketEmuBlockIoReset,
|
||||
GasketEmuBlockIoReadBlocks,
|
||||
GasketEmuBlockIoWriteBlocks,
|
||||
GasketEmuBlockIoFlushBlocks,
|
||||
GasketEmuBlockIoCreateMapping
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
char *Str;
|
||||
|
||||
if (This->Private != NULL) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
if (!CompareGuid (This->Protocol, &gEmuBlockIoProtocolGuid)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Private = malloc (sizeof (EMU_BLOCK_IO_PRIVATE));
|
||||
if (Private == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Private->Signature = EMU_BLOCK_IO_PRIVATE_SIGNATURE;
|
||||
Private->Thunk = This;
|
||||
CopyMem (&Private->EmuBlockIo, &gEmuBlockIoProtocol, sizeof (gEmuBlockIoProtocol));
|
||||
Private->fd = -1;
|
||||
Private->BlockSize = 512;
|
||||
|
||||
Private->Filename = StdDupUnicodeToAscii (This->ConfigString);
|
||||
if (Private->Filename == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
Str = strstr (Private->Filename, ":");
|
||||
if (Str == NULL) {
|
||||
Private->RemovableMedia = FALSE;
|
||||
Private->WriteProtected = FALSE;
|
||||
} else {
|
||||
for (*Str++ = '\0'; *Str != 0; Str++) {
|
||||
if (*Str == 'R' || *Str == 'F') {
|
||||
Private->RemovableMedia = (BOOLEAN) (*Str == 'R');
|
||||
}
|
||||
if (*Str == 'O' || *Str == 'W') {
|
||||
Private->WriteProtected = (BOOLEAN) (*Str == 'O');
|
||||
}
|
||||
if (*Str == ':') {
|
||||
Private->BlockSize = strtol (++Str, NULL, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
This->Interface = &Private->EmuBlockIo;
|
||||
This->Private = Private;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuBlockIoThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_BLOCK_IO_PRIVATE *Private;
|
||||
|
||||
if (!CompareGuid (This->Protocol, &gEmuBlockIoProtocolGuid)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Private = This->Private;
|
||||
|
||||
if (This->Private != NULL) {
|
||||
if (Private->Filename != NULL) {
|
||||
free (Private->Filename);
|
||||
}
|
||||
free (This->Private);
|
||||
This->Private = NULL;
|
||||
}
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo = {
|
||||
&gEmuBlockIoProtocolGuid,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
GasketBlockIoThunkOpen,
|
||||
GasketBlockIoThunkClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
432
EmulatorPkg/Unix/Host/EmuThunk.c
Normal file
432
EmulatorPkg/Unix/Host/EmuThunk.c
Normal file
@@ -0,0 +1,432 @@
|
||||
/*++ @file
|
||||
Since the SEC is the only program in our emulation we
|
||||
must use a UEFI/PI mechanism to export APIs to other modules.
|
||||
This is the role of the EFI_EMU_THUNK_PROTOCOL.
|
||||
|
||||
The mUnixThunkTable exists so that a change to EFI_EMU_THUNK_PROTOCOL
|
||||
will cause an error in initializing the array if all the member functions
|
||||
are not added. It looks like adding a element to end and not initializing
|
||||
it may cause the table to be initaliized with the members at the end being
|
||||
set to zero. This is bad as jumping to zero will crash.
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2011, Apple Inc. 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
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#include "SecMain.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define DebugAssert _Mangle__DebugAssert
|
||||
|
||||
#include <assert.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
|
||||
#undef DebugAssert
|
||||
#endif
|
||||
|
||||
int settimer_initialized;
|
||||
struct timeval settimer_timeval;
|
||||
void (*settimer_callback)(UINT64 delta);
|
||||
|
||||
BOOLEAN gEmulatorInterruptEnabled = FALSE;
|
||||
|
||||
|
||||
UINTN
|
||||
SecWriteStdErr (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
ssize_t Return;
|
||||
|
||||
Return = write (STDERR_FILENO, (const void *)Buffer, (size_t)NumberOfBytes);
|
||||
|
||||
return (Return == -1) ? 0 : Return;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
SecConfigStdIn (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
struct termios tty;
|
||||
|
||||
//
|
||||
// Need to turn off line buffering, ECHO, and make it unbuffered.
|
||||
//
|
||||
tcgetattr (STDIN_FILENO, &tty);
|
||||
tty.c_lflag &= ~(ICANON | ECHO);
|
||||
tcsetattr (STDIN_FILENO, TCSANOW, &tty);
|
||||
|
||||
// setvbuf (STDIN_FILENO, NULL, _IONBF, 0);
|
||||
|
||||
// now ioctl FIONREAD will do what we need
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
UINTN
|
||||
SecWriteStdOut (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
ssize_t Return;
|
||||
|
||||
Return = write (STDOUT_FILENO, (const void *)Buffer, (size_t)NumberOfBytes);
|
||||
|
||||
return (Return == -1) ? 0 : Return;
|
||||
}
|
||||
|
||||
UINTN
|
||||
SecReadStdIn (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
)
|
||||
{
|
||||
ssize_t Return;
|
||||
|
||||
Return = read (STDIN_FILENO, Buffer, (size_t)NumberOfBytes);
|
||||
|
||||
return (Return == -1) ? 0 : Return;
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SecPollStdIn (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
int Result;
|
||||
int Bytes;
|
||||
|
||||
Result = ioctl (STDIN_FILENO, FIONREAD, &Bytes);
|
||||
if (Result == -1) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return (BOOLEAN)(Bytes > 0);
|
||||
}
|
||||
|
||||
|
||||
VOID *
|
||||
SecMalloc (
|
||||
IN UINTN Size
|
||||
)
|
||||
{
|
||||
return malloc ((size_t)Size);
|
||||
}
|
||||
|
||||
VOID *
|
||||
SecValloc (
|
||||
IN UINTN Size
|
||||
)
|
||||
{
|
||||
return valloc ((size_t)Size);
|
||||
}
|
||||
|
||||
BOOLEAN
|
||||
SecFree (
|
||||
IN VOID *Ptr
|
||||
)
|
||||
{
|
||||
if (EfiSystemMemoryRange (Ptr)) {
|
||||
// If an address range is in the EFI memory map it was alloced via EFI.
|
||||
// So don't free those ranges and let the caller know.
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
free (Ptr);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
settimer_handler (int sig)
|
||||
{
|
||||
struct timeval timeval;
|
||||
UINT64 delta;
|
||||
|
||||
gettimeofday (&timeval, NULL);
|
||||
delta = ((UINT64)timeval.tv_sec * 1000) + (timeval.tv_usec / 1000)
|
||||
- ((UINT64)settimer_timeval.tv_sec * 1000)
|
||||
- (settimer_timeval.tv_usec / 1000);
|
||||
settimer_timeval = timeval;
|
||||
|
||||
if (settimer_callback) {
|
||||
ReverseGasketUint64 (settimer_callback, delta);
|
||||
}
|
||||
}
|
||||
|
||||
VOID
|
||||
SecSetTimer (
|
||||
IN UINT64 PeriodMs,
|
||||
IN EMU_SET_TIMER_CALLBACK CallBack
|
||||
)
|
||||
{
|
||||
struct itimerval timerval;
|
||||
UINT32 remainder;
|
||||
|
||||
if (!settimer_initialized) {
|
||||
struct sigaction act;
|
||||
|
||||
settimer_initialized = 1;
|
||||
act.sa_handler = settimer_handler;
|
||||
act.sa_flags = 0;
|
||||
sigemptyset (&act.sa_mask);
|
||||
gEmulatorInterruptEnabled = TRUE;
|
||||
if (sigaction (SIGALRM, &act, NULL) != 0) {
|
||||
printf ("SetTimer: sigaction error %s\n", strerror (errno));
|
||||
}
|
||||
if (gettimeofday (&settimer_timeval, NULL) != 0) {
|
||||
printf ("SetTimer: gettimeofday error %s\n", strerror (errno));
|
||||
}
|
||||
}
|
||||
timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
|
||||
DivU64x32Remainder(PeriodMs, 1000, &remainder);
|
||||
timerval.it_value.tv_usec = remainder * 1000;
|
||||
timerval.it_value.tv_sec = DivU64x32(PeriodMs, 1000);
|
||||
timerval.it_interval = timerval.it_value;
|
||||
|
||||
if (setitimer (ITIMER_REAL, &timerval, NULL) != 0) {
|
||||
printf ("SetTimer: setitimer error %s\n", strerror (errno));
|
||||
}
|
||||
settimer_callback = CallBack;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecEnableInterrupt (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
gEmulatorInterruptEnabled = TRUE;
|
||||
// Since SetTimer() uses SIGALRM we emulate turning on and off interrupts
|
||||
// by enabling/disabling SIGALRM.
|
||||
sigemptyset (&sigset);
|
||||
sigaddset (&sigset, SIGALRM);
|
||||
pthread_sigmask (SIG_UNBLOCK, &sigset, NULL);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecDisableInterrupt (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
sigset_t sigset;
|
||||
|
||||
// Since SetTimer() uses SIGALRM we emulate turning on and off interrupts
|
||||
// by enabling/disabling SIGALRM.
|
||||
sigemptyset (&sigset);
|
||||
sigaddset (&sigset, SIGALRM);
|
||||
pthread_sigmask (SIG_BLOCK, &sigset, NULL);
|
||||
gEmulatorInterruptEnabled = FALSE;
|
||||
}
|
||||
|
||||
|
||||
BOOLEAN
|
||||
SecInterruptEanbled (void)
|
||||
{
|
||||
return gEmulatorInterruptEnabled;
|
||||
}
|
||||
|
||||
|
||||
UINT64
|
||||
QueryPerformanceFrequency (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// Hard code to nanoseconds
|
||||
return 1000000000ULL;
|
||||
}
|
||||
|
||||
UINT64
|
||||
QueryPerformanceCounter (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
#if __APPLE__
|
||||
UINT64 Start;
|
||||
Nanoseconds elapsedNano;
|
||||
|
||||
Start = mach_absolute_time ();
|
||||
|
||||
// Convert to nanoseconds.
|
||||
|
||||
// Have to do some pointer fun because AbsoluteToNanoseconds
|
||||
// works in terms of UnsignedWide, which is a structure rather
|
||||
// than a proper 64-bit integer.
|
||||
elapsedNano = AbsoluteToNanoseconds (*(AbsoluteTime *) &Start);
|
||||
|
||||
return *(uint64_t *) &elapsedNano;
|
||||
#else
|
||||
// Need to figure out what to do for Linux?
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
SecSleep (
|
||||
IN UINT64 Nanoseconds
|
||||
)
|
||||
{
|
||||
struct timespec rq, rm;
|
||||
struct timeval start, end;
|
||||
unsigned long MicroSec;
|
||||
|
||||
rq.tv_sec = DivU64x32 (Nanoseconds, 1000000000);
|
||||
rq.tv_nsec = ModU64x32 (Nanoseconds, 1000000000);
|
||||
|
||||
//
|
||||
// nanosleep gets interrupted by our timer tic.
|
||||
// we need to track wall clock time or we will stall for way too long
|
||||
//
|
||||
gettimeofday (&start, NULL);
|
||||
end.tv_sec = start.tv_sec + rq.tv_sec;
|
||||
MicroSec = (start.tv_usec + rq.tv_nsec/1000);
|
||||
end.tv_usec = MicroSec % 1000000;
|
||||
if (MicroSec > 1000000) {
|
||||
end.tv_sec++;
|
||||
}
|
||||
|
||||
while (nanosleep (&rq, &rm) == -1) {
|
||||
if (errno != EINTR) {
|
||||
break;
|
||||
}
|
||||
gettimeofday (&start, NULL);
|
||||
if (start.tv_sec > end.tv_sec) {
|
||||
break;
|
||||
} if ((start.tv_sec == end.tv_sec) && (start.tv_usec > end.tv_usec)) {
|
||||
break;
|
||||
}
|
||||
rq = rm;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecCpuSleep (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
struct timespec rq, rm;
|
||||
|
||||
// nanosleep gets interrupted by the timer tic
|
||||
rq.tv_sec = 1;
|
||||
rq.tv_nsec = 0;
|
||||
|
||||
nanosleep (&rq, &rm);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecExit (
|
||||
UINTN Status
|
||||
)
|
||||
{
|
||||
exit (Status);
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
SecGetTime (
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||
)
|
||||
{
|
||||
struct tm *tm;
|
||||
time_t t;
|
||||
|
||||
t = time (NULL);
|
||||
tm = localtime (&t);
|
||||
|
||||
Time->Year = 1900 + tm->tm_year;
|
||||
Time->Month = tm->tm_mon + 1;
|
||||
Time->Day = tm->tm_mday;
|
||||
Time->Hour = tm->tm_hour;
|
||||
Time->Minute = tm->tm_min;
|
||||
Time->Second = tm->tm_sec;
|
||||
Time->Nanosecond = 0;
|
||||
Time->TimeZone = timezone;
|
||||
Time->Daylight = (daylight ? EFI_TIME_ADJUST_DAYLIGHT : 0)
|
||||
| (tm->tm_isdst > 0 ? EFI_TIME_IN_DAYLIGHT : 0);
|
||||
|
||||
if (Capabilities != NULL) {
|
||||
Capabilities->Resolution = 1;
|
||||
Capabilities->Accuracy = 50000000;
|
||||
Capabilities->SetsToZero = FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
VOID
|
||||
SecSetTime (
|
||||
IN EFI_TIME *Time
|
||||
)
|
||||
{
|
||||
// Don't change the time on the system
|
||||
// We could save delta to localtime() and have SecGetTime adjust return values?
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
SecGetNextProtocol (
|
||||
IN BOOLEAN EmuBusDriver,
|
||||
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
||||
)
|
||||
{
|
||||
return GetNextThunkProtocol (EmuBusDriver, Instance);
|
||||
}
|
||||
|
||||
|
||||
EMU_THUNK_PROTOCOL gEmuThunkProtocol = {
|
||||
GasketSecWriteStdErr,
|
||||
GasketSecConfigStdIn,
|
||||
GasketSecWriteStdOut,
|
||||
GasketSecReadStdIn,
|
||||
GasketSecPollStdIn,
|
||||
GasketSecMalloc,
|
||||
GasketSecValloc,
|
||||
GasketSecFree,
|
||||
GasketSecPeCoffGetEntryPoint,
|
||||
GasketSecPeCoffRelocateImageExtraAction,
|
||||
GasketSecPeCoffUnloadImageExtraAction,
|
||||
GasketSecEnableInterrupt,
|
||||
GasketSecDisableInterrupt,
|
||||
GasketQueryPerformanceFrequency,
|
||||
GasketQueryPerformanceCounter,
|
||||
GasketSecSleep,
|
||||
GasketSecCpuSleep,
|
||||
GasketSecExit,
|
||||
GasketSecGetTime,
|
||||
GasketSecSetTime,
|
||||
GasketSecSetTimer,
|
||||
GasketSecGetNextProtocol
|
||||
};
|
||||
|
||||
|
||||
VOID
|
||||
SecInitThunkProtocol (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// timezone and daylight lib globals depend on tzset be called 1st.
|
||||
tzset ();
|
||||
}
|
||||
|
651
EmulatorPkg/Unix/Host/Gasket.h
Normal file
651
EmulatorPkg/Unix/Host/Gasket.h
Normal file
@@ -0,0 +1,651 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
||||
Copyright (c) 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
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _GASKET_H_
|
||||
#define _GASKET_H_
|
||||
|
||||
//
|
||||
// EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI)
|
||||
//
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketSecWriteStdErr (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecConfigStdIn (
|
||||
VOID
|
||||
);
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketSecWriteStdOut (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
);
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketSecReadStdIn (
|
||||
IN UINT8 *Buffer,
|
||||
IN UINTN NumberOfBytes
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GasketSecPollStdIn (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
GasketSecMalloc (
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
GasketSecValloc (
|
||||
IN UINTN Size
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EFIAPI
|
||||
GasketSecFree (
|
||||
IN VOID *Ptr
|
||||
);
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
GasketSecPeCoffGetEntryPoint (
|
||||
IN VOID *Pe32Data,
|
||||
IN OUT VOID **EntryPoint
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecPeCoffRelocateImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecPeCoffUnloadImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecSetTimer (
|
||||
IN UINT64 PeriodMs,
|
||||
IN EMU_SET_TIMER_CALLBACK CallBack
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecEnableInterrupt (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecDisableInterrupt (
|
||||
VOID
|
||||
);
|
||||
|
||||
UINT64
|
||||
EFIAPI
|
||||
GasketQueryPerformanceFrequency (
|
||||
VOID
|
||||
);
|
||||
|
||||
UINT64
|
||||
EFIAPI
|
||||
GasketQueryPerformanceCounter (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecSleep (
|
||||
IN UINT64 Nanoseconds
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecCpuSleep (
|
||||
VOID
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecExit (
|
||||
UINTN Status
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecGetTime (
|
||||
OUT EFI_TIME *Time,
|
||||
OUT EFI_TIME_CAPABILITIES *Capabilities OPTIONAL
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketSecSetTime (
|
||||
IN EFI_TIME *Time
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecGetNextProtocol (
|
||||
IN BOOLEAN EmuBusDriver,
|
||||
OUT EMU_IO_THUNK_PROTOCOL **Instance OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
// PPIs produced by SEC
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecUnixPeiAutoScan (
|
||||
IN UINTN Index,
|
||||
OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
|
||||
OUT UINT64 *MemorySize
|
||||
);
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
GasketSecEmuThunkAddress (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecUnixUnixFwhAddress (
|
||||
IN OUT UINT64 *FwhSize,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
|
||||
);
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Reverse (UNIX to EFIAPI) gaskets
|
||||
//
|
||||
|
||||
typedef
|
||||
void
|
||||
(EFIAPI *CALL_BACK) (
|
||||
UINT64 Delta
|
||||
);
|
||||
|
||||
UINTN
|
||||
ReverseGasketUint64 (
|
||||
CALL_BACK CallBack,
|
||||
UINT64 a
|
||||
);
|
||||
|
||||
UINTN
|
||||
ReverseGasketUint64Uint64 (
|
||||
VOID *CallBack,
|
||||
VOID *Context,
|
||||
VOID *Key
|
||||
);
|
||||
|
||||
//
|
||||
// Gasket functions for EFI_EMU_UGA_IO_PROTOCOL
|
||||
//
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11Size (
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
|
||||
UINT32 Width,
|
||||
UINT32 Height
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11CheckKey (
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11GetKey (
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
|
||||
EFI_KEY_DATA *key
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11KeySetState (
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
|
||||
EFI_KEY_TOGGLE_STATE *KeyToggleState
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11RegisterKeyNotify (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
|
||||
IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack,
|
||||
IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11Blt (
|
||||
IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindows,
|
||||
IN EFI_UGA_PIXEL *BltBuffer OPTIONAL,
|
||||
IN EFI_UGA_BLT_OPERATION BltOperation,
|
||||
IN EMU_GRAPHICS_WINDOWS__BLT_ARGS *Args
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11CheckPointer (
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11GetPointerState (
|
||||
EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
|
||||
EFI_SIMPLE_POINTER_STATE *state
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11GraphicsWindowOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketX11GraphicsWindowClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
// Pthreads
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexLock (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexUnLock (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexTryLock (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
VOID *
|
||||
EFIAPI
|
||||
GasketPthreadMutexInit (
|
||||
IN VOID
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadMutexDestroy (
|
||||
IN VOID *Mutex
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadCreate (
|
||||
IN VOID *Thread,
|
||||
IN VOID *Attribute,
|
||||
IN THREAD_THUNK_THREAD_ENTRY Start,
|
||||
IN VOID *Context
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
GasketPthreadExit (
|
||||
IN VOID *ValuePtr
|
||||
);
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
GasketPthreadSelf (
|
||||
VOID
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPthreadOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPthreadClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
|
||||
// PosixFileSystem
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixOpenVolume (
|
||||
IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
|
||||
OUT EFI_FILE_PROTOCOL **Root
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileOpen (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
OUT EFI_FILE_PROTOCOL **NewHandle,
|
||||
IN CHAR16 *FileName,
|
||||
IN UINT64 OpenMode,
|
||||
IN UINT64 Attributes
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileCLose (
|
||||
IN EFI_FILE_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileDelete (
|
||||
IN EFI_FILE_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileRead (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileWrite (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
IN OUT UINTN *BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileSetPossition (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
IN UINT64 Position
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileGetPossition (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
OUT UINT64 *Position
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileGetInfo (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileSetInfo (
|
||||
IN EFI_FILE_PROTOCOL *This,
|
||||
IN EFI_GUID *InformationType,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileFlush (
|
||||
IN EFI_FILE_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileSystmeThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketPosixFileSystmeThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketEmuBlockIoReset (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketEmuBlockIoReadBlocks (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN UINTN BufferSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketEmuBlockIoWriteBlocks (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN UINT32 MediaId,
|
||||
IN EFI_LBA LBA,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketEmuBlockIoFlushBlocks (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN OUT EFI_BLOCK_IO2_TOKEN *Token
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketEmuBlockIoCreateMapping (
|
||||
IN EMU_BLOCK_IO_PROTOCOL *This,
|
||||
IN EFI_BLOCK_IO_MEDIA *Media
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketBlockIoThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketBlockIoThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpCreateMapping (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN EFI_SIMPLE_NETWORK_MODE *Media
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpStart (
|
||||
IN EMU_SNP_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpStop (
|
||||
IN EMU_SNP_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpInitialize (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN UINTN ExtraRxBufferSize OPTIONAL,
|
||||
IN UINTN ExtraTxBufferSize OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpReset (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpShutdown (
|
||||
IN EMU_SNP_PROTOCOL *This
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpReceiveFilters (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN UINT32 Enable,
|
||||
IN UINT32 Disable,
|
||||
IN BOOLEAN ResetMCastFilter,
|
||||
IN UINTN MCastFilterCnt OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpStationAddress (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN EFI_MAC_ADDRESS *New OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpStatistics (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN OUT UINTN *StatisticsSize OPTIONAL,
|
||||
OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpMCastIpToMac (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN IPv6,
|
||||
IN EFI_IP_ADDRESS *IP,
|
||||
OUT EFI_MAC_ADDRESS *MAC
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpNvData (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN ReadWrite,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BufferSize,
|
||||
IN OUT VOID *Buffer
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpGetStatus (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
OUT UINT32 *InterruptStatus OPTIONAL,
|
||||
OUT VOID **TxBuf OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpTransmit (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN UINTN HeaderSize,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer,
|
||||
IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
IN UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSnpReceive (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
OUT UINTN *HeaderSize OPTIONAL,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer,
|
||||
OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
OUT UINT16 *Protocol OPTIONAL
|
||||
);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
1492
EmulatorPkg/Unix/Host/Ia32/Gasket.S
Normal file
1492
EmulatorPkg/Unix/Host/Ia32/Gasket.S
Normal file
File diff suppressed because it is too large
Load Diff
74
EmulatorPkg/Unix/Host/Ia32/SwitchStack.c
Normal file
74
EmulatorPkg/Unix/Host/Ia32/SwitchStack.c
Normal file
@@ -0,0 +1,74 @@
|
||||
/*++
|
||||
|
||||
Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2009, Apple Inc. 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
|
||||
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.
|
||||
|
||||
|
||||
--*/
|
||||
|
||||
#include "SecMain.h"
|
||||
|
||||
|
||||
/**
|
||||
Transfers control to a function starting with a new stack.
|
||||
|
||||
Transfers control to the function specified by EntryPoint using the new stack
|
||||
specified by NewStack and passing in the parameters specified by Context1 and
|
||||
Context2. Context1 and Context2 are optional and may be NULL. The function
|
||||
EntryPoint must never return.
|
||||
|
||||
If EntryPoint is NULL, then ASSERT().
|
||||
If NewStack is NULL, then ASSERT().
|
||||
|
||||
@param EntryPoint A pointer to function to call with the new stack.
|
||||
@param Context1 A pointer to the context to pass into the EntryPoint
|
||||
function.
|
||||
@param Context2 A pointer to the context to pass into the EntryPoint
|
||||
function.
|
||||
@param NewStack A pointer to the new stack to use for the EntryPoint
|
||||
function.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
PeiSwitchStacks (
|
||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||
IN VOID *Context1, OPTIONAL
|
||||
IN VOID *Context2, OPTIONAL
|
||||
IN VOID *NewStack
|
||||
)
|
||||
{
|
||||
BASE_LIBRARY_JUMP_BUFFER JumpBuffer;
|
||||
|
||||
ASSERT (EntryPoint != NULL);
|
||||
ASSERT (NewStack != NULL);
|
||||
|
||||
//
|
||||
// Stack should be aligned with CPU_STACK_ALIGNMENT
|
||||
//
|
||||
ASSERT (((UINTN)NewStack & (CPU_STACK_ALIGNMENT - 1)) == 0);
|
||||
|
||||
JumpBuffer.Eip = (UINTN)EntryPoint;
|
||||
JumpBuffer.Esp = (UINTN)NewStack - sizeof (VOID*);
|
||||
JumpBuffer.Esp -= sizeof (Context1) + sizeof (Context2);
|
||||
((VOID**)JumpBuffer.Esp)[1] = Context1;
|
||||
((VOID**)JumpBuffer.Esp)[2] = Context2;
|
||||
|
||||
LongJump (&JumpBuffer, (UINTN)-1);
|
||||
|
||||
|
||||
//
|
||||
// PeiSwitchStacks () will never return
|
||||
//
|
||||
ASSERT (FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
604
EmulatorPkg/Unix/Host/LinuxPacketFilter.c
Normal file
604
EmulatorPkg/Unix/Host/LinuxPacketFilter.c
Normal file
@@ -0,0 +1,604 @@
|
||||
/**@file
|
||||
Linux Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
|
||||
emulator to get on real networks.
|
||||
|
||||
Currently only the Berkeley Packet Filter is fully implemented and this file
|
||||
is just a template that needs to get filled in.
|
||||
|
||||
Copyright (c) 2004 - 2009, Intel Corporation. All rights reserved.<BR>
|
||||
Portitions copyright (c) 2011, Apple Inc. 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.
|
||||
|
||||
**/
|
||||
|
||||
|
||||
#include "SecMain.h"
|
||||
|
||||
#ifndef __APPLE__
|
||||
|
||||
#define EMU_SNP_PRIVATE_SIGNATURE SIGNATURE_32('E', 'M', 's', 'n')
|
||||
typedef struct {
|
||||
UINTN Signature;
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL *Thunk;
|
||||
|
||||
|
||||
EMU_SNP_PROTOCOL EmuSnp;
|
||||
EFI_SIMPLE_NETWORK_MODE *Mode;
|
||||
|
||||
} EMU_SNP_PRIVATE;
|
||||
|
||||
#define EMU_SNP_PRIVATE_DATA_FROM_THIS(a) \
|
||||
CR(a, EMU_SNP_PRIVATE, EmuSnp, EMU_SNP_PRIVATE_SIGNATURE)
|
||||
|
||||
/**
|
||||
Register storage for SNP Mode.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Mode SimpleNetworkProtocol Mode structure passed into driver.
|
||||
|
||||
@retval EFI_SUCCESS The network interface was started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpCreateMapping (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN EFI_SIMPLE_NETWORK_MODE *Mode
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
Private->Mode = Mode;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "stopped" to "started".
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
|
||||
@retval EFI_SUCCESS The network interface was started.
|
||||
@retval EFI_ALREADY_STARTED The network interface is already in the started state.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpStart (
|
||||
IN EMU_SNP_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Changes the state of a network interface from "started" to "stopped".
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
|
||||
@retval EFI_SUCCESS The network interface was stopped.
|
||||
@retval EFI_ALREADY_STARTED The network interface is already in the stopped state.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpStop (
|
||||
IN EMU_SNP_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Resets a network adapter and allocates the transmit and receive buffers
|
||||
required by the network interface; optionally, also requests allocation
|
||||
of additional transmit and receive buffers.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param ExtraRxBufferSize The size, in bytes, of the extra receive buffer space
|
||||
that the driver should allocate for the network interface.
|
||||
Some network interfaces will not be able to use the extra
|
||||
buffer, and the caller will not know if it is actually
|
||||
being used.
|
||||
@param ExtraTxBufferSize The size, in bytes, of the extra transmit buffer space
|
||||
that the driver should allocate for the network interface.
|
||||
Some network interfaces will not be able to use the extra
|
||||
buffer, and the caller will not know if it is actually
|
||||
being used.
|
||||
|
||||
@retval EFI_SUCCESS The network interface was initialized.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_OUT_OF_RESOURCES There was not enough memory for the transmit and
|
||||
receive buffers.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpInitialize (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN UINTN ExtraRxBufferSize OPTIONAL,
|
||||
IN UINTN ExtraTxBufferSize OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Resets a network adapter and re-initializes it with the parameters that were
|
||||
provided in the previous call to Initialize().
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param ExtendedVerification Indicates that the driver may perform a more
|
||||
exhaustive verification operation of the device
|
||||
during reset.
|
||||
|
||||
@retval EFI_SUCCESS The network interface was reset.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpReset (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN ExtendedVerification
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Resets a network adapter and leaves it in a state that is safe for
|
||||
another driver to initialize.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
|
||||
@retval EFI_SUCCESS The network interface was shutdown.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpShutdown (
|
||||
IN EMU_SNP_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Manages the multicast receive filters of a network interface.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param Enable A bit mask of receive filters to enable on the network interface.
|
||||
@param Disable A bit mask of receive filters to disable on the network interface.
|
||||
@param ResetMCastFilter Set to TRUE to reset the contents of the multicast receive
|
||||
filters on the network interface to their default values.
|
||||
@param McastFilterCnt Number of multicast HW MAC addresses in the new
|
||||
MCastFilter list. This value must be less than or equal to
|
||||
the MCastFilterCnt field of EMU_SNP_MODE. This
|
||||
field is optional if ResetMCastFilter is TRUE.
|
||||
@param MCastFilter A pointer to a list of new multicast receive filter HW MAC
|
||||
addresses. This list will replace any existing multicast
|
||||
HW MAC address list. This field is optional if
|
||||
ResetMCastFilter is TRUE.
|
||||
|
||||
@retval EFI_SUCCESS The multicast receive filter list was updated.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpReceiveFilters (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN UINT32 Enable,
|
||||
IN UINT32 Disable,
|
||||
IN BOOLEAN ResetMCastFilter,
|
||||
IN UINTN MCastFilterCnt OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *MCastFilter OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Modifies or resets the current station address, if supported.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param Reset Flag used to reset the station address to the network interfaces
|
||||
permanent address.
|
||||
@param New The new station address to be used for the network interface.
|
||||
|
||||
@retval EFI_SUCCESS The network interfaces station address was updated.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpStationAddress (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN EFI_MAC_ADDRESS *New OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Resets or collects the statistics on a network interface.
|
||||
|
||||
@param This Protocol instance pointer.
|
||||
@param Reset Set to TRUE to reset the statistics for the network interface.
|
||||
@param StatisticsSize On input the size, in bytes, of StatisticsTable. On
|
||||
output the size, in bytes, of the resulting table of
|
||||
statistics.
|
||||
@param StatisticsTable A pointer to the EFI_NETWORK_STATISTICS structure that
|
||||
contains the statistics.
|
||||
|
||||
@retval EFI_SUCCESS The statistics were collected from the network interface.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
|
||||
size needed to hold the statistics is returned in
|
||||
StatisticsSize.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpStatistics (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN Reset,
|
||||
IN OUT UINTN *StatisticsSize OPTIONAL,
|
||||
OUT EFI_NETWORK_STATISTICS *StatisticsTable OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Converts a multicast IP address to a multicast HW MAC address.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param IPv6 Set to TRUE if the multicast IP address is IPv6 [RFC 2460]. Set
|
||||
to FALSE if the multicast IP address is IPv4 [RFC 791].
|
||||
@param IP The multicast IP address that is to be converted to a multicast
|
||||
HW MAC address.
|
||||
@param MAC The multicast HW MAC address that is to be generated from IP.
|
||||
|
||||
@retval EFI_SUCCESS The multicast IP address was mapped to the multicast
|
||||
HW MAC address.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_BUFFER_TOO_SMALL The Statistics buffer was too small. The current buffer
|
||||
size needed to hold the statistics is returned in
|
||||
StatisticsSize.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpMCastIpToMac (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN IPv6,
|
||||
IN EFI_IP_ADDRESS *IP,
|
||||
OUT EFI_MAC_ADDRESS *MAC
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Performs read and write operations on the NVRAM device attached to a
|
||||
network interface.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param ReadWrite TRUE for read operations, FALSE for write operations.
|
||||
@param Offset Byte offset in the NVRAM device at which to start the read or
|
||||
write operation. This must be a multiple of NvRamAccessSize and
|
||||
less than NvRamSize.
|
||||
@param BufferSize The number of bytes to read or write from the NVRAM device.
|
||||
This must also be a multiple of NvramAccessSize.
|
||||
@param Buffer A pointer to the data buffer.
|
||||
|
||||
@retval EFI_SUCCESS The NVRAM access was performed.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpNvData (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN BOOLEAN ReadWrite,
|
||||
IN UINTN Offset,
|
||||
IN UINTN BufferSize,
|
||||
IN OUT VOID *Buffer
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Reads the current interrupt status and recycled transmit buffer status from
|
||||
a network interface.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param InterruptStatus A pointer to the bit mask of the currently active interrupts
|
||||
If this is NULL, the interrupt status will not be read from
|
||||
the device. If this is not NULL, the interrupt status will
|
||||
be read from the device. When the interrupt status is read,
|
||||
it will also be cleared. Clearing the transmit interrupt
|
||||
does not empty the recycled transmit buffer array.
|
||||
@param TxBuf Recycled transmit buffer address. The network interface will
|
||||
not transmit if its internal recycled transmit buffer array
|
||||
is full. Reading the transmit buffer does not clear the
|
||||
transmit interrupt. If this is NULL, then the transmit buffer
|
||||
status will not be read. If there are no transmit buffers to
|
||||
recycle and TxBuf is not NULL, * TxBuf will be set to NULL.
|
||||
|
||||
@retval EFI_SUCCESS The status of the network interface was retrieved.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpGetStatus (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
OUT UINT32 *InterruptStatus OPTIONAL,
|
||||
OUT VOID **TxBuf OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Places a packet in the transmit queue of a network interface.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param HeaderSize The size, in bytes, of the media header to be filled in by
|
||||
the Transmit() function. If HeaderSize is non-zero, then it
|
||||
must be equal to This->Mode->MediaHeaderSize and the DestAddr
|
||||
and Protocol parameters must not be NULL.
|
||||
@param BufferSize The size, in bytes, of the entire packet (media header and
|
||||
data) to be transmitted through the network interface.
|
||||
@param Buffer A pointer to the packet (media header followed by data) to be
|
||||
transmitted. This parameter cannot be NULL. If HeaderSize is zero,
|
||||
then the media header in Buffer must already be filled in by the
|
||||
caller. If HeaderSize is non-zero, then the media header will be
|
||||
filled in by the Transmit() function.
|
||||
@param SrcAddr The source HW MAC address. If HeaderSize is zero, then this parameter
|
||||
is ignored. If HeaderSize is non-zero and SrcAddr is NULL, then
|
||||
This->Mode->CurrentAddress is used for the source HW MAC address.
|
||||
@param DestAddr The destination HW MAC address. If HeaderSize is zero, then this
|
||||
parameter is ignored.
|
||||
@param Protocol The type of header to build. If HeaderSize is zero, then this
|
||||
parameter is ignored. See RFC 1700, section "Ether Types", for
|
||||
examples.
|
||||
|
||||
@retval EFI_SUCCESS The packet was placed on the transmit queue.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_NOT_READY The network interface is too busy to accept this transmit request.
|
||||
@retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpTransmit (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
IN UINTN HeaderSize,
|
||||
IN UINTN BufferSize,
|
||||
IN VOID *Buffer,
|
||||
IN EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
IN EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
IN UINT16 *Protocol OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
/**
|
||||
Receives a packet from a network interface.
|
||||
|
||||
@param This The protocol instance pointer.
|
||||
@param HeaderSize The size, in bytes, of the media header received on the network
|
||||
interface. If this parameter is NULL, then the media header size
|
||||
will not be returned.
|
||||
@param BufferSize On entry, the size, in bytes, of Buffer. On exit, the size, in
|
||||
bytes, of the packet that was received on the network interface.
|
||||
@param Buffer A pointer to the data buffer to receive both the media header and
|
||||
the data.
|
||||
@param SrcAddr The source HW MAC address. If this parameter is NULL, the
|
||||
HW MAC source address will not be extracted from the media
|
||||
header.
|
||||
@param DestAddr The destination HW MAC address. If this parameter is NULL,
|
||||
the HW MAC destination address will not be extracted from the
|
||||
media header.
|
||||
@param Protocol The media header type. If this parameter is NULL, then the
|
||||
protocol will not be extracted from the media header. See
|
||||
RFC 1700 section "Ether Types" for examples.
|
||||
|
||||
@retval EFI_SUCCESS The received data was stored in Buffer, and BufferSize has
|
||||
been updated to the number of bytes received.
|
||||
@retval EFI_NOT_STARTED The network interface has not been started.
|
||||
@retval EFI_NOT_READY The network interface is too busy to accept this transmit
|
||||
request.
|
||||
@retval EFI_BUFFER_TOO_SMALL The BufferSize parameter is too small.
|
||||
@retval EFI_INVALID_PARAMETER One or more of the parameters has an unsupported value.
|
||||
@retval EFI_DEVICE_ERROR The command could not be sent to the network interface.
|
||||
@retval EFI_UNSUPPORTED This function is not supported by the network interface.
|
||||
|
||||
**/
|
||||
EFI_STATUS
|
||||
EmuSnpReceive (
|
||||
IN EMU_SNP_PROTOCOL *This,
|
||||
OUT UINTN *HeaderSize OPTIONAL,
|
||||
IN OUT UINTN *BufferSize,
|
||||
OUT VOID *Buffer,
|
||||
OUT EFI_MAC_ADDRESS *SrcAddr OPTIONAL,
|
||||
OUT EFI_MAC_ADDRESS *DestAddr OPTIONAL,
|
||||
OUT UINT16 *Protocol OPTIONAL
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
|
||||
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
|
||||
EMU_SNP_PROTOCOL gEmuSnpProtocol = {
|
||||
GasketSnpCreateMapping,
|
||||
GasketSnpStart,
|
||||
GasketSnpStop,
|
||||
GasketSnpInitialize,
|
||||
GasketSnpReset,
|
||||
GasketSnpShutdown,
|
||||
GasketSnpReceiveFilters,
|
||||
GasketSnpStationAddress,
|
||||
GasketSnpStatistics,
|
||||
GasketSnpMCastIpToMac,
|
||||
GasketSnpNvData,
|
||||
GasketSnpGetStatus,
|
||||
GasketSnpTransmit,
|
||||
GasketSnpReceive
|
||||
};
|
||||
|
||||
EFI_STATUS
|
||||
EmuSnpThunkOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
if (This->Private != NULL) {
|
||||
return EFI_ALREADY_STARTED;
|
||||
}
|
||||
|
||||
if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Private = malloc (sizeof (EMU_SNP_PRIVATE));
|
||||
if (Private == NULL) {
|
||||
return EFI_OUT_OF_RESOURCES;
|
||||
}
|
||||
|
||||
|
||||
Private->Signature = EMU_SNP_PRIVATE_SIGNATURE;
|
||||
Private->Thunk = This;
|
||||
CopyMem (&Private->EmuSnp, &gEmuSnpProtocol, sizeof (gEmuSnpProtocol));
|
||||
|
||||
This->Interface = &Private->EmuSnp;
|
||||
This->Private = Private;
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EmuSnpThunkClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
EMU_SNP_PRIVATE *Private;
|
||||
|
||||
if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
|
||||
return EFI_UNSUPPORTED;
|
||||
}
|
||||
|
||||
Private = This->Private;
|
||||
free (Private);
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gSnpThunkIo = {
|
||||
&gEmuSnpProtocolGuid,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
GasketSnpThunkOpen,
|
||||
GasketSnpThunkClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
#endif
|
145
EmulatorPkg/Unix/Host/MemoryAllocationLib.c
Normal file
145
EmulatorPkg/Unix/Host/MemoryAllocationLib.c
Normal file
@@ -0,0 +1,145 @@
|
||||
/*++ @file
|
||||
|
||||
Copyright (c) 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
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#include "Base.h"
|
||||
#include "Library/BaseMemoryLib.h"
|
||||
#include "Library/MemoryAllocationLib.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/**
|
||||
Allocates a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData and returns a
|
||||
pointer to the allocated buffer. If AllocationSize is 0, then a valid buffer of 0 size is
|
||||
returned. If there is not enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocatePool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
return (VOID*) malloc (AllocationSize);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Allocates and zeros a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates the number bytes specified by AllocationSize of type EfiBootServicesData, clears the
|
||||
buffer with zeros, and returns a pointer to the allocated buffer. If AllocationSize is 0, then a
|
||||
valid buffer of 0 size is returned. If there is not enough memory remaining to satisfy the
|
||||
request, then NULL is returned.
|
||||
|
||||
@param AllocationSize The number of bytes to allocate and zero.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
AllocateZeroPool (
|
||||
IN UINTN AllocationSize
|
||||
)
|
||||
{
|
||||
VOID *Buffer;
|
||||
|
||||
Buffer = AllocatePool (AllocationSize);
|
||||
if (Buffer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ZeroMem (Buffer, AllocationSize);
|
||||
|
||||
return Buffer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Reallocates a buffer of type EfiBootServicesData.
|
||||
|
||||
Allocates and zeros the number bytes specified by NewSize from memory of type
|
||||
EfiBootServicesData. If OldBuffer is not NULL, then the smaller of OldSize and
|
||||
NewSize bytes are copied from OldBuffer to the newly allocated buffer, and
|
||||
OldBuffer is freed. A pointer to the newly allocated buffer is returned.
|
||||
If NewSize is 0, then a valid buffer of 0 size is returned. If there is not
|
||||
enough memory remaining to satisfy the request, then NULL is returned.
|
||||
|
||||
If the allocation of the new buffer is successful and the smaller of NewSize and OldSize
|
||||
is greater than (MAX_ADDRESS - OldBuffer + 1), then ASSERT().
|
||||
|
||||
@param OldSize The size, in bytes, of OldBuffer.
|
||||
@param NewSize The size, in bytes, of the buffer to reallocate.
|
||||
@param OldBuffer The buffer to copy to the allocated buffer. This is an optional
|
||||
parameter that may be NULL.
|
||||
|
||||
@return A pointer to the allocated buffer or NULL if allocation fails.
|
||||
|
||||
**/
|
||||
VOID *
|
||||
EFIAPI
|
||||
ReallocatePool (
|
||||
IN UINTN OldSize,
|
||||
IN UINTN NewSize,
|
||||
IN VOID *OldBuffer OPTIONAL
|
||||
)
|
||||
{
|
||||
VOID *NewBuffer;
|
||||
|
||||
NewBuffer = AllocatePool (NewSize);
|
||||
if (NewBuffer == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (OldBuffer != NULL) {
|
||||
if (OldSize > 0) {
|
||||
CopyMem (NewBuffer, OldBuffer, OldSize);
|
||||
}
|
||||
|
||||
FreePool (OldBuffer);
|
||||
}
|
||||
|
||||
return NewBuffer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Frees a buffer that was previously allocated with one of the pool allocation functions in the
|
||||
Memory Allocation Library.
|
||||
|
||||
Frees the buffer specified by Buffer. Buffer must have been allocated on a previous call to the
|
||||
pool allocation services of the Memory Allocation Library. If it is not possible to free pool
|
||||
resources, then this function will perform no actions.
|
||||
|
||||
If Buffer was not allocated with a pool allocation function in the Memory Allocation Library,
|
||||
then ASSERT().
|
||||
|
||||
@param Buffer Pointer to the buffer to free.
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
FreePool (
|
||||
IN VOID *Buffer
|
||||
)
|
||||
{
|
||||
free ((void *) Buffer);
|
||||
}
|
||||
|
1556
EmulatorPkg/Unix/Host/PosixFileSystem.c
Normal file
1556
EmulatorPkg/Unix/Host/PosixFileSystem.c
Normal file
File diff suppressed because it is too large
Load Diff
235
EmulatorPkg/Unix/Host/Pthreads.c
Normal file
235
EmulatorPkg/Unix/Host/Pthreads.c
Normal file
@@ -0,0 +1,235 @@
|
||||
/*++ @file
|
||||
POSIX Pthreads to emulate APs and implement threads
|
||||
|
||||
Copyright (c) 2011, Apple Inc. All rights reserved.
|
||||
Copyright (c) 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
|
||||
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.
|
||||
|
||||
|
||||
**/
|
||||
|
||||
#include "SecMain.h"
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PthreadMutexLock (
|
||||
IN VOID *Mutex
|
||||
)
|
||||
{
|
||||
return (UINTN)pthread_mutex_lock ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PthreadMutexUnLock (
|
||||
IN VOID *Mutex
|
||||
)
|
||||
{
|
||||
return (UINTN)pthread_mutex_unlock ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
|
||||
UINTN
|
||||
EFIAPI
|
||||
PthreadMutexTryLock (
|
||||
IN VOID *Mutex
|
||||
)
|
||||
{
|
||||
return (UINTN)pthread_mutex_trylock ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
|
||||
VOID *
|
||||
PthreadMutexInit (
|
||||
IN VOID
|
||||
)
|
||||
{
|
||||
pthread_mutex_t *Mutex;
|
||||
int err;
|
||||
|
||||
Mutex = malloc (sizeof (pthread_mutex_t));
|
||||
err = pthread_mutex_init (Mutex, NULL);
|
||||
if (err == 0) {
|
||||
return Mutex;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
UINTN
|
||||
PthreadMutexDestroy (
|
||||
IN VOID *Mutex
|
||||
)
|
||||
{
|
||||
if (Mutex != NULL) {
|
||||
return pthread_mutex_destroy ((pthread_mutex_t *)Mutex);
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Can't store this data on PthreadCreate stack so we need a global
|
||||
typedef struct {
|
||||
pthread_mutex_t Mutex;
|
||||
THREAD_THUNK_THREAD_ENTRY Start;
|
||||
} THREAD_MANGLE;
|
||||
|
||||
THREAD_MANGLE mThreadMangle = {
|
||||
PTHREAD_MUTEX_INITIALIZER,
|
||||
NULL
|
||||
};
|
||||
|
||||
VOID *
|
||||
SecFakePthreadStart (
|
||||
VOID *Context
|
||||
)
|
||||
{
|
||||
THREAD_THUNK_THREAD_ENTRY Start;
|
||||
sigset_t SigMask;
|
||||
|
||||
// Save global on the stack before we unlock
|
||||
Start = mThreadMangle.Start;
|
||||
pthread_mutex_unlock (&mThreadMangle.Mutex);
|
||||
|
||||
// Mask all signals to the APs
|
||||
sigfillset (&SigMask);
|
||||
pthread_sigmask (SIG_BLOCK, &SigMask, NULL);
|
||||
|
||||
//
|
||||
// We have to start the thread in SEC as we need to follow
|
||||
// OS X calling conventions. We can then call back into
|
||||
// to the callers Start.
|
||||
//
|
||||
// This is a great example of how all problems in computer
|
||||
// science can be solved by adding another level of indirection
|
||||
//
|
||||
return (VOID *)ReverseGasketUint64 ((CALL_BACK)Start, (UINTN)Context);
|
||||
}
|
||||
|
||||
UINTN
|
||||
PthreadCreate (
|
||||
IN VOID *Thread,
|
||||
IN VOID *Attribute,
|
||||
IN THREAD_THUNK_THREAD_ENTRY Start,
|
||||
IN VOID *Context
|
||||
)
|
||||
{
|
||||
int err;
|
||||
BOOLEAN EnabledOnEntry;
|
||||
|
||||
//
|
||||
// Threads inherit interrupt state so disable interrupts before we start thread
|
||||
//
|
||||
if (SecInterruptEanbled ()) {
|
||||
SecDisableInterrupt ();
|
||||
EnabledOnEntry = TRUE;
|
||||
} else {
|
||||
EnabledOnEntry = FALSE;
|
||||
}
|
||||
|
||||
// Aquire lock for global, SecFakePthreadStart runs in a different thread.
|
||||
pthread_mutex_lock (&mThreadMangle.Mutex);
|
||||
mThreadMangle.Start = Start;
|
||||
|
||||
err = pthread_create (Thread, Attribute, SecFakePthreadStart, Context);
|
||||
if (err != 0) {
|
||||
// Thread failed to launch so release the lock;
|
||||
pthread_mutex_unlock (&mThreadMangle.Mutex);
|
||||
}
|
||||
|
||||
if (EnabledOnEntry) {
|
||||
// Restore interrupt state
|
||||
SecEnableInterrupt ();
|
||||
}
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
VOID
|
||||
PthreadExit (
|
||||
IN VOID *ValuePtr
|
||||
)
|
||||
{
|
||||
pthread_exit (ValuePtr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
UINTN
|
||||
PthreadSelf (
|
||||
VOID
|
||||
)
|
||||
{
|
||||
// POSIX currently allows pthread_t to be a structure or arithmetic type.
|
||||
// Check out sys/types.h to make sure this will work if you are porting.
|
||||
// On OS X (Darwin) pthread_t is a pointer to a structure so this code works.
|
||||
return (UINTN)pthread_self ();
|
||||
}
|
||||
|
||||
|
||||
EMU_THREAD_THUNK_PROTOCOL gPthreadThunk = {
|
||||
GasketPthreadMutexLock,
|
||||
GasketPthreadMutexUnLock,
|
||||
GasketPthreadMutexTryLock,
|
||||
GasketPthreadMutexInit,
|
||||
GasketPthreadMutexDestroy,
|
||||
GasketPthreadCreate,
|
||||
GasketPthreadExit,
|
||||
GasketPthreadSelf
|
||||
};
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PthreadOpen (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
if (This->Instance != 0) {
|
||||
// Only single instance is supported
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
if (This->ConfigString[0] == L'0') {
|
||||
// If AP count is zero no need for threads
|
||||
return EFI_NOT_FOUND;
|
||||
}
|
||||
|
||||
This->Interface = &gPthreadThunk;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
PthreadClose (
|
||||
IN EMU_IO_THUNK_PROTOCOL *This
|
||||
)
|
||||
{
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
EMU_IO_THUNK_PROTOCOL gPthreadThunkIo = {
|
||||
&gEmuThreadThunkProtocolGuid,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
GasketPthreadOpen,
|
||||
GasketPthreadClose,
|
||||
NULL
|
||||
};
|
||||
|
||||
|
1226
EmulatorPkg/Unix/Host/SecMain.c
Normal file
1226
EmulatorPkg/Unix/Host/SecMain.c
Normal file
File diff suppressed because it is too large
Load Diff
356
EmulatorPkg/Unix/Host/SecMain.h
Normal file
356
EmulatorPkg/Unix/Host/SecMain.h
Normal file
@@ -0,0 +1,356 @@
|
||||
/*++ @file
|
||||
|
||||
Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
Portions copyright (c) 2008 - 2011, Apple Inc. 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
|
||||
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.
|
||||
|
||||
**/
|
||||
|
||||
#ifndef _SEC_MAIN_H__
|
||||
#define _SEC_MAIN_H__
|
||||
|
||||
//
|
||||
// Name mangle to prevent build errors. I.e conflicts between EFI and OS
|
||||
//
|
||||
#define NTOHL _UNIX_EFI_NAME_MANGLE_NTOHL_
|
||||
#define HTONL _UNIX_EFI_NAME_MANGLE_HTONL_
|
||||
#define NTOHS _UNIX_EFI_NAME_MANGLE_NTOHS_
|
||||
#define HTONS _UNIX_EFI_NAME_MANGLE_HTOHS_
|
||||
#define B0 _UNIX_EFI_NAME_MANGLE_B0_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/termios.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#if __CYGWIN__
|
||||
#include <sys/dirent.h>
|
||||
#else
|
||||
#include <sys/dir.h>
|
||||
#endif
|
||||
|
||||
#include <sys/mman.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include <unistd.h>
|
||||
#include <poll.h>
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/statvfs.h>
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
#include <ifaddrs.h>
|
||||
|
||||
#ifdef __APPLE__
|
||||
#include <net/if_dl.h>
|
||||
#include <net/bpf.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/mount.h>
|
||||
#include <sys/disk.h>
|
||||
#define _XOPEN_SOURCE
|
||||
#ifndef _Bool
|
||||
#define _Bool char // for clang debug
|
||||
#endif
|
||||
#else
|
||||
#include <termio.h>
|
||||
#include <sys/vfs.h>
|
||||
#include <linux/fs.h>
|
||||
#endif
|
||||
|
||||
#include <utime.h>
|
||||
|
||||
#undef NTOHL
|
||||
#undef HTONL
|
||||
#undef NTOHS
|
||||
#undef HTONS
|
||||
#undef B0
|
||||
|
||||
|
||||
#include <PiPei.h>
|
||||
#include <Uefi.h>
|
||||
|
||||
#include <Library/PeCoffLib.h>
|
||||
#include <Library/BaseLib.h>
|
||||
#include <Library/BaseMemoryLib.h>
|
||||
#include <Library/MemoryAllocationLib.h>
|
||||
#include <Library/PrintLib.h>
|
||||
#include <Library/PcdLib.h>
|
||||
#include <Library/DebugLib.h>
|
||||
#include <Library/ReportStatusCodeLib.h>
|
||||
|
||||
#include <Library/ThunkPpiList.h>
|
||||
#include <Library/ThunkProtocolList.h>
|
||||
#include <Library/PeiServicesLib.h>
|
||||
#include <Library/PeCoffGetEntryPointLib.h>
|
||||
#include <Library/EmuMagicPageLib.h>
|
||||
|
||||
#include <Ppi/EmuThunk.h>
|
||||
#include <Ppi/StatusCode.h>
|
||||
|
||||
#include <Protocol/SimplePointer.h>
|
||||
#include <Protocol/SimpleTextIn.h>
|
||||
#include <Protocol/SimpleTextInEx.h>
|
||||
#include <Protocol/UgaDraw.h>
|
||||
#include <Protocol/SimpleFileSystem.h>
|
||||
|
||||
#include <Protocol/EmuThunk.h>
|
||||
#include <Protocol/EmuIoThunk.h>
|
||||
#include <Protocol/EmuGraphicsWindow.h>
|
||||
#include <Protocol/EmuThread.h>
|
||||
#include <Protocol/EmuBlockIo.h>
|
||||
#include <Protocol/EmuSnp.h>
|
||||
|
||||
#include <Guid/FileInfo.h>
|
||||
#include <Guid/FileSystemInfo.h>
|
||||
#include <Guid/FileSystemVolumeLabelInfo.h>
|
||||
|
||||
|
||||
#include "Gasket.h"
|
||||
|
||||
|
||||
#define STACK_SIZE 0x20000
|
||||
|
||||
typedef struct {
|
||||
EFI_PHYSICAL_ADDRESS Address;
|
||||
UINT64 Size;
|
||||
} EMU_FD_INFO;
|
||||
|
||||
typedef struct {
|
||||
EFI_PHYSICAL_ADDRESS Memory;
|
||||
UINT64 Size;
|
||||
} EMU_SYSTEM_MEMORY;
|
||||
|
||||
|
||||
#define MAX_IMAGE_CONTEXT_TO_MOD_HANDLE_ARRAY_SIZE 0x100
|
||||
|
||||
typedef struct {
|
||||
PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext;
|
||||
VOID *ModHandle;
|
||||
} IMAGE_CONTEXT_TO_MOD_HANDLE;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecUnixPeiLoadFile (
|
||||
VOID *Pe32Data,
|
||||
EFI_PHYSICAL_ADDRESS *ImageAddress,
|
||||
UINT64 *ImageSize,
|
||||
EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||
);
|
||||
|
||||
int
|
||||
main (
|
||||
IN int Argc,
|
||||
IN char **Argv,
|
||||
IN char **Envp
|
||||
);
|
||||
|
||||
VOID
|
||||
SecLoadFromCore (
|
||||
IN UINTN LargestRegion,
|
||||
IN UINTN LargestRegionSize,
|
||||
IN UINTN BootFirmwareVolumeBase,
|
||||
IN VOID *PeiCoreFile
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SecLoadFile (
|
||||
IN VOID *Pe32Data,
|
||||
IN EFI_PHYSICAL_ADDRESS *ImageAddress,
|
||||
IN UINT64 *ImageSize,
|
||||
IN EFI_PHYSICAL_ADDRESS *EntryPoint
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindPeiCore (
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
OUT VOID **Pe32Data
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindNextFile (
|
||||
IN EFI_FV_FILETYPE SearchType,
|
||||
IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
|
||||
IN OUT EFI_FFS_FILE_HEADER **FileHeader
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SecFfsFindSectionData (
|
||||
IN EFI_SECTION_TYPE SectionType,
|
||||
IN EFI_FFS_FILE_HEADER *FfsFileHeader,
|
||||
IN OUT VOID **SectionData
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecUnixPeCoffLoaderLoadAsDll (
|
||||
IN CHAR8 *PdbFileName,
|
||||
IN VOID **ImageEntryPoint,
|
||||
OUT VOID **ModHandle
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecUnixPeCoffLoaderFreeLibrary (
|
||||
OUT VOID *ModHandle
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
SecUnixFdAddress (
|
||||
IN UINTN Index,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
|
||||
IN OUT UINT64 *FdSize,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FixUp
|
||||
)
|
||||
;
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecUnixFdAddress (
|
||||
IN UINTN Index,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
|
||||
IN OUT UINT64 *FdSize,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *FixUp
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
EFI_STATUS
|
||||
GetImageReadFunction (
|
||||
IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
|
||||
IN EFI_PHYSICAL_ADDRESS *TopOfMemory
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecImageRead (
|
||||
IN VOID *FileHandle,
|
||||
IN UINTN FileOffset,
|
||||
IN OUT UINTN *ReadSize,
|
||||
OUT VOID *Buffer
|
||||
);
|
||||
|
||||
CHAR16 *
|
||||
AsciiToUnicode (
|
||||
IN CHAR8 *Ascii,
|
||||
IN UINTN *StrLen OPTIONAL
|
||||
);
|
||||
|
||||
UINTN
|
||||
CountSeperatorsInString (
|
||||
IN const CHAR16 *String,
|
||||
IN CHAR16 Seperator
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
SecTemporaryRamSupport (
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
|
||||
IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
|
||||
IN UINTN CopySize
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
EFIAPI
|
||||
GasketSecTemporaryRamSupport (
|
||||
IN CONST EFI_PEI_SERVICES **PeiServices,
|
||||
IN EFI_PHYSICAL_ADDRESS TemporaryMemoryBase,
|
||||
IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
|
||||
IN UINTN CopySize
|
||||
);
|
||||
|
||||
|
||||
RETURN_STATUS
|
||||
EFIAPI
|
||||
SecPeCoffGetEntryPoint (
|
||||
IN VOID *Pe32Data,
|
||||
IN OUT VOID **EntryPoint
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SecPeCoffRelocateImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
VOID
|
||||
EFIAPI
|
||||
SecPeCoffLoaderUnloadImageExtraAction (
|
||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||
);
|
||||
|
||||
|
||||
VOID
|
||||
PeiSwitchStacks (
|
||||
IN SWITCH_STACK_ENTRY_POINT EntryPoint,
|
||||
IN VOID *Context1, OPTIONAL
|
||||
IN VOID *Context2, OPTIONAL
|
||||
IN VOID *NewStack
|
||||
);
|
||||
|
||||
VOID
|
||||
SecInitThunkProtocol (
|
||||
VOID
|
||||
);
|
||||
|
||||
|
||||
EFI_PHYSICAL_ADDRESS *
|
||||
MapMemory (
|
||||
INTN fd,
|
||||
UINT64 length,
|
||||
INTN prot,
|
||||
INTN flags);
|
||||
|
||||
EFI_STATUS
|
||||
MapFile (
|
||||
IN CHAR8 *FileName,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||
OUT UINT64 *Length
|
||||
);
|
||||
|
||||
EFI_STATUS
|
||||
MapFd0 (
|
||||
IN CHAR8 *FileName,
|
||||
IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,
|
||||
OUT UINT64 *Length
|
||||
);
|
||||
|
||||
BOOLEAN
|
||||
EfiSystemMemoryRange (
|
||||
IN VOID *MemoryAddress
|
||||
);
|
||||
|
||||
|
||||
VOID SecSleep (UINT64 Nanoseconds);
|
||||
VOID SecEnableInterrupt (VOID);
|
||||
VOID SecDisableInterrupt (VOID);
|
||||
BOOLEAN SecInterruptEanbled (VOID);
|
||||
|
||||
|
||||
extern EMU_THUNK_PROTOCOL gEmuThunkProtocol;
|
||||
extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;
|
||||
extern EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo;
|
||||
extern EMU_IO_THUNK_PROTOCOL gPthreadThunkIo;
|
||||
extern EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo;
|
||||
extern EMU_IO_THUNK_PROTOCOL gSnpThunkIo;
|
||||
|
||||
#endif
|
140
EmulatorPkg/Unix/Host/SecMain.inf
Normal file
140
EmulatorPkg/Unix/Host/SecMain.inf
Normal file
@@ -0,0 +1,140 @@
|
||||
## @file
|
||||
# Entry Point of Emu Emulator
|
||||
#
|
||||
# Main executable file of Unix Emulator that loads PEI core after initialization finished.
|
||||
# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Portions copyright (c) 2008 - 2011, Apple Inc. 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
|
||||
# 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.
|
||||
#
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010005
|
||||
BASE_NAME = SecMain
|
||||
FILE_GUID = 8863C0AD-7724-C84B-88E5-A33B116D1485
|
||||
MODULE_TYPE = USER_DEFINED
|
||||
VERSION_STRING = 1.0
|
||||
|
||||
#
|
||||
# The following information is for reference only and not required by the build tools.
|
||||
#
|
||||
# VALID_ARCHITECTURES = IA32 X64 IPF EBC
|
||||
#
|
||||
|
||||
[Sources]
|
||||
SecMain.c
|
||||
EmuThunk.c
|
||||
X11GraphicsWindow.c
|
||||
Pthreads.c
|
||||
PosixFileSystem.c
|
||||
BlockIo.c
|
||||
LinuxPacketFilter.c
|
||||
BerkeleyPacketFilter.c
|
||||
MemoryAllocationLib.c
|
||||
|
||||
[Sources.X64]
|
||||
X64/Gasket.S # convert between Emu x86_64 ABI and EFI X64 ABI
|
||||
X64/SwitchStack.S
|
||||
|
||||
[Sources.IA32]
|
||||
Ia32/Gasket.S # enforce 16-byte stack alignment for Mac OS X
|
||||
Ia32/SwitchStack.c
|
||||
|
||||
|
||||
[Packages]
|
||||
MdePkg/MdePkg.dec
|
||||
MdeModulePkg/MdeModulePkg.dec
|
||||
EmulatorPkg/EmulatorPkg.dec
|
||||
|
||||
[LibraryClasses]
|
||||
DebugLib
|
||||
PcdLib
|
||||
PrintLib
|
||||
BaseMemoryLib
|
||||
BaseLib
|
||||
PeCoffLib
|
||||
ThunkPpiList
|
||||
ThunkProtocolList
|
||||
PpiListLib
|
||||
PeiServicesLib
|
||||
PeCoffGetEntryPointLib
|
||||
|
||||
[Ppis]
|
||||
gEfiPeiStatusCodePpiGuid # PPI ALWAYS_PRODUCED
|
||||
gEmuThunkPpiGuid
|
||||
|
||||
[Protocols]
|
||||
gEmuIoThunkProtocolGuid
|
||||
gEmuIoThunkProtocolGuid
|
||||
gEmuGraphicsWindowProtocolGuid
|
||||
gEmuThreadThunkProtocolGuid
|
||||
gEmuBlockIoProtocolGuid
|
||||
gEmuSnpProtocolGuid
|
||||
gEfiSimpleFileSystemProtocolGuid
|
||||
|
||||
[Guids]
|
||||
gEfiFileSystemVolumeLabelInfoIdGuid # SOMETIMES_CONSUMED
|
||||
gEfiFileInfoGuid # SOMETIMES_CONSUMED
|
||||
gEfiFileSystemInfoGuid # SOMETIMES_CONSUMED
|
||||
|
||||
[Pcd]
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFdBaseAddress
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuApCount
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuVirtualDisk
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface
|
||||
gEmulatorPkgTokenSpaceGuid.PcdNetworkPacketFilterSize
|
||||
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoveryBase
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoverySize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogBase
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwWorkingBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
gEmulatorPkgTokenSpaceGuid.PcdPeiServicesTablePage
|
||||
|
||||
|
||||
[BuildOptions]
|
||||
GCC:*_*_IA32_DLINK_FLAGS == -o $(BIN_DIR)/SecMain -m elf_i386 -dynamic-linker /lib$(LIB_ARCH_SFX)/ld-linux.so.2 /usr/lib$(LIB_ARCH_SFX)/crt1.o /usr/lib$(LIB_ARCH_SFX)/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib$(LIB_ARCH_SFX)/crtn.o
|
||||
GCC:*_*_*_DLINK2_FLAGS == -lpthread -lc
|
||||
GCC:*_*_IA32_CC_FLAGS == -m32 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
|
||||
GCC:*_*_IA32_PP_FLAGS == -m32 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
|
||||
GCC:*_*_IA32_ASM_FLAGS == -m32 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
|
||||
|
||||
GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/SecMain -m elf_x86_64 -dynamic-linker /lib$(LIB_ARCH_SFX)/ld-linux-x86-64.so.2 /usr/lib$(LIB_ARCH_SFX)/crt1.o /usr/lib$(LIB_ARCH_SFX)/crti.o -L/usr/X11R6/lib -lXext -lX11 /usr/lib$(LIB_ARCH_SFX)/crtn.o
|
||||
GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall -malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
|
||||
GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
|
||||
GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
|
||||
GCC:*_*_X64_PP_FLAGS == -m64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
|
||||
GCC:*_*_X64_ASM_FLAGS == -m64 -c -x assembler -imacros $(DEST_DIR_DEBUG)/AutoGen.h
|
||||
|
||||
#
|
||||
# Need to do this link via gcc and not ld as the pathing to libraries changes from OS version to OS version
|
||||
#
|
||||
XCODE:*_*_IA32_DLINK_PATH == gcc
|
||||
XCODE:*_*_IA32_CC_FLAGS == -arch i386 -O0 -g -include $(DEST_DIR_DEBUG)/AutoGen.h -c -fshort-wchar -fno-strict-aliasing
|
||||
XCODE:*_*_IA32_DLINK_FLAGS == -arch i386 -o $(BIN_DIR)/SecMain -L/usr/X11R6/lib -lXext -lX11 -framework Carbon
|
||||
XCODE:*_*_IA32_ASM_FLAGS == -arch i386 -g
|
||||
|
||||
XCODE:*_*_X64_DLINK_PATH == gcc
|
||||
XCODE:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/SecMain -L/usr/X11R6/lib -lXext -lX11 -framework Carbon
|
||||
XCODE:*_*_X64_ASM_FLAGS == -g
|
||||
|
1028
EmulatorPkg/Unix/Host/X11GraphicsWindow.c
Normal file
1028
EmulatorPkg/Unix/Host/X11GraphicsWindow.c
Normal file
File diff suppressed because it is too large
Load Diff
1631
EmulatorPkg/Unix/Host/X64/Gasket.S
Normal file
1631
EmulatorPkg/Unix/Host/X64/Gasket.S
Normal file
File diff suppressed because it is too large
Load Diff
53
EmulatorPkg/Unix/Host/X64/SwitchStack.S
Normal file
53
EmulatorPkg/Unix/Host/X64/SwitchStack.S
Normal file
@@ -0,0 +1,53 @@
|
||||
#------------------------------------------------------------------------------
|
||||
#
|
||||
# Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
# Portitions copyright (c) 2011, Apple Inc. 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.
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# Routine Description:
|
||||
#
|
||||
# Routine for switching stacks with 2 parameters EFI ABI
|
||||
# Convert UNIX to EFI ABI
|
||||
#
|
||||
# Arguments:
|
||||
#
|
||||
# (rdi) EntryPoint - Entry point with new stack.
|
||||
# (rsi) Context1 - Parameter1 for entry point. (rcx)
|
||||
# (rdx) Context2 - Parameter2 for entry point. (rdx)
|
||||
# (rcx) NewStack - The pointer to new stack.
|
||||
#
|
||||
# Returns:
|
||||
#
|
||||
# None
|
||||
#
|
||||
#------------------------------------------------------------------------------
|
||||
ASM_GLOBAL ASM_PFX(PeiSwitchStacks)
|
||||
ASM_PFX(PeiSwitchStacks):
|
||||
pushq $0 // tells gdb to stop unwinding frame
|
||||
movq %rsp, %rbp
|
||||
|
||||
movq %rcx, %rsp // update stack pointer
|
||||
|
||||
movq %rdi, %rax // entry point to %rax
|
||||
movq %rsi, %rcx // Adjust Context1
|
||||
// Context2 already in the rigth spot
|
||||
|
||||
#
|
||||
# Reserve space for register parameters (rcx, rdx, r8 & r9) on the stack,
|
||||
# in case the callee wishes to spill them.
|
||||
#
|
||||
subq $32, %rsp // 32-byte shadow space plus alignment pad
|
||||
call *%rax
|
||||
|
||||
|
||||
|
455
EmulatorPkg/Unix/UnixX64.dsc
Normal file
455
EmulatorPkg/Unix/UnixX64.dsc
Normal file
@@ -0,0 +1,455 @@
|
||||
## @file
|
||||
#
|
||||
# UEFI/PI Emulation Platform with UEFI HII interface supported.
|
||||
#
|
||||
# The Emulation Platform can be used to debug individual modules, prior to creating
|
||||
# a real platform. This also provides an example for how an DSC is created.
|
||||
# Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Portions copyright (c) 2010 - 2011, Apple Inc. 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
|
||||
# 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.
|
||||
#
|
||||
##
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Defines Section - statements that will be processed to create a Makefile.
|
||||
#
|
||||
################################################################################
|
||||
[Defines]
|
||||
PLATFORM_NAME = EmuUnix
|
||||
PLATFORM_GUID = 05FD064D-1073-E844-936C-A0E16317107D
|
||||
PLATFORM_VERSION = 0.3
|
||||
DSC_ SPECIFICATION = 0x00010005
|
||||
!if $(BUILD_32)
|
||||
OUTPUT_DIRECTORY = Build/EmuUnixIa32
|
||||
!else
|
||||
OUTPUT_DIRECTORY = Build/EmuUnixX64
|
||||
!endif
|
||||
|
||||
SUPPORTED_ARCHITECTURES = X64|IA32
|
||||
BUILD_TARGETS = DEBUG|RELEASE
|
||||
SKUID_IDENTIFIER = DEFAULT
|
||||
FLASH_DEFINITION = EmulatorPkg/Unix/UnixX64.fdf
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# SKU Identification section - list of all SKU IDs supported by this Platform.
|
||||
#
|
||||
################################################################################
|
||||
[SkuIds]
|
||||
0|DEFAULT
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Library Class section - list of all Library Classes needed by this Platform.
|
||||
#
|
||||
################################################################################
|
||||
[LibraryClasses]
|
||||
#
|
||||
# Entry point
|
||||
#
|
||||
PeiCoreEntryPoint|MdePkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.inf
|
||||
PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
|
||||
DxeCoreEntryPoint|MdePkg/Library/DxeCoreEntryPoint/DxeCoreEntryPoint.inf
|
||||
UefiDriverEntryPoint|MdePkg/Library/UefiDriverEntryPoint/UefiDriverEntryPoint.inf
|
||||
UefiApplicationEntryPoint|MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.inf
|
||||
#
|
||||
# Basic
|
||||
#
|
||||
BaseLib|MdePkg/Library/BaseLib/BaseLib.inf
|
||||
SynchronizationLib|MdePkg/Library/BaseSynchronizationLib/BaseSynchronizationLib.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCacheMaintenanceLib.inf
|
||||
PeCoffLib|MdePkg/Library/BasePeCoffLib/BasePeCoffLib.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
BaseMemoryLib|MdePkg/Library/BaseMemoryLib/BaseMemoryLib.inf
|
||||
|
||||
#
|
||||
# UEFI & PI
|
||||
#
|
||||
UefiBootServicesTableLib|MdePkg/Library/UefiBootServicesTableLib/UefiBootServicesTableLib.inf
|
||||
UefiRuntimeServicesTableLib|MdePkg/Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.inf
|
||||
UefiRuntimeLib|MdePkg/Library/UefiRuntimeLib/UefiRuntimeLib.inf
|
||||
UefiLib|MdePkg/Library/UefiLib/UefiLib.inf
|
||||
UefiHiiServicesLib|MdeModulePkg/Library/UefiHiiServicesLib/UefiHiiServicesLib.inf
|
||||
HiiLib|MdeModulePkg/Library/UefiHiiLib/UefiHiiLib.inf
|
||||
DevicePathLib|MdePkg/Library/UefiDevicePathLib/UefiDevicePathLib.inf
|
||||
UefiDecompressLib|IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.inf
|
||||
|
||||
PeiServicesLib|MdePkg/Library/PeiServicesLib/PeiServicesLib.inf
|
||||
DxeServicesLib|MdePkg/Library/DxeServicesLib/DxeServicesLib.inf
|
||||
DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
|
||||
#
|
||||
# Generic Modules
|
||||
#
|
||||
UefiScsiLib|MdePkg/Library/UefiScsiLib/UefiScsiLib.inf
|
||||
NetLib|MdeModulePkg/Library/DxeNetLib/DxeNetLib.inf
|
||||
IpIoLib|MdeModulePkg/Library/DxeIpIoLib/DxeIpIoLib.inf
|
||||
UdpIoLib|MdeModulePkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
|
||||
DpcLib|MdeModulePkg/Library/DxeDpcLib/DxeDpcLib.inf
|
||||
OemHookStatusCodeLib|MdeModulePkg/Library/OemHookStatusCodeLibNull/OemHookStatusCodeLibNull.inf
|
||||
GenericBdsLib|IntelFrameworkModulePkg/Library/GenericBdsLib/GenericBdsLib.inf
|
||||
SecurityManagementLib|MdeModulePkg/Library/DxeSecurityManagementLib/DxeSecurityManagementLib.inf
|
||||
TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf
|
||||
SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.inf
|
||||
CapsuleLib|MdeModulePkg/Library/DxeCapsuleLibNull/DxeCapsuleLibNull.inf
|
||||
#
|
||||
# Platform
|
||||
#
|
||||
PlatformBdsLib|EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf
|
||||
KeyMapLib|EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf
|
||||
|
||||
#
|
||||
# Misc
|
||||
#
|
||||
DebugPrintErrorLevelLib|MdePkg/Library/BaseDebugPrintErrorLevelLib/BaseDebugPrintErrorLevelLib.inf
|
||||
PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
|
||||
DebugAgentLib|MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.inf
|
||||
PeiServicesTablePointerLib|EmulatorPkg/Library/PeiServicesTablePointerLibMagicPage/PeiServicesTablePointerLibMagicPage.inf
|
||||
DebugLib|IntelFrameworkModulePkg/Library/PeiDxeDebugLibReportStatusCode/PeiDxeDebugLibReportStatusCode.inf
|
||||
|
||||
|
||||
[LibraryClasses.common.SEC]
|
||||
PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
PeCoffGetEntryPointLib|EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf
|
||||
PeCoffExtraActionLib|EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf
|
||||
SerialPortLib|EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
|
||||
PpiListLib|EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
|
||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||
TimerLib|EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf
|
||||
|
||||
[LibraryClasses.common.USER_DEFINED, LibraryClasses.common.BASE]
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
PeCoffExtraActionLib|MdePkg/Library/BasePeCoffExtraActionLibNull/BasePeCoffExtraActionLibNull.inf
|
||||
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
PpiListLib|EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
|
||||
ThunkPpiList|EmulatorPkg/Library/ThunkPpiList/ThunkPpiList.inf
|
||||
ThunkProtocolList|EmulatorPkg/Library/ThunkProtocolList/ThunkProtocolList.inf
|
||||
PeCoffGetEntryPointLib|MdePkg/Library/BasePeCoffGetEntryPointLib/BasePeCoffGetEntryPointLib.inf
|
||||
PpiListLib|EmulatorPkg/Library/SecPpiListLib/SecPpiListLib.inf
|
||||
PeiServicesLib|EmulatorPkg/Library/SecPeiServicesLib/SecPeiServicesLib.inf
|
||||
|
||||
|
||||
[LibraryClasses.common.PEIM, LibraryClasses.common.PEI_CORE]
|
||||
HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf
|
||||
MemoryAllocationLib|MdePkg/Library/PeiMemoryAllocationLib/PeiMemoryAllocationLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
|
||||
PeCoffGetEntryPointLib|EmulatorPkg/Library/PeiEmuPeCoffGetEntryPointLib/PeiEmuPeCoffGetEntryPointLib.inf
|
||||
PeCoffExtraActionLib|EmulatorPkg/Library/PeiEmuPeCoffExtraActionLib/PeiEmuPeCoffExtraActionLib.inf
|
||||
ExtractGuidedSectionLib|MdePkg/Library/PeiExtractGuidedSectionLib/PeiExtractGuidedSectionLib.inf
|
||||
SerialPortLib|EmulatorPkg/Library/PeiEmuSerialPortLib/PeiEmuSerialPortLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiReportStatusCodeLib.inf
|
||||
TimerLib|EmulatorPkg/Library/PeiTimerLib/PeiTimerLib.inf
|
||||
|
||||
[LibraryClasses.common.PEI_CORE]
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
|
||||
[LibraryClasses.common.PEIM]
|
||||
PcdLib|MdePkg/Library/PeiPcdLib/PeiPcdLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_CORE]
|
||||
HobLib|MdePkg/Library/DxeCoreHobLib/DxeCoreHobLib.inf
|
||||
MemoryAllocationLib|MdeModulePkg/Library/DxeCoreMemoryAllocationLib/DxeCoreMemoryAllocationLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
||||
PeCoffExtraActionLib|EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf
|
||||
ExtractGuidedSectionLib|MdePkg/Library/DxeExtractGuidedSectionLib/DxeExtractGuidedSectionLib.inf
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
TimerLib|EmulatorPkg/Library/DxeCoreTimerLib/DxeCoreTimerLib.inf
|
||||
EmuThunkLib|EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf
|
||||
|
||||
[LibraryClasses.common.DXE_RUNTIME_DRIVER, LibraryClasses.common.UEFI_DRIVER, LibraryClasses.common.DXE_DRIVER, LibraryClasses.common.UEFI_APPLICATION]
|
||||
HobLib|MdePkg/Library/DxeHobLib/DxeHobLib.inf
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
MemoryAllocationLib|MdePkg/Library/UefiMemoryAllocationLib/UefiMemoryAllocationLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
||||
EmuThunkLib|EmulatorPkg/Library/DxeEmuLib/DxeEmuLib.inf
|
||||
PeCoffExtraActionLib|EmulatorPkg/Library/DxeEmuPeCoffExtraActionLib/DxeEmuPeCoffExtraActionLib.inf
|
||||
ReportStatusCodeLib|MdeModulePkg/Library/DxeReportStatusCodeLib/DxeReportStatusCodeLib.inf
|
||||
TimerLib|EmulatorPkg/Library/DxeTimerLib/DxeTimerLib.inf
|
||||
|
||||
[LibraryClasses.common.UEFI_DRIVER]
|
||||
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
|
||||
|
||||
[LibraryClasses.common.UEFI_APPLICATION]
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Section - list of all EDK II PCD Entries defined by this Platform.
|
||||
#
|
||||
################################################################################
|
||||
[PcdsFeatureFlag]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdStatusCodeUseSerial|TRUE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiCoreImageLoaderSearchTeSectionFirst|FALSE
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdResetOnMemoryTypeInformationChange|FALSE
|
||||
|
||||
[PcdsFixedAtBuild]
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000040
|
||||
gEfiMdePkgTokenSpaceGuid.PcdReportStatusCodePropertyMask|0x0f
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x1f
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizeNonPopulateCapsule|0x0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdMaxSizePopulateCapsule|0x0
|
||||
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize|0x002a0000
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize|0x10000
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume|L"../FV/FV_RECOVERY.fd"
|
||||
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySizeForSecMain|L"64!64"
|
||||
|
||||
!if $(BUILD_NEW_SHELL)
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
|
||||
!else
|
||||
!if $(USE_NEW_SHELL)
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdShellFile|{ 0x83, 0xA5, 0x04, 0x7C, 0x3E, 0x9E, 0x1C, 0x4F, 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1 }
|
||||
!endif
|
||||
!endif
|
||||
|
||||
#define BOOT_WITH_FULL_CONFIGURATION 0x00
|
||||
#define BOOT_WITH_MINIMAL_CONFIGURATION 0x01
|
||||
#define BOOT_ASSUMING_NO_CONFIGURATION_CHANGES 0x02
|
||||
#define BOOT_WITH_FULL_CONFIGURATION_PLUS_DIAGNOSTICS 0x03
|
||||
#define BOOT_WITH_DEFAULT_SETTINGS 0x04
|
||||
#define BOOT_ON_S4_RESUME 0x05
|
||||
#define BOOT_ON_S5_RESUME 0x06
|
||||
#define BOOT_ON_S2_RESUME 0x10
|
||||
#define BOOT_ON_S3_RESUME 0x11
|
||||
#define BOOT_ON_FLASH_UPDATE 0x12
|
||||
#define BOOT_IN_RECOVERY_MODE 0x20
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuBootMode|0
|
||||
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuApCount|L"1"
|
||||
|
||||
# For a CD-ROM/DVD use L"diag.dmg:RO:2048"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuVirtualDisk|L"disk.dmg:FW"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuGop|L"GOP Window"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFileSystem|L".!../../../../EdkShellBinPkg/Bin"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuSerialPort|L"/dev/ttyS0"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuNetworkInterface|L"en0"
|
||||
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuCpuModel|L"Intel(R) Processor Model"
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuCpuSpeed|L"3000"
|
||||
|
||||
# 0-PCANSI, 1-VT100, 2-VT00+, 3-UTF8
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDefaultTerminalType|1
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Pcd Dynamic Section - list of all EDK II PCD Entries defined by this Platform
|
||||
#
|
||||
################################################################################
|
||||
|
||||
[PcdsDynamicDefault.common.DEFAULT]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingBase64|0
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase64|0
|
||||
|
||||
[PcdsDynamicHii.common.DEFAULT]
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutColumn|L"Setup"|gEmuSystemConfigGuid|0x0|80
|
||||
gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow|L"Setup"|gEmuSystemConfigGuid|0x4|25
|
||||
gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
|
||||
|
||||
|
||||
###################################################################################################
|
||||
#
|
||||
# Components Section - list of the modules and components that will be processed by compilation
|
||||
# tools and the EDK II tools to generate PE32/PE32+/Coff image files.
|
||||
#
|
||||
# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
|
||||
# into firmware volume images. This section is just a list of modules to compile from
|
||||
# source into UEFI-compliant binaries.
|
||||
# It is the FDF file that contains information on combining binary files into firmware
|
||||
# volume images, whose concept is beyond UEFI and is described in PI specification.
|
||||
# Binary modules do not need to be listed in this section, as they should be
|
||||
# specified in the FDF file. For example: Shell binary (Shell_Full.efi), FAT binary (Fat.efi),
|
||||
# Logo (Logo.bmp), and etc.
|
||||
# There may also be modules listed in this section that are not required in the FDF file,
|
||||
# When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
|
||||
# generated for it, but the binary will not be put into any firmware volume.
|
||||
#
|
||||
###################################################################################################
|
||||
|
||||
!ifndef $(SKIP_MAIN_BUILD)
|
||||
[Components.X64]
|
||||
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf {
|
||||
<LibraryClasses>
|
||||
# turn off CR3 write so that DXE IPL will not crash emulator
|
||||
BaseLib|UnixPkg/Library/UnixBaseLib/UnixBaseLib.inf
|
||||
}
|
||||
|
||||
[Components.IA32]
|
||||
MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
|
||||
!endif
|
||||
|
||||
[Components]
|
||||
!ifdef $(UNIX_SEC_BUILD)
|
||||
##
|
||||
# Emulator, OS POSIX application
|
||||
##
|
||||
EmulatorPkg/Unix/Host/SecMain.inf
|
||||
!endif
|
||||
|
||||
!ifndef $(SKIP_MAIN_BUILD)
|
||||
#
|
||||
# Generic SEC
|
||||
#
|
||||
EmulatorPkg/Sec/Sec.inf
|
||||
|
||||
##
|
||||
# PEI Phase modules
|
||||
##
|
||||
MdeModulePkg/Core/Pei/PeiMain.inf
|
||||
MdeModulePkg/Universal/PCD/Pei/Pcd.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
|
||||
MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
|
||||
|
||||
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
|
||||
EmulatorPkg/BootModePei/BootModePei.inf
|
||||
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||
EmulatorPkg/AutoScanPei/AutoScanPei.inf
|
||||
EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf
|
||||
EmulatorPkg/FlashMapPei/FlashMapPei.inf
|
||||
EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf
|
||||
|
||||
##
|
||||
# DXE Phase modules
|
||||
##
|
||||
MdeModulePkg/Core/Dxe/DxeMain.inf {
|
||||
<LibraryClasses>
|
||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||
NULL|MdeModulePkg/Library/DxeCrc32GuidedSectionExtractLib/DxeCrc32GuidedSectionExtractLib.inf
|
||||
NULL|IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
|
||||
}
|
||||
MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf {
|
||||
<LibraryClasses>
|
||||
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
|
||||
SerialPortLib|EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||
EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
|
||||
EmulatorPkg/ResetRuntimeDxe/Reset.inf
|
||||
MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||
MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
|
||||
EmulatorPkg/EmuThunkDxe/EmuThunk.inf
|
||||
EmulatorPkg/CpuRuntimeDxe/Cpu.inf
|
||||
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
|
||||
EmulatorPkg/TimerDxe/Timer.inf
|
||||
|
||||
|
||||
MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
||||
MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
||||
MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
||||
EmbeddedPkg/SerialDxe/SerialDxe.inf {
|
||||
<LibraryClasses>
|
||||
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
|
||||
SerialPortLib|EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
|
||||
}
|
||||
|
||||
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
|
||||
#{
|
||||
# <LibraryClasses>
|
||||
# NULL|EmulatorPkg/Library/DevicePathTextLib/DevicePathTextLib.inf
|
||||
#}
|
||||
|
||||
MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||
MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||
MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||
MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
|
||||
MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
||||
MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
||||
IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
|
||||
|
||||
EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
|
||||
EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
|
||||
EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
|
||||
EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
|
||||
EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
|
||||
|
||||
MdeModulePkg/Application/HelloWorld/HelloWorld.inf
|
||||
|
||||
#
|
||||
# Network stack drivers
|
||||
#
|
||||
MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
|
||||
MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
|
||||
MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
|
||||
MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
|
||||
MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
|
||||
MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
|
||||
MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
|
||||
MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
|
||||
MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
|
||||
MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
|
||||
|
||||
MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||
MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
|
||||
MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {
|
||||
<LibraryClasses>
|
||||
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
|
||||
}
|
||||
|
||||
!if $(BUILD_FAT)
|
||||
FatPkg/EnhancedFatDxe/Fat.inf
|
||||
!endif
|
||||
|
||||
!if $(BUILD_NEW_SHELL)
|
||||
ShellPkg/Application/Shell/Shell.inf {
|
||||
<LibraryClasses>
|
||||
ShellCommandLib|ShellPkg/Library/UefiShellCommandLib/UefiShellCommandLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellLevel2CommandsLib/UefiShellLevel2CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellLevel1CommandsLib/UefiShellLevel1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellLevel3CommandsLib/UefiShellLevel3CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellDriver1CommandsLib/UefiShellDriver1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
|
||||
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
|
||||
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
|
||||
FileHandleLib|ShellPkg/Library/UefiFileHandleLib/UefiFileHandleLib.inf
|
||||
ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf
|
||||
SortLib|ShellPkg/Library/UefiSortLib/UefiSortLib.inf
|
||||
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
|
||||
MemoryAllocationLib|EmulatorPkg/Library/GuardUefiMemoryAllocationLib/GuardUefiMemoryAllocationLib.inf
|
||||
SafeBlockIoLib|ShellPkg/Library/SafeBlockIoLib/SafeBlockIoLib.inf
|
||||
SafeOpenProtocolLib|ShellPkg/Library/SafeOpenProtocolLib/SafeOpenProtocolLib.inf
|
||||
|
||||
<PcdsFixedAtBuild>
|
||||
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0xFF
|
||||
gEfiShellPkgTokenSpaceGuid.PcdShellLibAutoInitialize|FALSE
|
||||
gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|8000
|
||||
}
|
||||
!endif
|
||||
|
||||
!endif
|
||||
|
395
EmulatorPkg/Unix/UnixX64.fdf
Normal file
395
EmulatorPkg/Unix/UnixX64.fdf
Normal file
@@ -0,0 +1,395 @@
|
||||
## @file
|
||||
# This is Unix FDF file with UEFI HII features enabled
|
||||
#
|
||||
# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# Portions copyright (c) 2009 - 2011, Apple Inc. 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FD Section
|
||||
# The [FD] Section is made up of the definition statements and a
|
||||
# description of what goes into the Flash Device Image. Each FD section
|
||||
# defines one flash "device" image. A flash device image may be one of
|
||||
# the following: Removable media bootable image (like a boot floppy
|
||||
# image,) an Option ROM image (that would be "flashed" into an add-in
|
||||
# card,) a System "Flash" image (that would be burned into a system's
|
||||
# flash) or an Update ("Capsule") image that will be used to update and
|
||||
# existing system flash.
|
||||
#
|
||||
################################################################################
|
||||
[FD.Fv_Recovery]
|
||||
#
|
||||
# In OS X PEIMs are really XIP, so we need to make this address match the malloced
|
||||
# buffer for the FD (0x41000000). If this address does not match the FV will get
|
||||
# relocated in place (works, but not a great idea).
|
||||
#
|
||||
BaseAddress = 0x102000000|gEmulatorPkgTokenSpaceGuid.PcdEmuFdBaseAddress #The base address of the FLASH Device.
|
||||
Size = 0x005a0000|gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize #The size in bytes of the FLASH Device
|
||||
ErasePolarity = 1
|
||||
BlockSize = 0x10000
|
||||
NumBlocks = 0x5a
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Following are lists of FD Region layout which correspond to the locations of different
|
||||
# images within the flash device.
|
||||
#
|
||||
# Regions must be defined in ascending order and may not overlap.
|
||||
#
|
||||
# A Layout Region start with a eight digit hex offset (leading "0x" required) followed by
|
||||
# the pipe "|" character, followed by the size of the region, also in hex with the leading
|
||||
# "0x" characters. Like:
|
||||
# Offset|Size
|
||||
# PcdOffsetCName|PcdSizeCName
|
||||
# RegionType <FV, DATA, or FILE>
|
||||
#
|
||||
################################################################################
|
||||
0x00000000|0x00580000
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoveryBase|gEmulatorPkgTokenSpaceGuid.PcdEmuFlashFvRecoverySize
|
||||
FV = FvRecovery
|
||||
|
||||
0x00580000|0x0000c000
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageVariableBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize
|
||||
#NV_VARIABLE_STORE
|
||||
DATA = {
|
||||
## This is the EFI_FIRMWARE_VOLUME_HEADER
|
||||
# ZeroVector []
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
# FileSystemGuid: gEfiSystemNvDataFvGuid =
|
||||
# { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
|
||||
0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
|
||||
0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
|
||||
# FvLength: 0x20000
|
||||
0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
# Signature "_FVH" #Attributes
|
||||
0x5f, 0x46, 0x56, 0x48, 0xff, 0xfe, 0x04, 0x00,
|
||||
# HeaderLength #CheckSum #ExtHeaderOffset #Reserved #Revision
|
||||
0x48, 0x00, 0x36, 0x09, 0x00, 0x00, 0x00, 0x02,
|
||||
# Blockmap[0]: 2 Blocks * 0x10000 Bytes / Block
|
||||
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00,
|
||||
# Blockmap[1]: End
|
||||
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
## This is the VARIABLE_STORE_HEADER
|
||||
#Signature: gEfiVariableGuid =
|
||||
# { 0xddcf3616, 0x3275, 0x4164, { 0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d }}
|
||||
0x16, 0x36, 0xcf, 0xdd, 0x75, 0x32, 0x64, 0x41,
|
||||
0x98, 0xb6, 0xfe, 0x85, 0x70, 0x7f, 0xfe, 0x7d,
|
||||
#Size: 0xc000 (gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableSize) - 0x48 (size of EFI_FIRMWARE_VOLUME_HEADER) = 0xBFB8
|
||||
# This can speed up the Variable Dispatch a bit.
|
||||
0xB8, 0xBF, 0x00, 0x00,
|
||||
#FORMATTED: 0x5A #HEALTHY: 0xFE #Reserved: UINT16 #Reserved1: UINT32
|
||||
0x5A, 0xFE, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
0x0058c000|0x00002000
|
||||
#NV_EVENT_LOG
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogBase|gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageEventLogSize
|
||||
|
||||
0x0058e000|0x00002000
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwWorkingBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwWorkingSize
|
||||
#NV_FTW_WORKING
|
||||
DATA = {
|
||||
# EFI_FAULT_TOLERANT_WORKING_BLOCK_HEADER->Signature = gEfiSystemNvDataFvGuid =
|
||||
# { 0xFFF12B8D, 0x7696, 0x4C8B, { 0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50 }}
|
||||
0x8D, 0x2B, 0xF1, 0xFF, 0x96, 0x76, 0x8B, 0x4C,
|
||||
0xA9, 0x85, 0x27, 0x47, 0x07, 0x5B, 0x4F, 0x50,
|
||||
# Crc:UINT32 #WorkingBlockValid:1, WorkingBlockInvalid:1, Reserved
|
||||
0x77, 0x13, 0x9B, 0xD7, 0xFE, 0xFF, 0xFF, 0xFF,
|
||||
# WriteQueueSize: UINT64
|
||||
0xE0, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
|
||||
}
|
||||
|
||||
0x00590000|0x00010000
|
||||
#NV_FTW_SPARE
|
||||
gEmulatorPkgTokenSpaceGuid.PcdEmuFlashNvStorageFtwSpareBase|gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# FV Section
|
||||
#
|
||||
# [FV] section is used to define what components or modules are placed within a flash
|
||||
# device file. This section also defines order the components and modules are positioned
|
||||
# within the image. The [FV] section consists of define statements, set statements and
|
||||
# module statements.
|
||||
#
|
||||
################################################################################
|
||||
[FV.FvRecovery]
|
||||
FvAlignment = 16 #FV alignment and FV attributes setting.
|
||||
ERASE_POLARITY = 1
|
||||
MEMORY_MAPPED = TRUE
|
||||
STICKY_WRITE = TRUE
|
||||
LOCK_CAP = TRUE
|
||||
LOCK_STATUS = TRUE
|
||||
WRITE_DISABLED_CAP = TRUE
|
||||
WRITE_ENABLED_CAP = TRUE
|
||||
WRITE_STATUS = TRUE
|
||||
WRITE_LOCK_CAP = TRUE
|
||||
WRITE_LOCK_STATUS = TRUE
|
||||
READ_DISABLED_CAP = TRUE
|
||||
READ_ENABLED_CAP = TRUE
|
||||
READ_STATUS = TRUE
|
||||
READ_LOCK_CAP = TRUE
|
||||
READ_LOCK_STATUS = TRUE
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# The INF statements point to EDK component and EDK II module INF files, which will be placed into this FV image.
|
||||
# Parsing tools will scan the INF file to determine the type of component or module.
|
||||
# The component or module type is used to reference the standard rules
|
||||
# defined elsewhere in the FDF file.
|
||||
#
|
||||
# The format for INF statements is:
|
||||
# INF $(PathAndInfFileName)
|
||||
#
|
||||
################################################################################
|
||||
##
|
||||
# PEI Phase modules
|
||||
##
|
||||
##
|
||||
# PEI Apriori file example, more PEIM module added later.
|
||||
##
|
||||
APRIORI PEI {
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
|
||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||
}
|
||||
APRIORI DXE {
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||
}
|
||||
INF EmulatorPkg/Sec/Sec.inf
|
||||
INF MdeModulePkg/Core/Pei/PeiMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Pei/Pcd.inf
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
|
||||
INF EmulatorPkg/BootModePei/BootModePei.inf
|
||||
INF EmulatorPkg/AutoScanPei/AutoScanPei.inf
|
||||
INF EmulatorPkg/FirmwareVolumePei/FirmwareVolumePei.inf
|
||||
INF EmulatorPkg/FlashMapPei/FlashMapPei.inf
|
||||
INF EmulatorPkg/ThunkPpiToProtocolPei/ThunkPpiToProtocolPei.inf
|
||||
INF MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
|
||||
INF MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
|
||||
|
||||
##
|
||||
# DXE Phase modules
|
||||
##
|
||||
INF MdeModulePkg/Core/Dxe/DxeMain.inf
|
||||
INF MdeModulePkg/Universal/PCD/Dxe/Pcd.inf
|
||||
INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/Metronome/Metronome.inf
|
||||
INF EmulatorPkg/RealTimeClockRuntimeDxe/RealTimeClock.inf
|
||||
INF EmulatorPkg/ResetRuntimeDxe/Reset.inf
|
||||
INF MdeModulePkg/Core/RuntimeDxe/RuntimeDxe.inf
|
||||
INF EmulatorPkg/FvbServicesRuntimeDxe/FvbServicesRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/SecurityStubDxe/SecurityStubDxe.inf
|
||||
INF MdeModulePkg/Universal/EbcDxe/EbcDxe.inf
|
||||
INF MdeModulePkg/Universal/MemoryTest/NullMemoryTestDxe/NullMemoryTestDxe.inf
|
||||
INF EmulatorPkg/EmuThunkDxe/EmuThunk.inf
|
||||
INF EmulatorPkg/CpuRuntimeDxe/Cpu.inf
|
||||
INF MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
|
||||
INF EmulatorPkg/MiscSubClassPlatformDxe/MiscSubClassDriver.inf
|
||||
INF EmulatorPkg/TimerDxe/Timer.inf
|
||||
INF MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/WatchdogTimerDxe/WatchdogTimer.inf
|
||||
INF MdeModulePkg/Universal/MonotonicCounterRuntimeDxe/MonotonicCounterRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/ConPlatformDxe/ConPlatformDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/GraphicsConsoleDxe/GraphicsConsoleDxe.inf
|
||||
|
||||
INF EmbeddedPkg/SerialDxe/SerialDxe.inf
|
||||
INF MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
|
||||
INF MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/DiskIoDxe/DiskIoDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/PartitionDxe/PartitionDxe.inf
|
||||
INF MdeModulePkg/Universal/Disk/UnicodeCollation/EnglishDxe/EnglishDxe.inf
|
||||
INF MdeModulePkg/Bus/Pci/PciBusDxe/PciBusDxe.inf
|
||||
INF MdeModulePkg/Bus/Scsi/ScsiBusDxe/ScsiBusDxe.inf
|
||||
INF MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDiskDxe.inf
|
||||
INF IntelFrameworkModulePkg/Bus/Pci/IdeBusDxe/IdeBusDxe.inf
|
||||
INF MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.inf
|
||||
|
||||
INF EmulatorPkg/EmuBusDriverDxe/EmuBusDriverDxe.inf
|
||||
INF EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
|
||||
INF EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
|
||||
INF EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
|
||||
INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
|
||||
|
||||
INF MdeModulePkg/Universal/HiiDatabaseDxe/HiiDatabaseDxe.inf
|
||||
INF MdeModulePkg/Universal/SetupBrowserDxe/SetupBrowserDxe.inf
|
||||
INF MdeModulePkg/Universal/PrintDxe/PrintDxe.inf
|
||||
INF IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
|
||||
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
|
||||
INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
|
||||
|
||||
#
|
||||
# Network stack drivers
|
||||
#
|
||||
!if $(NETWORK_SUPPORT)
|
||||
INF EmulatorPkg/EmuSnpDxe/EmuSnpDxe.inf
|
||||
!endif
|
||||
INF MdeModulePkg/Universal/Network/DpcDxe/DpcDxe.inf
|
||||
INF MdeModulePkg/Universal/Network/ArpDxe/ArpDxe.inf
|
||||
INF MdeModulePkg/Universal/Network/Dhcp4Dxe/Dhcp4Dxe.inf
|
||||
INF MdeModulePkg/Universal/Network/Ip4ConfigDxe/Ip4ConfigDxe.inf
|
||||
INF MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Dxe.inf
|
||||
INF MdeModulePkg/Universal/Network/MnpDxe/MnpDxe.inf
|
||||
INF MdeModulePkg/Universal/Network/VlanConfigDxe/VlanConfigDxe.inf
|
||||
INF MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Dxe.inf
|
||||
INF MdeModulePkg/Universal/Network/Tcp4Dxe/Tcp4Dxe.inf
|
||||
INF MdeModulePkg/Universal/Network/Udp4Dxe/Udp4Dxe.inf
|
||||
|
||||
|
||||
!if $(BUILD_FAT)
|
||||
INF FatPkg/EnhancedFatDxe/Fat.inf
|
||||
!else
|
||||
INF RuleOverride = BINARY FatBinPkg/EnhancedFatDxe/Fat.inf
|
||||
!endif
|
||||
|
||||
!if $(BUILD_NEW_SHELL)
|
||||
INF ShellPkg/Application/Shell/Shell.inf
|
||||
!else
|
||||
!if $(USE_NEW_SHELL)
|
||||
INF RuleOverride = BINARY ShellBinPkg/UefiShell/UefiShell.inf
|
||||
!else
|
||||
INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf
|
||||
!endif
|
||||
!endif
|
||||
|
||||
FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) {
|
||||
SECTION RAW = MdeModulePkg/Logo/Logo.bmp
|
||||
}
|
||||
|
||||
|
||||
################################################################################
|
||||
#
|
||||
# Rules are use with the [FV] section's module INF type to define
|
||||
# how an FFS file is created for a given INF file. The following Rule are the default
|
||||
# rules for the different module type. User can add the customized rules to define the
|
||||
# content of the FFS file.
|
||||
#
|
||||
################################################################################
|
||||
|
||||
|
||||
############################################################################
|
||||
# Example of a DXE_DRIVER FFS file with a Checksum encapsulation section #
|
||||
############################################################################
|
||||
#
|
||||
#[Rule.Common.DXE_DRIVER]
|
||||
# FILE DRIVER = $(NAMED_GUID) {
|
||||
# DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
# COMPRESS PI_STD {
|
||||
# GUIDED {
|
||||
# PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
# UI STRING="$(MODULE_NAME)" Optional
|
||||
# VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
# }
|
||||
# }
|
||||
# }
|
||||
#
|
||||
############################################################################
|
||||
[Rule.Common.SEC]
|
||||
FILE SEC = $(NAMED_GUID) {
|
||||
PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING ="$(MODULE_NAME)" Optional
|
||||
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
|
||||
[Rule.Common.PEI_CORE]
|
||||
FILE PEI_CORE = $(NAMED_GUID) {
|
||||
PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING ="$(MODULE_NAME)" Optional
|
||||
VERSION STRING ="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
[Rule.Common.PEIM]
|
||||
FILE PEIM = $(NAMED_GUID) {
|
||||
PEI_DEPEX PEI_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
PE32 PE32 Align=32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
[Rule.Common.DXE_CORE]
|
||||
FILE DXE_CORE = $(NAMED_GUID) {
|
||||
COMPRESS PI_STD {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_DRIVER]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.DXE_DRIVER]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.DXE_RUNTIME_DRIVER]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional $(INF_OUTPUT)/$(MODULE_NAME).depex
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_APPLICATION]
|
||||
FILE APPLICATION = $(NAMED_GUID) {
|
||||
COMPRESS PI_STD {
|
||||
GUIDED {
|
||||
PE32 PE32 $(INF_OUTPUT)/$(MODULE_NAME).efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_DRIVER.BINARY]
|
||||
FILE DRIVER = $(NAMED_GUID) {
|
||||
DXE_DEPEX DXE_DEPEX Optional |.depex
|
||||
PE32 PE32 |.efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
||||
[Rule.Common.UEFI_APPLICATION.BINARY]
|
||||
FILE APPLICATION = $(NAMED_GUID) {
|
||||
PE32 PE32 |.efi
|
||||
UI STRING="$(MODULE_NAME)" Optional
|
||||
VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
|
||||
}
|
||||
|
24
EmulatorPkg/Unix/Xcode/xcode_project32/XcodeBuild.sh
Executable file
24
EmulatorPkg/Unix/Xcode/xcode_project32/XcodeBuild.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# External makefile Xcode project project uses this script to build and clean from the Xcode GUI
|
||||
#
|
||||
# Copyright (c) 2008 - 2011, Apple Inc. 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
# force exit on error
|
||||
set -e
|
||||
|
||||
#
|
||||
# Source the workspace and set up the environment variables we need
|
||||
#
|
||||
cd ../..
|
||||
echo `pwd`
|
||||
./build.sh $1 $2 $3 $4 $5 $6 $8
|
@@ -0,0 +1,191 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
activeBuildConfigurationName = Debug;
|
||||
activeExecutable = BA11A1010FB10BCE00D06FEC /* SecMain.dll */;
|
||||
activeTarget = D28A88AD04BDD90700651E21 /* xcode_project */;
|
||||
breakpoints = (
|
||||
BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */,
|
||||
);
|
||||
codeSenseManager = BA11A0FE0FB10B4800D06FEC /* Code sense */;
|
||||
executables = (
|
||||
BA11A1010FB10BCE00D06FEC /* SecMain.dll */,
|
||||
);
|
||||
perUserDictionary = {
|
||||
"PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
20,
|
||||
198,
|
||||
20,
|
||||
99,
|
||||
99,
|
||||
29,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXBreakpointsDataSource_ActionID,
|
||||
PBXBreakpointsDataSource_TypeID,
|
||||
PBXBreakpointsDataSource_BreakpointID,
|
||||
PBXBreakpointsDataSource_UseID,
|
||||
PBXBreakpointsDataSource_LocationID,
|
||||
PBXBreakpointsDataSource_ConditionID,
|
||||
PBXBreakpointsDataSource_IgnoreCountID,
|
||||
PBXBreakpointsDataSource_ContinueID,
|
||||
);
|
||||
};
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
22,
|
||||
300,
|
||||
229,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXExecutablesDataSource_ActiveFlagID,
|
||||
PBXExecutablesDataSource_NameID,
|
||||
PBXExecutablesDataSource_CommentsID,
|
||||
);
|
||||
};
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
341,
|
||||
20,
|
||||
48,
|
||||
43,
|
||||
43,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXFileDataSource_FiletypeID,
|
||||
PBXFileDataSource_Filename_ColumnID,
|
||||
PBXFileDataSource_Built_ColumnID,
|
||||
PBXFileDataSource_ObjectSize_ColumnID,
|
||||
PBXFileDataSource_Errors_ColumnID,
|
||||
PBXFileDataSource_Warnings_ColumnID,
|
||||
PBXFileDataSource_Target_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXPerProjectTemplateStateSaveDate = 263260969;
|
||||
PBXWorkspaceStateSaveDate = 263260969;
|
||||
};
|
||||
sourceControlManager = BA11A0FD0FB10B4800D06FEC /* Source Control */;
|
||||
userBuildSettings = {
|
||||
};
|
||||
};
|
||||
BA11A0FD0FB10B4800D06FEC /* Source Control */ = {
|
||||
isa = PBXSourceControlManager;
|
||||
fallbackIsa = XCSourceControlManager;
|
||||
isSCMEnabled = 0;
|
||||
repositoryNamesForRoots = {
|
||||
};
|
||||
scmConfiguration = {
|
||||
};
|
||||
};
|
||||
BA11A0FE0FB10B4800D06FEC /* Code sense */ = {
|
||||
isa = PBXCodeSenseManager;
|
||||
indexTemplatePath = "";
|
||||
};
|
||||
BA11A1010FB10BCE00D06FEC /* SecMain.dll */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
);
|
||||
argumentStrings = (
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 1;
|
||||
configStateDict = {
|
||||
"PBXLSLaunchAction-0" = {
|
||||
PBXLSLaunchAction = 0;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXLSRunLaunchConfig;
|
||||
commandLineArgs = (
|
||||
);
|
||||
displayName = "Executable Runner";
|
||||
environment = {
|
||||
};
|
||||
identifier = com.apple.Xcode.launch.runConfig;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
"PBXLSLaunchAction-1" = {
|
||||
PBXLSLaunchAction = 1;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXGDB_LaunchConfig;
|
||||
commandLineArgs = (
|
||||
);
|
||||
displayName = GDB;
|
||||
environment = {
|
||||
};
|
||||
identifier = com.apple.Xcode.launch.GDBMI_Config;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
};
|
||||
customDataFormattersEnabled = 0;
|
||||
dataTipCustomDataFormattersEnabled = 1;
|
||||
dataTipShowTypeColumn = 1;
|
||||
dataTipSortType = 0;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = "";
|
||||
enableDebugStr = 1;
|
||||
environmentEntries = (
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
launchableReference = BA11A1020FB10BCE00D06FEC /* SecMain.dll */;
|
||||
libgmallocEnabled = 0;
|
||||
name = SecMain.dll;
|
||||
savedGlobals = {
|
||||
};
|
||||
showTypeColumn = 0;
|
||||
sourceDirectories = (
|
||||
);
|
||||
startupPath = ../../../../Build/EmuUnixIa32/DEBUG_XCLANG/IA32;
|
||||
};
|
||||
BA11A1020FB10BCE00D06FEC /* SecMain.dll */ = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = "compiled.mach-o.executable";
|
||||
name = SecMain.dll;
|
||||
path = ../../../../Build/EmuUnixIa32/DEBUG_XCLANG/IA32/SecMain;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */ = {
|
||||
isa = PBXSymbolicBreakpoint;
|
||||
actions = (
|
||||
BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */,
|
||||
);
|
||||
breakpointStyle = 1;
|
||||
continueAfterActions = 1;
|
||||
countType = 0;
|
||||
delayBeforeContinue = 0;
|
||||
hitCount = 0;
|
||||
ignoreCount = 0;
|
||||
location = SecMain;
|
||||
modificationTime = 263261853.260195;
|
||||
originalNumberOfMultipleMatches = 1;
|
||||
state = 1;
|
||||
symbolName = SecGdbConfigBreak;
|
||||
};
|
||||
BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */ = {
|
||||
isa = XCBreakpointCommandAction;
|
||||
command = "set gInXcode=1\nsource ../../../../EmulatorPkg/Unix/GdbRun";
|
||||
fallbackIsa = XCBreakpointAction;
|
||||
logCommand = 0;
|
||||
useDebuggerSideImplementation = 1;
|
||||
};
|
||||
D28A88AD04BDD90700651E21 /* xcode_project */ = {
|
||||
activeExec = 0;
|
||||
};
|
||||
}
|
@@ -0,0 +1,124 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* xcode_project */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = xcode_project;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXLegacyTarget section */
|
||||
D28A88AD04BDD90700651E21 /* xcode_project */ = {
|
||||
isa = PBXLegacyTarget;
|
||||
buildArgumentsString = "$(ACTION)";
|
||||
buildConfigurationList = 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */;
|
||||
buildPhases = (
|
||||
);
|
||||
buildToolPath = ./XcodeBuild.sh;
|
||||
buildWorkingDirectory = "";
|
||||
dependencies = (
|
||||
);
|
||||
name = xcode_project;
|
||||
passBuildSettingsInEnvironment = 1;
|
||||
productName = xcode_project;
|
||||
};
|
||||
/* End PBXLegacyTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* xcode_project */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
D28A88AD04BDD90700651E21 /* xcode_project */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB919008733D9F0010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = xcode_project;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB919108733D9F0010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = xcode_project;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB919408733D9F0010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB919508733D9F0010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB919008733D9F0010E9CD /* Debug */,
|
||||
1DEB919108733D9F0010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB919408733D9F0010E9CD /* Debug */,
|
||||
1DEB919508733D9F0010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
24
EmulatorPkg/Unix/Xcode/xcode_project64/XcodeBuild.sh
Executable file
24
EmulatorPkg/Unix/Xcode/xcode_project64/XcodeBuild.sh
Executable file
@@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# External makefile Xcode project project uses this script to build and clean from the Xcode GUI
|
||||
#
|
||||
# Copyright (c) 2008 - 2011, Apple Inc. 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
# force exit on error
|
||||
set -e
|
||||
|
||||
#
|
||||
# Source the workspace and set up the environment variables we need
|
||||
#
|
||||
cd ../..
|
||||
echo `pwd`
|
||||
./build64.sh $1 $2 $3 $4 $5 $6 $8
|
@@ -0,0 +1,191 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
activeBuildConfigurationName = Debug;
|
||||
activeExecutable = BA11A1010FB10BCE00D06FEC /* SecMain.dll */;
|
||||
activeTarget = D28A88AD04BDD90700651E21 /* xcode_project */;
|
||||
breakpoints = (
|
||||
BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */,
|
||||
);
|
||||
codeSenseManager = BA11A0FE0FB10B4800D06FEC /* Code sense */;
|
||||
executables = (
|
||||
BA11A1010FB10BCE00D06FEC /* SecMain.dll */,
|
||||
);
|
||||
perUserDictionary = {
|
||||
"PBXConfiguration.PBXBreakpointsDataSource.v1:1CA1AED706398EBD00589147" = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXBreakpointsDataSource_BreakpointID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
20,
|
||||
198,
|
||||
20,
|
||||
99,
|
||||
99,
|
||||
29,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXBreakpointsDataSource_ActionID,
|
||||
PBXBreakpointsDataSource_TypeID,
|
||||
PBXBreakpointsDataSource_BreakpointID,
|
||||
PBXBreakpointsDataSource_UseID,
|
||||
PBXBreakpointsDataSource_LocationID,
|
||||
PBXBreakpointsDataSource_ConditionID,
|
||||
PBXBreakpointsDataSource_IgnoreCountID,
|
||||
PBXBreakpointsDataSource_ContinueID,
|
||||
);
|
||||
};
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXExecutablesDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXExecutablesDataSource_NameID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
22,
|
||||
300,
|
||||
229,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXExecutablesDataSource_ActiveFlagID,
|
||||
PBXExecutablesDataSource_NameID,
|
||||
PBXExecutablesDataSource_CommentsID,
|
||||
);
|
||||
};
|
||||
PBXConfiguration.PBXFileTableDataSource3.PBXFileTableDataSource = {
|
||||
PBXFileTableDataSourceColumnSortingDirectionKey = "-1";
|
||||
PBXFileTableDataSourceColumnSortingKey = PBXFileDataSource_Filename_ColumnID;
|
||||
PBXFileTableDataSourceColumnWidthsKey = (
|
||||
20,
|
||||
341,
|
||||
20,
|
||||
48,
|
||||
43,
|
||||
43,
|
||||
20,
|
||||
);
|
||||
PBXFileTableDataSourceColumnsKey = (
|
||||
PBXFileDataSource_FiletypeID,
|
||||
PBXFileDataSource_Filename_ColumnID,
|
||||
PBXFileDataSource_Built_ColumnID,
|
||||
PBXFileDataSource_ObjectSize_ColumnID,
|
||||
PBXFileDataSource_Errors_ColumnID,
|
||||
PBXFileDataSource_Warnings_ColumnID,
|
||||
PBXFileDataSource_Target_ColumnID,
|
||||
);
|
||||
};
|
||||
PBXPerProjectTemplateStateSaveDate = 263260969;
|
||||
PBXWorkspaceStateSaveDate = 263260969;
|
||||
};
|
||||
sourceControlManager = BA11A0FD0FB10B4800D06FEC /* Source Control */;
|
||||
userBuildSettings = {
|
||||
};
|
||||
};
|
||||
BA11A0FD0FB10B4800D06FEC /* Source Control */ = {
|
||||
isa = PBXSourceControlManager;
|
||||
fallbackIsa = XCSourceControlManager;
|
||||
isSCMEnabled = 0;
|
||||
repositoryNamesForRoots = {
|
||||
};
|
||||
scmConfiguration = {
|
||||
};
|
||||
};
|
||||
BA11A0FE0FB10B4800D06FEC /* Code sense */ = {
|
||||
isa = PBXCodeSenseManager;
|
||||
indexTemplatePath = "";
|
||||
};
|
||||
BA11A1010FB10BCE00D06FEC /* SecMain.dll */ = {
|
||||
isa = PBXExecutable;
|
||||
activeArgIndices = (
|
||||
);
|
||||
argumentStrings = (
|
||||
);
|
||||
autoAttachOnCrash = 1;
|
||||
breakpointsEnabled = 1;
|
||||
configStateDict = {
|
||||
"PBXLSLaunchAction-0" = {
|
||||
PBXLSLaunchAction = 0;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXLSRunLaunchConfig;
|
||||
commandLineArgs = (
|
||||
);
|
||||
displayName = "Executable Runner";
|
||||
environment = {
|
||||
};
|
||||
identifier = com.apple.Xcode.launch.runConfig;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
"PBXLSLaunchAction-1" = {
|
||||
PBXLSLaunchAction = 1;
|
||||
PBXLSLaunchStartAction = 1;
|
||||
PBXLSLaunchStdioStyle = 2;
|
||||
PBXLSLaunchStyle = 0;
|
||||
class = PBXGDB_LaunchConfig;
|
||||
commandLineArgs = (
|
||||
);
|
||||
displayName = GDB;
|
||||
environment = {
|
||||
};
|
||||
identifier = com.apple.Xcode.launch.GDBMI_Config;
|
||||
remoteHostInfo = "";
|
||||
startActionInfo = "";
|
||||
};
|
||||
};
|
||||
customDataFormattersEnabled = 0;
|
||||
dataTipCustomDataFormattersEnabled = 1;
|
||||
dataTipShowTypeColumn = 1;
|
||||
dataTipSortType = 0;
|
||||
debuggerPlugin = GDBDebugging;
|
||||
disassemblyDisplayState = 0;
|
||||
dylibVariantSuffix = "";
|
||||
enableDebugStr = 1;
|
||||
environmentEntries = (
|
||||
);
|
||||
executableSystemSymbolLevel = 0;
|
||||
executableUserSymbolLevel = 0;
|
||||
launchableReference = BA11A1020FB10BCE00D06FEC /* SecMain.dll */;
|
||||
libgmallocEnabled = 0;
|
||||
name = SecMain.dll;
|
||||
savedGlobals = {
|
||||
};
|
||||
showTypeColumn = 0;
|
||||
sourceDirectories = (
|
||||
);
|
||||
startupPath = ../../../../Build/EmuUnixX64/DEBUG_XCLANG/X64;
|
||||
};
|
||||
BA11A1020FB10BCE00D06FEC /* SecMain.dll */ = {
|
||||
isa = PBXFileReference;
|
||||
lastKnownFileType = "compiled.mach-o.executable";
|
||||
name = SecMain.dll;
|
||||
path = ../../../../Build/EmuUnixX64/DEBUG_XCLANG/X64/SecMain;
|
||||
sourceTree = SOURCE_ROOT;
|
||||
};
|
||||
BA11A11A0FB10E0700D06FEC /* SecGdbConfigBreak */ = {
|
||||
isa = PBXSymbolicBreakpoint;
|
||||
actions = (
|
||||
BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */,
|
||||
);
|
||||
breakpointStyle = 1;
|
||||
continueAfterActions = 1;
|
||||
countType = 0;
|
||||
delayBeforeContinue = 0;
|
||||
hitCount = 0;
|
||||
ignoreCount = 0;
|
||||
location = SecMain;
|
||||
modificationTime = 263261853.260195;
|
||||
originalNumberOfMultipleMatches = 1;
|
||||
state = 1;
|
||||
symbolName = SecGdbConfigBreak;
|
||||
};
|
||||
BA11A11E0FB10E2200D06FEC /* XCBreakpointCommandAction */ = {
|
||||
isa = XCBreakpointCommandAction;
|
||||
command = "set gInXcode=1\nsource ../../../../EmulatorPkg/Unix/GdbRun";
|
||||
fallbackIsa = XCBreakpointAction;
|
||||
logCommand = 0;
|
||||
useDebuggerSideImplementation = 1;
|
||||
};
|
||||
D28A88AD04BDD90700651E21 /* xcode_project */ = {
|
||||
activeExec = 0;
|
||||
};
|
||||
}
|
@@ -0,0 +1,124 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 45;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* xcode_project */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
);
|
||||
name = xcode_project;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXLegacyTarget section */
|
||||
D28A88AD04BDD90700651E21 /* xcode_project */ = {
|
||||
isa = PBXLegacyTarget;
|
||||
buildArgumentsString = "$(ACTION)";
|
||||
buildConfigurationList = 1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */;
|
||||
buildPhases = (
|
||||
);
|
||||
buildToolPath = ./XcodeBuild.sh;
|
||||
buildWorkingDirectory = "";
|
||||
dependencies = (
|
||||
);
|
||||
name = xcode_project;
|
||||
passBuildSettingsInEnvironment = 1;
|
||||
productName = xcode_project;
|
||||
};
|
||||
/* End PBXLegacyTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* xcode_project */;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
D28A88AD04BDD90700651E21 /* xcode_project */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB919008733D9F0010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
PRODUCT_NAME = xcode_project;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB919108733D9F0010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
OTHER_CFLAGS = "";
|
||||
OTHER_LDFLAGS = "";
|
||||
PRODUCT_NAME = xcode_project;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
1DEB919408733D9F0010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB919508733D9F0010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB918F08733D9F0010E9CD /* Build configuration list for PBXLegacyTarget "xcode_project" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB919008733D9F0010E9CD /* Debug */,
|
||||
1DEB919108733D9F0010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
1DEB919308733D9F0010E9CD /* Build configuration list for PBXProject "xcode_project" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB919408733D9F0010E9CD /* Debug */,
|
||||
1DEB919508733D9F0010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
137
EmulatorPkg/Unix/build.sh
Executable file
137
EmulatorPkg/Unix/build.sh
Executable file
@@ -0,0 +1,137 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
||||
# Copyright (c) 2010, 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
set -e
|
||||
shopt -s nocasematch
|
||||
|
||||
|
||||
#
|
||||
# Setup workspace if it is not set
|
||||
#
|
||||
if [ -z "$WORKSPACE" ]
|
||||
then
|
||||
echo Initializing workspace
|
||||
if [ ! -e `pwd`/edksetup.sh ]
|
||||
then
|
||||
cd ../..
|
||||
fi
|
||||
# This version is for the tools in the BaseTools project.
|
||||
# this assumes svn pulls have the same root dir
|
||||
# export EDK_TOOLS_PATH=`pwd`/../BaseTools
|
||||
# This version is for the tools source in edk2
|
||||
export EDK_TOOLS_PATH=`pwd`/BaseTools
|
||||
echo $EDK_TOOLS_PATH
|
||||
source edksetup.sh BaseTools
|
||||
else
|
||||
echo Building from: $WORKSPACE
|
||||
fi
|
||||
|
||||
#
|
||||
# Pick a default tool type for a given OS
|
||||
#
|
||||
UNIXPKG_TOOLS=GCC44
|
||||
NETWORK_SUPPORT=
|
||||
BUILD_NEW_SHELL=
|
||||
BUILD_FAT=
|
||||
case `uname` in
|
||||
CYGWIN*) echo Cygwin not fully supported yet. ;;
|
||||
Darwin*)
|
||||
Major=$(uname -r | cut -f 1 -d '.')
|
||||
if [[ $Major == 9 ]]
|
||||
then
|
||||
echo UnixPkg requires Snow Leopard or later OS
|
||||
exit 1
|
||||
else
|
||||
TARGET_TOOLS=XCODE32
|
||||
UNIXPKG_TOOLS=XCLANG
|
||||
fi
|
||||
BUILD_NEW_SHELL="-D BUILD_NEW_SHELL"
|
||||
BUILD_FAT="-D BUILD_FAT"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -d /lib32 ]
|
||||
then
|
||||
export LIB_ARCH_SFX=32
|
||||
fi
|
||||
|
||||
if [ -z "$TARGET_TOOLS" ]
|
||||
then
|
||||
TARGET_TOOLS=$UNIXPKG_TOOLS
|
||||
fi
|
||||
|
||||
BUILD_ROOT_ARCH=$WORKSPACE/Build/EmuUnixIa32/DEBUG_"$UNIXPKG_TOOLS"/IA32
|
||||
|
||||
if [[ ! -f `which build` || ! -f `which GenFv` ]];
|
||||
then
|
||||
# build the tools if they don't yet exist. Bin scheme
|
||||
echo Building tools as they are not in the path
|
||||
make -C $WORKSPACE/BaseTools
|
||||
elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
|
||||
then
|
||||
# build the tools if they don't yet exist. BinWrapper scheme
|
||||
echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
|
||||
make -C $WORKSPACE/BaseTools
|
||||
else
|
||||
echo using prebuilt tools
|
||||
fi
|
||||
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
if [[ $arg == run ]]; then
|
||||
case `uname` in
|
||||
Darwin*)
|
||||
#
|
||||
# On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
|
||||
# This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
|
||||
# images that get loaded in SecMain
|
||||
#
|
||||
cp $WORKSPACE/EmulatorPkg/Unix/.gdbinit $WORKSPACE/Build/EmuUnixIa32/DEBUG_"$UNIXPKG_TOOLS"/IA32
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/EmulatorPkg/Unix/GdbRun
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $arg == cleanall ]]; then
|
||||
make -C $WORKSPACE/BaseTools clean
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -n 3 clean
|
||||
build -p $WORKSPACE/ShellPkg/ShellPkg.dsc -a IA32 -t $UNIXPKG_TOOLS -n 3 clean
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [[ $arg == clean ]]; then
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -n 3 clean
|
||||
exit $?
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Build the edk2 UnixPkg
|
||||
#
|
||||
if [[ $TARGET_TOOLS == $UNIXPKG_TOOLS ]]; then
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -D BUILD_32 -D UNIX_SEC_BUILD $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
|
||||
else
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $TARGET_TOOLS -D BUILD_32 -D UNIX_SEC_BUILD -D SKIP_MAIN_BUILD -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a IA32 -t $UNIXPKG_TOOLS -D BUILD_32 $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
|
||||
cp $WORKSPACE/Build/EmuUnixIa32/DEBUG_"$TARGET_TOOLS"/IA32/SecMain $WORKSPACE/Build/EmuUnixIa32/DEBUG_"$UNIXPKG_TOOLS"/IA32
|
||||
fi
|
||||
exit $?
|
||||
|
138
EmulatorPkg/Unix/build64.sh
Executable file
138
EmulatorPkg/Unix/build64.sh
Executable file
@@ -0,0 +1,138 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 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
|
||||
# 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.
|
||||
#
|
||||
|
||||
set -e
|
||||
shopt -s nocasematch
|
||||
|
||||
|
||||
#
|
||||
# Setup workspace if it is not set
|
||||
#
|
||||
if [ -z "$WORKSPACE" ]
|
||||
then
|
||||
echo Initializing workspace
|
||||
if [ ! -e `pwd`/edksetup.sh ]
|
||||
then
|
||||
cd ../..
|
||||
fi
|
||||
# This version is for the tools in the BaseTools project.
|
||||
# this assumes svn pulls have the same root dir
|
||||
# export EDK_TOOLS_PATH=`pwd`/../BaseTools
|
||||
# This version is for the tools source in edk2
|
||||
export EDK_TOOLS_PATH=`pwd`/BaseTools
|
||||
echo $EDK_TOOLS_PATH
|
||||
source edksetup.sh BaseTools
|
||||
else
|
||||
echo Building from: $WORKSPACE
|
||||
fi
|
||||
|
||||
#
|
||||
# Pick a default tool type for a given OS
|
||||
#
|
||||
UNIXPKG_TOOLS=GCC44
|
||||
NETWORK_SUPPORT=
|
||||
BUILD_NEW_SHELL=
|
||||
BUILD_FAT=
|
||||
case `uname` in
|
||||
CYGWIN*) echo Cygwin not fully supported yet. ;;
|
||||
Darwin*)
|
||||
Major=$(uname -r | cut -f 1 -d '.')
|
||||
if [[ $Major == 9 ]]
|
||||
then
|
||||
echo UnixPkg requires Snow Leopard or later OS
|
||||
exit 1
|
||||
else
|
||||
TARGET_TOOLS=XCODE32
|
||||
UNIXPKG_TOOLS=XCLANG
|
||||
fi
|
||||
# NETWORK_SUPPORT="-D NETWORK_SUPPORT"
|
||||
BUILD_NEW_SHELL="-D BUILD_NEW_SHELL"
|
||||
BUILD_FAT="-D BUILD_FAT"
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -d /lib64 ]
|
||||
then
|
||||
export LIB_ARCH_SFX=64
|
||||
fi
|
||||
|
||||
if [ -z "$TARGET_TOOLS" ]
|
||||
then
|
||||
TARGET_TOOLS=$UNIXPKG_TOOLS
|
||||
fi
|
||||
|
||||
BUILD_ROOT_ARCH=$WORKSPACE/Build/EmuUnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
|
||||
|
||||
if [[ ! -f `which build` || ! -f `which GenFv` ]];
|
||||
then
|
||||
# build the tools if they don't yet exist. Bin scheme
|
||||
echo Building tools as they are not in the path
|
||||
make -C $WORKSPACE/BaseTools
|
||||
elif [[ ( -f `which build` || -f `which GenFv` ) && ! -d $EDK_TOOLS_PATH/Source/C/bin ]];
|
||||
then
|
||||
# build the tools if they don't yet exist. BinWrapper scheme
|
||||
echo Building tools no $EDK_TOOLS_PATH/Source/C/bin directory
|
||||
make -C $WORKSPACE/BaseTools
|
||||
else
|
||||
echo using prebuilt tools
|
||||
fi
|
||||
|
||||
|
||||
for arg in "$@"
|
||||
do
|
||||
if [[ $arg == run ]]; then
|
||||
case `uname` in
|
||||
Darwin*)
|
||||
#
|
||||
# On Darwin we can't use dlopen, so we have to load the real PE/COFF images.
|
||||
# This .gdbinit script sets a breakpoint that loads symbols for the PE/COFFEE
|
||||
# images that get loaded in SecMain
|
||||
#
|
||||
cp $WORKSPACE/EmulatorPkg/Unix/.gdbinit $WORKSPACE/Build/EmuUnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
|
||||
;;
|
||||
esac
|
||||
|
||||
/usr/bin/gdb $BUILD_ROOT_ARCH/SecMain -q -cd=$BUILD_ROOT_ARCH -x $WORKSPACE/EmulatorPkg/Unix/GdbRun
|
||||
exit
|
||||
fi
|
||||
|
||||
if [[ $arg == cleanall ]]; then
|
||||
make -C $WORKSPACE/BaseTools clean
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
|
||||
build -p $WORKSPACE/ShellPkg/ShellPkg.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [[ $arg == clean ]]; then
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $TARGET_TOOLS -D SEC_ONLY -n 3 clean
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS -n 3 clean
|
||||
exit $?
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Build the edk2 UnixPkg
|
||||
#
|
||||
if [[ $TARGET_TOOLS == $UNIXPKG_TOOLS ]]; then
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS -D UNIX_SEC_BUILD $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
|
||||
else
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $TARGET_TOOLS -D UNIX_SEC_BUILD -D SKIP_MAIN_BUILD -n 3 $1 $2 $3 $4 $5 $6 $7 $8 modules
|
||||
build -p $WORKSPACE/EmulatorPkg/Unix/UnixX64.dsc -a X64 -t $UNIXPKG_TOOLS $NETWORK_SUPPORT $BUILD_NEW_SHELL $BUILD_FAT -n 3 $1 $2 $3 $4 $5 $6 $7 $8
|
||||
cp $WORKSPACE/Build/EmuUnixX64/DEBUG_"$TARGET_TOOLS"/X64/SecMain $WORKSPACE/Build/EmuUnixX64/DEBUG_"$UNIXPKG_TOOLS"/X64
|
||||
fi
|
||||
exit $?
|
||||
|
Reference in New Issue
Block a user