diff options
Diffstat (limited to 'EmulatorPkg/Unix')
-rw-r--r-- | EmulatorPkg/Unix/GdbRun | 4 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c | 70 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/BlockIo.c | 98 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/EmuThunk.c | 72 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/Gasket.h | 78 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/Ia32/Gasket.S | 286 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/Ia32/SwitchStack.c | 6 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/LinuxPacketFilter.c | 50 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/MemoryAllocationLib.c | 14 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/PosixFileSystem.c | 78 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/Pthreads.c | 52 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/SecMain.c | 90 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/SecMain.h | 18 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/SecMain.inf | 2 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/X11GraphicsWindow.c | 238 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/X64/Gasket.S | 384 | ||||
-rw-r--r-- | EmulatorPkg/Unix/Host/X64/SwitchStack.S | 8 | ||||
-rw-r--r-- | EmulatorPkg/Unix/UnixX64.dsc | 26 | ||||
-rw-r--r-- | EmulatorPkg/Unix/UnixX64.fdf | 38 |
19 files changed, 806 insertions, 806 deletions
diff --git a/EmulatorPkg/Unix/GdbRun b/EmulatorPkg/Unix/GdbRun index 428e655631..14a398d62a 100644 --- a/EmulatorPkg/Unix/GdbRun +++ b/EmulatorPkg/Unix/GdbRun @@ -68,9 +68,9 @@ define RemoveFirmwareSymbolFile end if gInXcode == 1 - # in Xcode the program is already runing. Issuing a run command + # 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. + # is used to source this script sets gInCode to 1. else # # Start the program running diff --git a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c b/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c index 519d394e37..b94da9ee82 100644 --- a/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c +++ b/EmulatorPkg/Unix/Host/BerkeleyPacketFilter.c @@ -1,19 +1,19 @@ /**@file
- Berkeley Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
+ Berkeley Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
emulator to get on real networks.
- Tested on Mac OS X.
+ Tested on Mac OS X.
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.
+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.
**/
@@ -87,7 +87,7 @@ EmuSnpCreateMapping ( Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
Private->Mode = Mode;
-
+
//
// Set the broadcast address.
//
@@ -164,11 +164,11 @@ OpenBpfFileDescriptor ( if (errno == EACCES) {
printf (
"SNP: Permissions on '%s' are incorrect. Fix with 'sudo chmod 666 %s'.\n",
- BfpDeviceName,
- BfpDeviceName
+ BfpDeviceName,
+ BfpDeviceName
);
}
-
+
if (errno != EBUSY) {
break;
}
@@ -234,7 +234,7 @@ EmuSnpStart ( if (ioctl (Private->BpfFd, BIOCGBLEN, &ReadBufferSize) < 0) {
goto DeviceErrorExit;
}
-
+
//
// Default value from BIOCGBLEN is usually too small, so use a much larger size, if necessary.
//
@@ -244,7 +244,7 @@ EmuSnpStart ( goto DeviceErrorExit;
}
}
-
+
//
// Associate our interface with this BPF file descriptor.
//
@@ -302,7 +302,7 @@ EmuSnpStart ( if ( FilterProgram == NULL ) {
goto ErrorExit;
}
-
+
CopyMem (FilterProgram, &mFilterInstructionTemplate, sizeof (mFilterInstructionTemplate));
//
@@ -330,7 +330,7 @@ EmuSnpStart ( }
- Private->Mode->State = EfiSimpleNetworkStarted;
+ Private->Mode->State = EfiSimpleNetworkStarted;
}
return Status;
@@ -397,8 +397,8 @@ EmuSnpStop ( /**
- Resets a network adapter and allocates the transmit and receive buffers
- required by the network interface; optionally, also requests allocation
+ 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.
@@ -457,8 +457,8 @@ EmuSnpInitialize ( /**
- Resets a network adapter and re-initializes it with the parameters that were
- provided in the previous call to Initialize().
+ 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
@@ -500,7 +500,7 @@ EmuSnpReset ( /**
- Resets a network adapter and leaves it in a state that is safe for
+ Resets a network adapter and leaves it in a state that is safe for
another driver to initialize.
@param This Protocol instance pointer.
@@ -701,7 +701,7 @@ EmuSnpMCastIpToMac ( /**
- Performs read and write operations on the NVRAM device attached to a
+ Performs read and write operations on the NVRAM device attached to a
network interface.
@param This The protocol instance pointer.
@@ -737,7 +737,7 @@ EmuSnpNvData ( }
/**
- Reads the current interrupt status and recycled transmit buffer status from
+ Reads the current interrupt status and recycled transmit buffer status from
a network interface.
@param This The protocol instance pointer.
@@ -810,7 +810,7 @@ EmuSnpGetStatus ( @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_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.
@@ -857,7 +857,7 @@ EmuSnpTransmit ( if (write (Private->BpfFd, Buffer, BufferSize) < 0) {
return EFI_DEVICE_ERROR;
}
-
+
return EFI_SUCCESS;
}
@@ -917,13 +917,13 @@ EmuSnpReceive ( }
ZeroMem (&BpfStats, sizeof( BpfStats));
-
+
if (ioctl (Private->BpfFd, BIOCGSTATS, &BpfStats) == 0) {
Private->ReceivedPackets += BpfStats.bs_recv;
if (BpfStats.bs_drop > Private->DroppedPackets) {
printf (
"SNP: STATS: RCVD = %d DROPPED = %d. Probably need to increase BPF PcdNetworkPacketFilterSize?\n",
- BpfStats.bs_recv,
+ BpfStats.bs_recv,
BpfStats.bs_drop - Private->DroppedPackets
);
Private->DroppedPackets = BpfStats.bs_drop;
@@ -1053,26 +1053,26 @@ EmuSnpThunkOpen ( )
{
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));
GetInterfaceMacAddr (Private);
-
+
This->Interface = &Private->EmuSnp;
This->Private = Private;
return EFI_SUCCESS;
@@ -1089,10 +1089,10 @@ EmuSnpThunkClose ( if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
return EFI_UNSUPPORTED;
}
-
+
Private = This->Private;
free (Private);
-
+
return EFI_SUCCESS;
}
diff --git a/EmulatorPkg/Unix/Host/BlockIo.c b/EmulatorPkg/Unix/Host/BlockIo.c index bb2da24d85..657ce34e45 100644 --- a/EmulatorPkg/Unix/Host/BlockIo.c +++ b/EmulatorPkg/Unix/Host/BlockIo.c @@ -1,13 +1,13 @@ /**@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.
+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.
**/
@@ -69,7 +69,7 @@ SetFilePointer64 ( res = lseek (Private->fd, offset, (int)MoveMethod);
if (res == -1) {
Status = EFI_INVALID_PARAMETER;
- }
+ }
if (NewFilePointer != NULL) {
*NewFilePointer = res;
@@ -123,13 +123,13 @@ EmuBlockIoOpenDevice ( 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;
}
@@ -141,13 +141,13 @@ EmuBlockIoOpenDevice ( Private->Media->LastBlock = Private->NumberOfBlocks - 1;
}
}
- ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
+ ioctl (Private->fd, DKIOCGETMAXBLOCKCOUNTWRITE, &Private->Media->OptimalTransferLengthGranularity);
}
-#else
+#else
{
size_t BlockSize;
UINT64 DiskSize;
-
+
if (ioctl (Private->fd, BLKSSZGET, &BlockSize) == 0) {
Private->Media->BlockSize = BlockSize;
}
@@ -157,12 +157,12 @@ EmuBlockIoOpenDevice ( }
}
#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;
@@ -170,7 +170,7 @@ EmuBlockIoOpenDevice ( Private->Media->OptimalTransferLengthGranularity = buf.f_bsize/buf.f_bsize;
#endif
}
- }
+ }
DEBUG ((EFI_D_INIT, "%HEmuOpenBlock: opened %a%N\n", Private->Filename));
Status = EFI_SUCCESS;
@@ -198,7 +198,7 @@ EmuBlockIoCreateMapping ( Private = EMU_BLOCK_IO_PRIVATE_DATA_FROM_THIS (This);
Private->Media = Media;
-
+
Media->MediaId = 0;
Media->RemovableMedia = Private->RemovableMedia;
Media->MediaPresent = TRUE;
@@ -207,18 +207,18 @@ EmuBlockIoCreateMapping ( Media->WriteCaching = FALSE;
Media->IoAlign = 1;
Media->LastBlock = 0; // Filled in by OpenDevice
-
+
// EFI_BLOCK_IO_PROTOCOL_REVISION2
Media->LowestAlignedLba = 0;
- Media->LogicalBlocksPerPhysicalBlock = 0;
-
+ Media->LogicalBlocksPerPhysicalBlock = 0;
+
// EFI_BLOCK_IO_PROTOCOL_REVISION3
Media->OptimalTransferLengthGranularity = 0;
-
+
Status = EmuBlockIoOpenDevice (Private);
-
+
return Status;
}
@@ -299,7 +299,7 @@ EmuBlockIoReadWriteCommon ( if ((UINTN) Buffer % Private->Media->IoAlign != 0) {
return EFI_INVALID_PARAMETER;
}
-
+
//
// Verify buffer size
//
@@ -336,7 +336,7 @@ EmuBlockIoReadWriteCommon ( /**
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
@@ -344,13 +344,13 @@ EmuBlockIoReadWriteCommon ( 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
+ @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
+ @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
@@ -362,7 +362,7 @@ EmuBlockIoReadWriteCommon ( @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,
+ @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.
@@ -438,7 +438,7 @@ Done: @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,
+ @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.
@@ -495,10 +495,10 @@ Done: /**
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.
+ 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
@@ -531,8 +531,8 @@ EmuBlockIoFlushBlocks ( fcntl (Private->fd, F_FULLFSYNC);
#endif
}
-
-
+
+
if (Token != NULL) {
if (Token->Event != NULL) {
// Caller is responcible for signaling EFI Event
@@ -540,7 +540,7 @@ EmuBlockIoFlushBlocks ( return EFI_SUCCESS;
}
}
-
+
return EFI_SUCCESS;
}
@@ -585,18 +585,18 @@ StdDupUnicodeToAscii ( 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;
}
@@ -616,32 +616,32 @@ EmuBlockIoThunkOpen ( {
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;
@@ -660,7 +660,7 @@ EmuBlockIoThunkOpen ( }
}
}
-
+
This->Interface = &Private->EmuBlockIo;
This->Private = Private;
return EFI_SUCCESS;
@@ -677,17 +677,17 @@ EmuBlockIoThunkClose ( 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;
}
diff --git a/EmulatorPkg/Unix/Host/EmuThunk.c b/EmulatorPkg/Unix/Host/EmuThunk.c index fe68603d3f..d9816298d4 100644 --- a/EmulatorPkg/Unix/Host/EmuThunk.c +++ b/EmulatorPkg/Unix/Host/EmuThunk.c @@ -1,5 +1,5 @@ /*++ @file - Since the SEC is the only program in our emulation we + 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. @@ -11,13 +11,13 @@ 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. +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. **/ @@ -48,9 +48,9 @@ SecWriteStdErr ( ) { ssize_t Return; - + Return = write (STDERR_FILENO, (const void *)Buffer, (size_t)NumberOfBytes); - + return (Return == -1) ? 0 : Return; } @@ -61,16 +61,16 @@ SecConfigStdIn ( ) { 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; } @@ -82,9 +82,9 @@ SecWriteStdOut ( ) { ssize_t Return; - + Return = write (STDOUT_FILENO, (const void *)Buffer, (size_t)NumberOfBytes); - + return (Return == -1) ? 0 : Return; } @@ -95,9 +95,9 @@ SecReadStdIn ( ) { ssize_t Return; - + Return = read (STDIN_FILENO, Buffer, (size_t)NumberOfBytes); - + return (Return == -1) ? 0 : Return; } @@ -108,12 +108,12 @@ SecPollStdIn ( { int Result; int Bytes; - + Result = ioctl (STDIN_FILENO, FIONREAD, &Bytes); if (Result == -1) { return FALSE; } - + return (BOOLEAN)(Bytes > 0); } @@ -144,7 +144,7 @@ SecFree ( // So don't free those ranges and let the caller know. return FALSE; } - + free (Ptr); return TRUE; } @@ -158,10 +158,10 @@ settimer_handler (int sig) gettimeofday (&timeval, NULL); delta = ((UINT64)timeval.tv_sec * 1000) + (timeval.tv_usec / 1000) - - ((UINT64)settimer_timeval.tv_sec * 1000) + - ((UINT64)settimer_timeval.tv_sec * 1000) - (settimer_timeval.tv_usec / 1000); settimer_timeval = timeval; - + if (settimer_callback) { ReverseGasketUint64 (settimer_callback, delta); } @@ -196,7 +196,7 @@ SecSetTimer ( 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)); } @@ -212,7 +212,7 @@ SecEnableInterrupt ( sigset_t sigset; gEmulatorInterruptEnabled = TRUE; - // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts + // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts // by enabling/disabling SIGALRM. sigemptyset (&sigset); sigaddset (&sigset, SIGALRM); @@ -227,7 +227,7 @@ SecDisableInterrupt ( { sigset_t sigset; - // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts + // Since SetTimer() uses SIGALRM we emulate turning on and off interrupts // by enabling/disabling SIGALRM. sigemptyset (&sigset); sigaddset (&sigset, SIGALRM); @@ -262,11 +262,11 @@ QueryPerformanceCounter ( 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 + // 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); @@ -276,7 +276,7 @@ QueryPerformanceCounter ( return 0; #endif } - + VOID @@ -287,12 +287,12 @@ SecSleep ( 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. + // 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); @@ -314,7 +314,7 @@ SecSleep ( break; } rq = rm; - } + } } @@ -328,7 +328,7 @@ SecCpuSleep ( // nanosleep gets interrupted by the timer tic rq.tv_sec = 1; rq.tv_nsec = 0; - + nanosleep (&rq, &rm); } @@ -364,7 +364,7 @@ SecGetTime ( 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; @@ -414,9 +414,9 @@ EMU_THUNK_PROTOCOL gEmuThunkProtocol = { GasketSecSleep, GasketSecCpuSleep, GasketSecExit, - GasketSecGetTime, + GasketSecGetTime, GasketSecSetTime, - GasketSecSetTimer, + GasketSecSetTimer, GasketSecGetNextProtocol }; diff --git a/EmulatorPkg/Unix/Host/Gasket.h b/EmulatorPkg/Unix/Host/Gasket.h index 2c59a562e6..f1cf4c7ef4 100644 --- a/EmulatorPkg/Unix/Host/Gasket.h +++ b/EmulatorPkg/Unix/Host/Gasket.h @@ -39,7 +39,7 @@ GasketSecWriteStdOut ( IN UINT8 *Buffer,
IN UINTN NumberOfBytes
);
-
+
UINTN
EFIAPI
GasketSecReadStdIn (
@@ -64,7 +64,7 @@ EFIAPI GasketSecValloc (
IN UINTN Size
);
-
+
BOOLEAN
EFIAPI
GasketSecFree (
@@ -109,8 +109,8 @@ EFIAPI GasketSecDisableInterrupt (
VOID
);
-
-UINT64
+
+UINT64
EFIAPI
GasketQueryPerformanceFrequency (
VOID
@@ -128,7 +128,7 @@ EFIAPI GasketSecSleep (
IN UINT64 Nanoseconds
);
-
+
VOID
EFIAPI
GasketSecCpuSleep (
@@ -162,9 +162,9 @@ GasketSecGetNextProtocol ( );
-// PPIs produced by SEC
+// PPIs produced by SEC
+
-
EFI_STATUS
EFIAPI
GasketSecUnixPeiAutoScan (
@@ -172,21 +172,21 @@ GasketSecUnixPeiAutoScan ( 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
);
-
+
//
@@ -244,17 +244,17 @@ GasketX11KeySetState ( EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
EFI_KEY_TOGGLE_STATE *KeyToggleState
);
-
+
EFI_STATUS
-EFIAPI
-GasketX11RegisterKeyNotify (
- IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
+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 (
@@ -270,10 +270,10 @@ GasketX11CheckPointer ( EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo
);
-EFI_STATUS
-EFIAPI
+EFI_STATUS
+EFIAPI
GasketX11GetPointerState (
- EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
+ EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsWindowsIo,
EFI_SIMPLE_POINTER_STATE *state
);
@@ -282,7 +282,7 @@ EFIAPI GasketX11GraphicsWindowOpen (
IN EMU_IO_THUNK_PROTOCOL *This
);
-
+
EFI_STATUS
EFIAPI
GasketX11GraphicsWindowClose (
@@ -295,7 +295,7 @@ UINTN EFIAPI
GasketPthreadMutexLock (
IN VOID *Mutex
- );
+ );
@@ -303,30 +303,30 @@ 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 (
@@ -335,19 +335,19 @@ GasketPthreadCreate ( IN THREAD_THUNK_THREAD_ENTRY Start,
IN VOID *Context
);
-
+
VOID
EFIAPI
GasketPthreadExit (
IN VOID *ValuePtr
- );
+ );
+
-
UINTN
EFIAPI
GasketPthreadSelf (
VOID
- );
+ );
EFI_STATUS
EFIAPI
@@ -370,7 +370,7 @@ GasketPosixOpenVolume ( IN EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
OUT EFI_FILE_PROTOCOL **Root
);
-
+
EFI_STATUS
EFIAPI
GasketPosixFileOpen (
@@ -386,7 +386,7 @@ EFIAPI GasketPosixFileCLose (
IN EFI_FILE_PROTOCOL *This
);
-
+
EFI_STATUS
EFIAPI
GasketPosixFileDelete (
@@ -400,7 +400,7 @@ GasketPosixFileRead ( IN OUT UINTN *BufferSize,
OUT VOID *Buffer
);
-
+
EFI_STATUS
EFIAPI
GasketPosixFileWrite (
@@ -487,14 +487,14 @@ GasketEmuBlockIoWriteBlocks ( 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 (
@@ -532,7 +532,7 @@ GasketSnpCreateMapping ( IN EMU_SNP_PROTOCOL *This,
IN EFI_SIMPLE_NETWORK_MODE *Media
);
-
+
EFI_STATUS
EFIAPI
GasketSnpStart (
@@ -645,7 +645,7 @@ GasketSnpReceive ( OUT UINT16 *Protocol OPTIONAL
);
-
+
#endif
diff --git a/EmulatorPkg/Unix/Host/Ia32/Gasket.S b/EmulatorPkg/Unix/Host/Ia32/Gasket.S index aa031ecece..aa90ea8095 100644 --- a/EmulatorPkg/Unix/Host/Ia32/Gasket.S +++ b/EmulatorPkg/Unix/Host/Ia32/Gasket.S @@ -3,8 +3,8 @@ # Manage differenced between UNIX ABI and EFI/Windows ABI # # For IA-32 the only difference is Mac OS X requires a 16-byte aligned stack. -# For Linux this stack adjustment is a no-op, but we may as well make the -# the code common. +# For Linux this stack adjustment is a no-op, but we may as well make the +# the code common. # # Copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR> # This program and the accompanying materials @@ -16,17 +16,17 @@ # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # #------------------------------------------------------------------------------ - + .text - + // // EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI) // -ASM_GLOBAL ASM_PFX(GasketSecWriteStdErr) +ASM_GLOBAL ASM_PFX(GasketSecWriteStdErr) ASM_PFX(GasketSecWriteStdErr): pushl %ebp movl %esp, %ebp @@ -43,7 +43,7 @@ ASM_PFX(GasketSecWriteStdErr): ret -ASM_GLOBAL ASM_PFX(GasketSecConfigStdIn) +ASM_GLOBAL ASM_PFX(GasketSecConfigStdIn) ASM_PFX(GasketSecConfigStdIn): pushl %ebp movl %esp, %ebp @@ -55,11 +55,11 @@ ASM_PFX(GasketSecConfigStdIn): movl %eax, (%esp) call ASM_PFX(SecConfigStdIn) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecWriteStdOut) +ASM_GLOBAL ASM_PFX(GasketSecWriteStdOut) ASM_PFX(GasketSecWriteStdOut): pushl %ebp movl %esp, %ebp @@ -71,11 +71,11 @@ ASM_PFX(GasketSecWriteStdOut): movl %eax, (%esp) call ASM_PFX(SecWriteStdOut) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecReadStdIn) +ASM_GLOBAL ASM_PFX(GasketSecReadStdIn) ASM_PFX(GasketSecReadStdIn): pushl %ebp movl %esp, %ebp @@ -87,11 +87,11 @@ ASM_PFX(GasketSecReadStdIn): movl %eax, (%esp) call ASM_PFX(SecReadStdIn) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecPollStdIn) +ASM_GLOBAL ASM_PFX(GasketSecPollStdIn) ASM_PFX(GasketSecPollStdIn): pushl %ebp movl %esp, %ebp @@ -103,11 +103,11 @@ ASM_PFX(GasketSecPollStdIn): movl %eax, (%esp) call ASM_PFX(SecPollStdIn) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecMalloc) +ASM_GLOBAL ASM_PFX(GasketSecMalloc) ASM_PFX(GasketSecMalloc): pushl %ebp movl %esp, %ebp @@ -117,11 +117,11 @@ ASM_PFX(GasketSecMalloc): movl %eax, (%esp) call ASM_PFX(SecMalloc) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecValloc) +ASM_GLOBAL ASM_PFX(GasketSecValloc) ASM_PFX(GasketSecValloc): pushl %ebp movl %esp, %ebp @@ -131,11 +131,11 @@ ASM_PFX(GasketSecValloc): movl %eax, (%esp) call ASM_PFX(SecValloc) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecFree) +ASM_GLOBAL ASM_PFX(GasketSecFree) ASM_PFX(GasketSecFree): pushl %ebp movl %esp, %ebp @@ -145,12 +145,12 @@ ASM_PFX(GasketSecFree): movl %eax, (%esp) call ASM_PFX(SecFree) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecSetTimer) +ASM_GLOBAL ASM_PFX(GasketSecSetTimer) ASM_PFX(GasketSecSetTimer): pushl %ebp movl %esp, %ebp @@ -164,12 +164,12 @@ ASM_PFX(GasketSecSetTimer): movl %eax, (%esp) call ASM_PFX(SecSetTimer) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecEnableInterrupt) +ASM_GLOBAL ASM_PFX(GasketSecEnableInterrupt) ASM_PFX(GasketSecEnableInterrupt): pushl %ebp movl %esp, %ebp @@ -177,12 +177,12 @@ ASM_PFX(GasketSecEnableInterrupt): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(SecEnableInterrupt) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecDisableInterrupt) +ASM_GLOBAL ASM_PFX(GasketSecDisableInterrupt) ASM_PFX(GasketSecDisableInterrupt): pushl %ebp movl %esp, %ebp @@ -190,11 +190,11 @@ ASM_PFX(GasketSecDisableInterrupt): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(SecDisableInterrupt) - + leave ret -ASM_GLOBAL ASM_PFX(GasketQueryPerformanceFrequency) +ASM_GLOBAL ASM_PFX(GasketQueryPerformanceFrequency) ASM_PFX(GasketQueryPerformanceFrequency): pushl %ebp movl %esp, %ebp @@ -202,12 +202,12 @@ ASM_PFX(GasketQueryPerformanceFrequency): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(QueryPerformanceFrequency) - + leave ret -ASM_GLOBAL ASM_PFX(GasketQueryPerformanceCounter) +ASM_GLOBAL ASM_PFX(GasketQueryPerformanceCounter) ASM_PFX(GasketQueryPerformanceCounter): pushl %ebp movl %esp, %ebp @@ -215,12 +215,12 @@ ASM_PFX(GasketQueryPerformanceCounter): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(QueryPerformanceCounter) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecSleep) +ASM_GLOBAL ASM_PFX(GasketSecSleep) ASM_PFX(GasketSecSleep): pushl %ebp movl %esp, %ebp @@ -232,12 +232,12 @@ ASM_PFX(GasketSecSleep): movl %eax, (%esp) call ASM_PFX(SecSleep) - + leave ret - - -ASM_GLOBAL ASM_PFX(GasketSecCpuSleep) + + +ASM_GLOBAL ASM_PFX(GasketSecCpuSleep) ASM_PFX(GasketSecCpuSleep): pushl %ebp movl %esp, %ebp @@ -245,12 +245,12 @@ ASM_PFX(GasketSecCpuSleep): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(SecCpuSleep) - + leave ret - - -ASM_GLOBAL ASM_PFX(GasketSecExit) + + +ASM_GLOBAL ASM_PFX(GasketSecExit) ASM_PFX(GasketSecExit): pushl %ebp movl %esp, %ebp @@ -263,8 +263,8 @@ ASM_PFX(GasketSecExit): LDEAD_LOOP: jmp LDEAD_LOOP // _exit should never return - -ASM_GLOBAL ASM_PFX(GasketSecGetTime) + +ASM_GLOBAL ASM_PFX(GasketSecGetTime) ASM_PFX(GasketSecGetTime): pushl %ebp movl %esp, %ebp @@ -280,7 +280,7 @@ ASM_PFX(GasketSecGetTime): leave ret -ASM_GLOBAL ASM_PFX(GasketSecSetTime) +ASM_GLOBAL ASM_PFX(GasketSecSetTime) ASM_PFX(GasketSecSetTime): pushl %ebp movl %esp, %ebp @@ -297,7 +297,7 @@ ASM_PFX(GasketSecSetTime): ret -ASM_GLOBAL ASM_PFX(GasketSecGetNextProtocol) +ASM_GLOBAL ASM_PFX(GasketSecGetNextProtocol) ASM_PFX(GasketSecGetNextProtocol): pushl %ebp movl %esp, %ebp @@ -313,13 +313,13 @@ ASM_PFX(GasketSecGetNextProtocol): movl %eax, (%esp) call ASM_PFX(SecGetNextProtocol) - + leave ret // PPIs produced by SEC -ASM_GLOBAL ASM_PFX(GasketSecPeCoffGetEntryPoint) +ASM_GLOBAL ASM_PFX(GasketSecPeCoffGetEntryPoint) ASM_PFX(GasketSecPeCoffGetEntryPoint): pushl %ebp movl %esp, %ebp @@ -331,11 +331,11 @@ ASM_PFX(GasketSecPeCoffGetEntryPoint): movl %eax, (%esp) call ASM_PFX(SecPeCoffGetEntryPoint) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketSecPeCoffRelocateImageExtraAction) + +ASM_GLOBAL ASM_PFX(GasketSecPeCoffRelocateImageExtraAction) ASM_PFX(GasketSecPeCoffRelocateImageExtraAction): pushl %ebp movl %esp, %ebp @@ -345,11 +345,11 @@ ASM_PFX(GasketSecPeCoffRelocateImageExtraAction): movl %eax, (%esp) call ASM_PFX(SecPeCoffRelocateImageExtraAction) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketSecPeCoffUnloadImageExtraAction) + +ASM_GLOBAL ASM_PFX(GasketSecPeCoffUnloadImageExtraAction) ASM_PFX(GasketSecPeCoffUnloadImageExtraAction): pushl %ebp movl %esp, %ebp @@ -359,12 +359,12 @@ ASM_PFX(GasketSecPeCoffUnloadImageExtraAction): movl %eax, (%esp) call ASM_PFX(SecPeCoffUnloadImageExtraAction) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress) + +ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress) ASM_PFX(GasketSecEmuThunkAddress): pushl %ebp movl %esp, %ebp @@ -372,7 +372,7 @@ ASM_PFX(GasketSecEmuThunkAddress): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(SecEmuThunkAddress) - + leave ret @@ -380,7 +380,7 @@ ASM_PFX(GasketSecEmuThunkAddress): // Gasket functions for EFI_EMU_UGA_IO_PROTOCOL // -ASM_GLOBAL ASM_PFX(GasketX11Size) +ASM_GLOBAL ASM_PFX(GasketX11Size) ASM_PFX(GasketX11Size): pushl %ebp movl %esp, %ebp @@ -396,12 +396,12 @@ ASM_PFX(GasketX11Size): movl %eax, (%esp) call ASM_PFX(X11Size) - + leave ret -ASM_GLOBAL ASM_PFX(GasketX11CheckKey) +ASM_GLOBAL ASM_PFX(GasketX11CheckKey) ASM_PFX(GasketX11CheckKey): pushl %ebp movl %esp, %ebp @@ -411,11 +411,11 @@ ASM_PFX(GasketX11CheckKey): movl %eax, (%esp) call ASM_PFX(X11CheckKey) - + leave ret -ASM_GLOBAL ASM_PFX(GasketX11GetKey) +ASM_GLOBAL ASM_PFX(GasketX11GetKey) ASM_PFX(GasketX11GetKey): pushl %ebp movl %esp, %ebp @@ -427,12 +427,12 @@ ASM_PFX(GasketX11GetKey): movl %eax, (%esp) call ASM_PFX(X11GetKey) - + leave ret -ASM_GLOBAL ASM_PFX(GasketX11KeySetState) +ASM_GLOBAL ASM_PFX(GasketX11KeySetState) ASM_PFX(GasketX11KeySetState): pushl %ebp movl %esp, %ebp @@ -444,12 +444,12 @@ ASM_PFX(GasketX11KeySetState): movl %eax, (%esp) call ASM_PFX(X11KeySetState) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify) + +ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify) ASM_PFX(GasketX11RegisterKeyNotify): pushl %ebp movl %esp, %ebp @@ -465,12 +465,12 @@ ASM_PFX(GasketX11RegisterKeyNotify): movl %eax, (%esp) call ASM_PFX(X11RegisterKeyNotify) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketX11Blt) + +ASM_GLOBAL ASM_PFX(GasketX11Blt) ASM_PFX(GasketX11Blt): pushl %ebp movl %esp, %ebp @@ -486,12 +486,12 @@ ASM_PFX(GasketX11Blt): movl %eax, (%esp) call ASM_PFX(X11Blt) - + leave ret -ASM_GLOBAL ASM_PFX(GasketX11CheckPointer) +ASM_GLOBAL ASM_PFX(GasketX11CheckPointer) ASM_PFX(GasketX11CheckPointer): pushl %ebp movl %esp, %ebp @@ -501,12 +501,12 @@ ASM_PFX(GasketX11CheckPointer): movl %eax, (%esp) call ASM_PFX(X11CheckPointer) - + leave ret -ASM_GLOBAL ASM_PFX(GasketX11GetPointerState) +ASM_GLOBAL ASM_PFX(GasketX11GetPointerState) ASM_PFX(GasketX11GetPointerState): pushl %ebp movl %esp, %ebp @@ -518,12 +518,12 @@ ASM_PFX(GasketX11GetPointerState): movl %eax, (%esp) call ASM_PFX(X11GetPointerState) - + leave ret -ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowOpen) +ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowOpen) ASM_PFX(GasketX11GraphicsWindowOpen): pushl %ebp movl %esp, %ebp @@ -533,12 +533,12 @@ ASM_PFX(GasketX11GraphicsWindowOpen): movl %eax, (%esp) call ASM_PFX(X11GraphicsWindowOpen) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose) + +ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose) ASM_PFX(GasketX11GraphicsWindowClose): pushl %ebp movl %esp, %ebp @@ -550,14 +550,14 @@ ASM_PFX(GasketX11GraphicsWindowClose): movl %eax, (%esp) call ASM_PFX(X11GraphicsWindowClose) - + leave ret // Pthreads -ASM_GLOBAL ASM_PFX(GasketPthreadMutexLock) +ASM_GLOBAL ASM_PFX(GasketPthreadMutexLock) ASM_PFX(GasketPthreadMutexLock): pushl %ebp movl %esp, %ebp @@ -567,12 +567,12 @@ ASM_PFX(GasketPthreadMutexLock): movl %eax, (%esp) call ASM_PFX(PthreadMutexLock) - + leave ret -ASM_GLOBAL ASM_PFX(GasketPthreadMutexUnLock) +ASM_GLOBAL ASM_PFX(GasketPthreadMutexUnLock) ASM_PFX(GasketPthreadMutexUnLock): pushl %ebp movl %esp, %ebp @@ -582,11 +582,11 @@ ASM_PFX(GasketPthreadMutexUnLock): movl %eax, (%esp) call ASM_PFX(PthreadMutexUnLock) - + leave ret -ASM_GLOBAL ASM_PFX(GasketPthreadMutexTryLock) +ASM_GLOBAL ASM_PFX(GasketPthreadMutexTryLock) ASM_PFX(GasketPthreadMutexTryLock): pushl %ebp movl %esp, %ebp @@ -596,11 +596,11 @@ ASM_PFX(GasketPthreadMutexTryLock): movl %eax, (%esp) call ASM_PFX(PthreadMutexTryLock) - + leave ret -ASM_GLOBAL ASM_PFX(GasketPthreadMutexInit) +ASM_GLOBAL ASM_PFX(GasketPthreadMutexInit) ASM_PFX(GasketPthreadMutexInit): pushl %ebp movl %esp, %ebp @@ -608,13 +608,13 @@ ASM_PFX(GasketPthreadMutexInit): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(PthreadMutexInit) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy) + +ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy) ASM_PFX(GasketPthreadMutexDestroy): pushl %ebp movl %esp, %ebp @@ -624,12 +624,12 @@ ASM_PFX(GasketPthreadMutexDestroy): movl %eax, (%esp) call ASM_PFX(PthreadMutexDestroy) - + leave ret -ASM_GLOBAL ASM_PFX(GasketPthreadCreate) +ASM_GLOBAL ASM_PFX(GasketPthreadCreate) ASM_PFX(GasketPthreadCreate): pushl %ebp movl %esp, %ebp @@ -645,12 +645,12 @@ ASM_PFX(GasketPthreadCreate): movl %eax, (%esp) call ASM_PFX(PthreadCreate) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketPthreadExit) + +ASM_GLOBAL ASM_PFX(GasketPthreadExit) ASM_PFX(GasketPthreadExit): pushl %ebp movl %esp, %ebp @@ -660,13 +660,13 @@ ASM_PFX(GasketPthreadExit): movl %eax, (%esp) call ASM_PFX(PthreadExit) - + leave ret - -ASM_GLOBAL ASM_PFX(GasketPthreadSelf) + +ASM_GLOBAL ASM_PFX(GasketPthreadSelf) ASM_PFX(GasketPthreadSelf): pushl %ebp movl %esp, %ebp @@ -674,12 +674,12 @@ ASM_PFX(GasketPthreadSelf): and $-16, %esp // stack needs to end in 0xFFFFFFF0 before call call ASM_PFX(PthreadSelf) - + leave ret -ASM_GLOBAL ASM_PFX(GasketPthreadOpen) +ASM_GLOBAL ASM_PFX(GasketPthreadOpen) ASM_PFX(GasketPthreadOpen): pushl %ebp movl %esp, %ebp @@ -689,12 +689,12 @@ ASM_PFX(GasketPthreadOpen): movl %eax, (%esp) call ASM_PFX(PthreadOpen) - + leave ret -ASM_GLOBAL ASM_PFX(GasketPthreadClose) +ASM_GLOBAL ASM_PFX(GasketPthreadClose) ASM_PFX(GasketPthreadClose): pushl %ebp movl %esp, %ebp @@ -704,7 +704,7 @@ ASM_PFX(GasketPthreadClose): movl %eax, (%esp) call ASM_PFX(PthreadClose) - + leave ret @@ -761,9 +761,9 @@ ASM_PFX(ReverseGasketUint64Uint64): addl $24, %esp popl %ebp ret - -ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan) + +ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan) ASM_PFX(GasketSecUnixPeiAutoScan): pushl %ebp movl %esp, %ebp @@ -777,12 +777,12 @@ ASM_PFX(GasketSecUnixPeiAutoScan): movl %eax, (%esp) call ASM_PFX(SecUnixPeiAutoScan) - + leave ret -ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress) +ASM_GLOBAL ASM_PFX(GasketSecUnixFdAddress) ASM_PFX(GasketSecUnixFdAddress): pushl %ebp movl %esp, %ebp @@ -805,7 +805,7 @@ ASM_PFX(GasketSecUnixFdAddress): // EmuIoThunk SimpleFileSystem -ASM_GLOBAL ASM_PFX(GasketPosixOpenVolume) +ASM_GLOBAL ASM_PFX(GasketPosixOpenVolume) ASM_PFX(GasketPosixOpenVolume): pushl %ebp movl %esp, %ebp @@ -826,7 +826,7 @@ ASM_PFX(GasketPosixOpenVolume): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileOpen) +ASM_GLOBAL ASM_PFX(GasketPosixFileOpen) ASM_PFX(GasketPosixFileOpen): pushl %ebp movl %esp, %ebp @@ -846,14 +846,14 @@ ASM_PFX(GasketPosixFileOpen): movl %eax, 4(%esp) movl 8(%ebp), %eax movl %eax, (%esp) - + call ASM_PFX(PosixFileOpen) leave ret -ASM_GLOBAL ASM_PFX(GasketPosixFileCLose) +ASM_GLOBAL ASM_PFX(GasketPosixFileCLose) ASM_PFX(GasketPosixFileCLose): pushl %ebp movl %esp, %ebp @@ -867,8 +867,8 @@ ASM_PFX(GasketPosixFileCLose): leave ret - -ASM_GLOBAL ASM_PFX(GasketPosixFileDelete) + +ASM_GLOBAL ASM_PFX(GasketPosixFileDelete) ASM_PFX(GasketPosixFileDelete): pushl %ebp movl %esp, %ebp @@ -883,7 +883,7 @@ ASM_PFX(GasketPosixFileDelete): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileRead) +ASM_GLOBAL ASM_PFX(GasketPosixFileRead) ASM_PFX(GasketPosixFileRead): pushl %ebp movl %esp, %ebp @@ -901,8 +901,8 @@ ASM_PFX(GasketPosixFileRead): leave ret - -ASM_GLOBAL ASM_PFX(GasketPosixFileWrite) + +ASM_GLOBAL ASM_PFX(GasketPosixFileWrite) ASM_PFX(GasketPosixFileWrite): pushl %ebp movl %esp, %ebp @@ -921,7 +921,7 @@ ASM_PFX(GasketPosixFileWrite): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileSetPossition) +ASM_GLOBAL ASM_PFX(GasketPosixFileSetPossition) ASM_PFX(GasketPosixFileSetPossition): pushl %ebp movl %esp, %ebp @@ -940,7 +940,7 @@ ASM_PFX(GasketPosixFileSetPossition): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileGetPossition) +ASM_GLOBAL ASM_PFX(GasketPosixFileGetPossition) ASM_PFX(GasketPosixFileGetPossition): pushl %ebp movl %esp, %ebp @@ -957,7 +957,7 @@ ASM_PFX(GasketPosixFileGetPossition): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileGetInfo) +ASM_GLOBAL ASM_PFX(GasketPosixFileGetInfo) ASM_PFX(GasketPosixFileGetInfo): pushl %ebp movl %esp, %ebp @@ -978,7 +978,7 @@ ASM_PFX(GasketPosixFileGetInfo): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileSetInfo) +ASM_GLOBAL ASM_PFX(GasketPosixFileSetInfo) ASM_PFX(GasketPosixFileSetInfo): pushl %ebp movl %esp, %ebp @@ -999,7 +999,7 @@ ASM_PFX(GasketPosixFileSetInfo): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileFlush) +ASM_GLOBAL ASM_PFX(GasketPosixFileFlush) ASM_PFX(GasketPosixFileFlush): pushl %ebp movl %esp, %ebp @@ -1014,7 +1014,7 @@ ASM_PFX(GasketPosixFileFlush): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkOpen) +ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkOpen) ASM_PFX(GasketPosixFileSystmeThunkOpen): pushl %ebp movl %esp, %ebp @@ -1029,7 +1029,7 @@ ASM_PFX(GasketPosixFileSystmeThunkOpen): ret -ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkClose) +ASM_GLOBAL ASM_PFX(GasketPosixFileSystmeThunkClose) ASM_PFX(GasketPosixFileSystmeThunkClose): pushl %ebp movl %esp, %ebp @@ -1043,7 +1043,7 @@ ASM_PFX(GasketPosixFileSystmeThunkClose): leave ret -ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReset) +ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReset) ASM_PFX(GasketEmuBlockIoReset): pushl %ebp movl %esp, %ebp @@ -1060,7 +1060,7 @@ ASM_PFX(GasketEmuBlockIoReset): ret -ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReadBlocks) +ASM_GLOBAL ASM_PFX(GasketEmuBlockIoReadBlocks) ASM_PFX(GasketEmuBlockIoReadBlocks): pushl %ebp movl %esp, %ebp @@ -1087,7 +1087,7 @@ ASM_PFX(GasketEmuBlockIoReadBlocks): ret -ASM_GLOBAL ASM_PFX(GasketEmuBlockIoWriteBlocks) +ASM_GLOBAL ASM_PFX(GasketEmuBlockIoWriteBlocks) ASM_PFX(GasketEmuBlockIoWriteBlocks): pushl %ebp movl %esp, %ebp @@ -1114,7 +1114,7 @@ ASM_PFX(GasketEmuBlockIoWriteBlocks): ret -ASM_GLOBAL ASM_PFX(GasketEmuBlockIoFlushBlocks) +ASM_GLOBAL ASM_PFX(GasketEmuBlockIoFlushBlocks) ASM_PFX(GasketEmuBlockIoFlushBlocks): pushl %ebp movl %esp, %ebp subl $24, %esp // sub extra 16 from the stack for alignment @@ -1131,7 +1131,7 @@ ASM_PFX(GasketEmuBlockIoFlushBlocks): pushl %ebp ret -ASM_GLOBAL ASM_PFX(GasketEmuBlockIoCreateMapping) +ASM_GLOBAL ASM_PFX(GasketEmuBlockIoCreateMapping) ASM_PFX(GasketEmuBlockIoCreateMapping): pushl %ebp movl %esp, %ebp @@ -1148,7 +1148,7 @@ ASM_PFX(GasketEmuBlockIoCreateMapping): ret -ASM_GLOBAL ASM_PFX(GasketBlockIoThunkOpen) +ASM_GLOBAL ASM_PFX(GasketBlockIoThunkOpen) ASM_PFX(GasketBlockIoThunkOpen): pushl %ebp movl %esp, %ebp @@ -1163,7 +1163,7 @@ ASM_PFX(GasketBlockIoThunkOpen): ret -ASM_GLOBAL ASM_PFX(GasketBlockIoThunkClose) +ASM_GLOBAL ASM_PFX(GasketBlockIoThunkClose) ASM_PFX(GasketBlockIoThunkClose): pushl %ebp movl %esp, %ebp @@ -1179,7 +1179,7 @@ ASM_PFX(GasketBlockIoThunkClose): -ASM_GLOBAL ASM_PFX(GasketSnpCreateMapping) +ASM_GLOBAL ASM_PFX(GasketSnpCreateMapping) ASM_PFX(GasketSnpCreateMapping): pushl %ebp movl %esp, %ebp @@ -1196,7 +1196,7 @@ ASM_PFX(GasketSnpCreateMapping): ret -ASM_GLOBAL ASM_PFX(GasketSnpStart) +ASM_GLOBAL ASM_PFX(GasketSnpStart) ASM_PFX(GasketSnpStart): pushl %ebp movl %esp, %ebp @@ -1211,7 +1211,7 @@ ASM_PFX(GasketSnpStart): ret -ASM_GLOBAL ASM_PFX(GasketSnpStop) +ASM_GLOBAL ASM_PFX(GasketSnpStop) ASM_PFX(GasketSnpStop): pushl %ebp movl %esp, %ebp @@ -1226,7 +1226,7 @@ ASM_PFX(GasketSnpStop): ret -ASM_GLOBAL ASM_PFX(GasketSnpInitialize) +ASM_GLOBAL ASM_PFX(GasketSnpInitialize) ASM_PFX(GasketSnpInitialize): pushl %ebp movl %esp, %ebp @@ -1245,7 +1245,7 @@ ASM_PFX(GasketSnpInitialize): ret -ASM_GLOBAL ASM_PFX(GasketSnpReset) +ASM_GLOBAL ASM_PFX(GasketSnpReset) ASM_PFX(GasketSnpReset): pushl %ebp movl %esp, %ebp @@ -1262,7 +1262,7 @@ ASM_PFX(GasketSnpReset): ret -ASM_GLOBAL ASM_PFX(GasketSnpShutdown) +ASM_GLOBAL ASM_PFX(GasketSnpShutdown) ASM_PFX(GasketSnpShutdown): pushl %ebp movl %esp, %ebp @@ -1277,7 +1277,7 @@ ASM_PFX(GasketSnpShutdown): ret -ASM_GLOBAL ASM_PFX(GasketSnpReceiveFilters) +ASM_GLOBAL ASM_PFX(GasketSnpReceiveFilters) ASM_PFX(GasketSnpReceiveFilters): pushl %ebp movl %esp, %ebp @@ -1302,7 +1302,7 @@ ASM_PFX(GasketSnpReceiveFilters): ret -ASM_GLOBAL ASM_PFX(GasketSnpStationAddress) +ASM_GLOBAL ASM_PFX(GasketSnpStationAddress) ASM_PFX(GasketSnpStationAddress): pushl %ebp movl %esp, %ebp @@ -1320,7 +1320,7 @@ ASM_PFX(GasketSnpStationAddress): -ASM_GLOBAL ASM_PFX(GasketSnpStatistics) +ASM_GLOBAL ASM_PFX(GasketSnpStatistics) ASM_PFX(GasketSnpStatistics): pushl %ebp movl %esp, %ebp @@ -1341,7 +1341,7 @@ ASM_PFX(GasketSnpStatistics): ret -ASM_GLOBAL ASM_PFX(GasketSnpMCastIpToMac) +ASM_GLOBAL ASM_PFX(GasketSnpMCastIpToMac) ASM_PFX(GasketSnpMCastIpToMac): pushl %ebp movl %esp, %ebp @@ -1362,7 +1362,7 @@ ASM_PFX(GasketSnpMCastIpToMac): ret -ASM_GLOBAL ASM_PFX(GasketSnpNvData) +ASM_GLOBAL ASM_PFX(GasketSnpNvData) ASM_PFX(GasketSnpNvData): pushl %ebp movl %esp, %ebp @@ -1385,7 +1385,7 @@ ASM_PFX(GasketSnpNvData): ret -ASM_GLOBAL ASM_PFX(GasketSnpGetStatus) +ASM_GLOBAL ASM_PFX(GasketSnpGetStatus) ASM_PFX(GasketSnpGetStatus): pushl %ebp movl %esp, %ebp @@ -1405,7 +1405,7 @@ ASM_PFX(GasketSnpGetStatus): -ASM_GLOBAL ASM_PFX(GasketSnpTransmit) +ASM_GLOBAL ASM_PFX(GasketSnpTransmit) ASM_PFX(GasketSnpTransmit): pushl %ebp movl %esp, %ebp @@ -1433,7 +1433,7 @@ ASM_PFX(GasketSnpTransmit): -ASM_GLOBAL ASM_PFX(GasketSnpReceive) +ASM_GLOBAL ASM_PFX(GasketSnpReceive) ASM_PFX(GasketSnpReceive): pushl %ebp movl %esp, %ebp @@ -1460,7 +1460,7 @@ ASM_PFX(GasketSnpReceive): ret -ASM_GLOBAL ASM_PFX(GasketSnpThunkOpen) +ASM_GLOBAL ASM_PFX(GasketSnpThunkOpen) ASM_PFX(GasketSnpThunkOpen): pushl %ebp movl %esp, %ebp @@ -1475,7 +1475,7 @@ ASM_PFX(GasketSnpThunkOpen): ret -ASM_GLOBAL ASM_PFX(GasketSnpThunkClose) +ASM_GLOBAL ASM_PFX(GasketSnpThunkClose) ASM_PFX(GasketSnpThunkClose): pushl %ebp movl %esp, %ebp diff --git a/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c b/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c index c75073ac2e..1d36500e78 100644 --- a/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c +++ b/EmulatorPkg/Unix/Host/Ia32/SwitchStack.c @@ -46,7 +46,7 @@ PeiSwitchStacks ( ) { BASE_LIBRARY_JUMP_BUFFER JumpBuffer; - + ASSERT (EntryPoint != NULL); ASSERT (NewStack != NULL); @@ -62,12 +62,12 @@ PeiSwitchStacks ( ((VOID**)JumpBuffer.Esp)[2] = Context2; LongJump (&JumpBuffer, (UINTN)-1); - + // // PeiSwitchStacks () will never return // - ASSERT (FALSE); + ASSERT (FALSE); } diff --git a/EmulatorPkg/Unix/Host/LinuxPacketFilter.c b/EmulatorPkg/Unix/Host/LinuxPacketFilter.c index 20a08c9059..41124f72eb 100644 --- a/EmulatorPkg/Unix/Host/LinuxPacketFilter.c +++ b/EmulatorPkg/Unix/Host/LinuxPacketFilter.c @@ -1,20 +1,20 @@ /**@file
- Linux Packet Filter implementation of the EMU_SNP_PROTOCOL that allows the
+ 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.
+ 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.
+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.
**/
@@ -59,7 +59,7 @@ EmuSnpCreateMapping ( Private = EMU_SNP_PRIVATE_DATA_FROM_THIS (This);
Private->Mode = Mode;
-
+
return EFI_SUCCESS;
}
@@ -112,8 +112,8 @@ EmuSnpStop ( }
/**
- Resets a network adapter and allocates the transmit and receive buffers
- required by the network interface; optionally, also requests allocation
+ 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.
@@ -152,8 +152,8 @@ EmuSnpInitialize ( }
/**
- Resets a network adapter and re-initializes it with the parameters that were
- provided in the previous call to Initialize().
+ 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
@@ -181,7 +181,7 @@ EmuSnpReset ( }
/**
- Resets a network adapter and leaves it in a state that is safe for
+ Resets a network adapter and leaves it in a state that is safe for
another driver to initialize.
@param This Protocol instance pointer.
@@ -348,7 +348,7 @@ EmuSnpMCastIpToMac ( }
/**
- Performs read and write operations on the NVRAM device attached to a
+ Performs read and write operations on the NVRAM device attached to a
network interface.
@param This The protocol instance pointer.
@@ -384,7 +384,7 @@ EmuSnpNvData ( }
/**
- Reads the current interrupt status and recycled transmit buffer status from
+ Reads the current interrupt status and recycled transmit buffer status from
a network interface.
@param This The protocol instance pointer.
@@ -448,7 +448,7 @@ EmuSnpGetStatus ( @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_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.
@@ -547,25 +547,25 @@ EmuSnpThunkOpen ( )
{
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;
@@ -582,10 +582,10 @@ EmuSnpThunkClose ( if (!CompareGuid (This->Protocol, &gEmuSnpProtocolGuid)) {
return EFI_UNSUPPORTED;
}
-
+
Private = This->Private;
free (Private);
-
+
return EFI_SUCCESS;
}
diff --git a/EmulatorPkg/Unix/Host/MemoryAllocationLib.c b/EmulatorPkg/Unix/Host/MemoryAllocationLib.c index 76b7271872..9db91b83d9 100644 --- a/EmulatorPkg/Unix/Host/MemoryAllocationLib.c +++ b/EmulatorPkg/Unix/Host/MemoryAllocationLib.c @@ -76,18 +76,18 @@ AllocateZeroPool ( 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 + 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 + @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. @@ -127,7 +127,7 @@ ReallocatePool ( 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(). diff --git a/EmulatorPkg/Unix/Host/PosixFileSystem.c b/EmulatorPkg/Unix/Host/PosixFileSystem.c index 3141a3cf1a..aab7161b7f 100644 --- a/EmulatorPkg/Unix/Host/PosixFileSystem.c +++ b/EmulatorPkg/Unix/Host/PosixFileSystem.c @@ -127,26 +127,26 @@ PosixOpenVolume ( if (PrivateFile == NULL) { goto Done; } - + PrivateFile->FileName = malloc (AsciiStrSize (Private->FilePath)); if (PrivateFile->FileName == NULL) { goto Done; } AsciiStrCpy (PrivateFile->FileName, Private->FilePath); - + PrivateFile->Signature = EMU_EFI_FILE_PRIVATE_SIGNATURE; PrivateFile->Thunk = Private->Thunk; PrivateFile->SimpleFileSystem = This; PrivateFile->IsRootDirectory = TRUE; PrivateFile->IsDirectoryPath = TRUE; PrivateFile->IsOpenedByRead = TRUE; - + CopyMem (&PrivateFile->EfiFile, &gPosixFileProtocol, sizeof (EFI_FILE_PROTOCOL)); PrivateFile->fd = -1; PrivateFile->Dir = NULL; PrivateFile->Dirent = NULL; - + *Root = &PrivateFile->EfiFile; PrivateFile->Dir = opendir (PrivateFile->FileName); @@ -165,10 +165,10 @@ Done: free (PrivateFile); } - + *Root = NULL; } - + return Status; } @@ -179,13 +179,13 @@ ErrnoToEfiStatus () switch (errno) { case EACCES: return EFI_ACCESS_DENIED; - + case EDQUOT: case ENOSPC: return EFI_VOLUME_FULL; - + default: - return EFI_DEVICE_ERROR; + return EFI_DEVICE_ERROR; } } @@ -225,7 +225,7 @@ PosixSystemTimeToEfiTime ( 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); } @@ -382,7 +382,7 @@ PosixFileOpen ( EFI_FILE_INFO *Info; struct stat finfo; int res; - + PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem); @@ -393,7 +393,7 @@ PosixFileOpen ( // BUGBUG: assume an open of root // if current location, return current data // - if ((StrCmp (FileName, L"\\") == 0) || + if ((StrCmp (FileName, L"\\") == 0) || (StrCmp (FileName, L".") == 0 && PrivateFile->IsRootDirectory)) { OpenRoot: Status = PosixOpenVolume (PrivateFile->SimpleFileSystem, &Root); @@ -443,7 +443,7 @@ OpenRoot: Src++; } *Dst = 0; - + // // Get rid of . and .., except leading . or .. @@ -509,7 +509,7 @@ OpenRoot: while (RealFileName > NewPrivateFile->FileName && *RealFileName != '/') { RealFileName--; } - + TempChar = *(RealFileName - 1); *(RealFileName - 1) = 0; *(RealFileName - 1) = TempChar; @@ -601,7 +601,7 @@ OpenRoot: Status = EFI_DEVICE_ERROR; goto Done; } - + Info = malloc (InfoSize); if (Info == NULL) { goto Done; @@ -614,7 +614,7 @@ OpenRoot: Info->Attribute = Attributes; PosixFileSetInfo (&NewPrivateFile->EfiFile, &gEfiFileInfoGuid, InfoSize, Info); - + free (Info); } @@ -682,7 +682,7 @@ PosixFileCLose ( Close and delete the file handle. @param This Protocol instance pointer. - + @retval EFI_SUCCESS The device was opened. @retval EFI_WARN_DELETE_FAILURE The handle was closed but the file was not deleted. @@ -694,7 +694,7 @@ PosixFileDelete ( { EFI_STATUS Status; EMU_EFI_FILE_PRIVATE *PrivateFile; - + PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); Status = EFI_WARN_DELETE_FAILURE; @@ -806,9 +806,9 @@ PosixFileRead ( FullFileName = malloc (AsciiStrLen(PrivateFile->FileName) + 1 + NameSize); if (FullFileName == NULL) { Status = EFI_OUT_OF_RESOURCES; - goto Done; + goto Done; } - + AsciiStrCpy (FullFileName, PrivateFile->FileName); AsciiStrCat (FullFileName, "/"); AsciiStrCat (FullFileName, PrivateFile->Dirent->d_name); @@ -875,7 +875,7 @@ PosixFileWrite ( if (Res == (UINTN)-1) { return ErrnoToEfiStatus (); } - + *BufferSize = Res; return EFI_SUCCESS; } @@ -887,7 +887,7 @@ PosixFileWrite ( @param This Protocol instance pointer. @param Position Byte position from the start of the file. - + @retval EFI_SUCCESS Data was written. @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open. @@ -933,7 +933,7 @@ PosixFileSetPossition ( @param This Protocol instance pointer. @param Position Byte position from the start of the file. - + @retval EFI_SUCCESS Data was written. @retval EFI_UNSUPPORTED Seek request for non-zero is not valid on open.. @@ -946,7 +946,7 @@ PosixFileGetPossition ( { EFI_STATUS Status; EMU_EFI_FILE_PRIVATE *PrivateFile; - + PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->IsDirectoryPath) { @@ -1024,7 +1024,7 @@ PosixFileGetInfo ( StrCpy ((CHAR16 *) FileSystemInfoBuffer->VolumeLabel, PrivateRoot->VolumeLabel); *BufferSize = SIZE_OF_EFI_FILE_SYSTEM_INFO + StrSize (PrivateRoot->VolumeLabel); - + } else if (CompareGuid (InformationType, &gEfiFileSystemVolumeLabelInfoIdGuid)) { if (*BufferSize < StrSize (PrivateRoot->VolumeLabel)) { *BufferSize = StrSize (PrivateRoot->VolumeLabel); @@ -1087,7 +1087,7 @@ PosixFileSetInfo ( CHAR16 *UnicodeFilePtr; int UnixStatus; struct utimbuf Utime; - + PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); PrivateRoot = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_DATA_FROM_THIS (PrivateFile->SimpleFileSystem); @@ -1213,7 +1213,7 @@ PosixFileSetInfo ( AsciiFilePtr = NewFileName + AsciiStrLen(NewFileName); if ((AsciiFilePtr[-1] != '/') && (NewFileInfo->FileName[0] != '/')) { // make sure there is a / between Root FilePath and NewFileInfo Filename - AsciiFilePtr[0] = '/'; + AsciiFilePtr[0] = '/'; AsciiFilePtr[1] = '\0'; AsciiFilePtr++; } @@ -1434,7 +1434,7 @@ PosixFileFlush ( { EMU_EFI_FILE_PRIVATE *PrivateFile; - + PrivateFile = EMU_EFI_FILE_PRIVATE_DATA_FROM_THIS (This); if (PrivateFile->IsDirectoryPath) { @@ -1465,15 +1465,15 @@ PosixFileSystmeThunkOpen ( { EMU_SIMPLE_FILE_SYSTEM_PRIVATE *Private; UINTN i; - + if (This->Private != NULL) { return EFI_ALREADY_STARTED; } - + if (!CompareGuid (This->Protocol, &gEfiSimpleFileSystemProtocolGuid)) { return EFI_UNSUPPORTED; } - + Private = malloc (sizeof (EMU_SIMPLE_FILE_SYSTEM_PRIVATE)); if (Private == NULL) { return EFI_OUT_OF_RESOURCES; @@ -1482,9 +1482,9 @@ PosixFileSystmeThunkOpen ( Private->FilePath = malloc (StrLen (This->ConfigString) + 1); if (Private->FilePath == NULL) { free (Private); - return EFI_OUT_OF_RESOURCES; + return EFI_OUT_OF_RESOURCES; } - + // Convert Unicode to Ascii for (i = 0; This->ConfigString[i] != 0; i++) { Private->FilePath[i] = This->ConfigString[i]; @@ -1499,12 +1499,12 @@ PosixFileSystmeThunkOpen ( return EFI_OUT_OF_RESOURCES; } StrCpy (Private->VolumeLabel, L"EFI_EMULATED"); - + Private->Signature = EMU_SIMPLE_FILE_SYSTEM_PRIVATE_SIGNATURE; Private->Thunk = This; CopyMem (&Private->SimpleFileSystem, &gPosixFileSystemProtocol, sizeof (Private->SimpleFileSystem)); Private->FileHandlesOpen = FALSE; - + This->Interface = &Private->SimpleFileSystem; This->Private = Private; return EFI_SUCCESS; @@ -1521,9 +1521,9 @@ PosixFileSystmeThunkClose ( if (!CompareGuid (This->Protocol, &gEfiSimpleFileSystemProtocolGuid)) { return EFI_UNSUPPORTED; } - + Private = This->Private; - + if (Private->FileHandlesOpen) { // // Close only supported if all the EFI_FILE_HANDLEs have been closed. @@ -1534,11 +1534,11 @@ PosixFileSystmeThunkClose ( if (This->Private != NULL) { if (Private->VolumeLabel != NULL) { free (Private->VolumeLabel); - } + } free (This->Private); This->Private = NULL; } - + return EFI_SUCCESS; } diff --git a/EmulatorPkg/Unix/Host/Pthreads.c b/EmulatorPkg/Unix/Host/Pthreads.c index b6b6ae8ef5..36d1298651 100644 --- a/EmulatorPkg/Unix/Host/Pthreads.c +++ b/EmulatorPkg/Unix/Host/Pthreads.c @@ -34,17 +34,17 @@ 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); } @@ -57,13 +57,13 @@ PthreadMutexInit ( { 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; } @@ -76,7 +76,7 @@ PthreadMutexDestroy ( if (Mutex != NULL) { return pthread_mutex_destroy ((pthread_mutex_t *)Mutex); } - + return -1; } @@ -98,26 +98,26 @@ SecFakePthreadStart ( { 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); + 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 + // 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 + // 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, @@ -127,8 +127,8 @@ PthreadCreate ( ) { int err; - BOOLEAN EnabledOnEntry; - + BOOLEAN EnabledOnEntry; + // // Threads inherit interrupt state so disable interrupts before we start thread // @@ -138,21 +138,21 @@ PthreadCreate ( } 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; } @@ -162,21 +162,21 @@ 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. + // 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 (); + return (UINTN)pthread_self (); } @@ -201,14 +201,14 @@ PthreadOpen ( // 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; } diff --git a/EmulatorPkg/Unix/Host/SecMain.c b/EmulatorPkg/Unix/Host/SecMain.c index 2806347941..a0af3e4d53 100644 --- a/EmulatorPkg/Unix/Host/SecMain.c +++ b/EmulatorPkg/Unix/Host/SecMain.c @@ -65,7 +65,7 @@ int gInXcode = 0; /*++ Breakpoint target for Xcode project. Set in the Xcode XML - + Xcode breakpoint will 'source SecMain.gdb' gGdbWorkingFileName is set to SecMain.gdb @@ -116,13 +116,13 @@ main ( CHAR16 *FirmwareVolumesStr; UINTN *StackPointer; FILE *GdbTempFile; - + // - // Xcode does not support sourcing gdb scripts directly, so the Xcode XML + // Xcode does not support sourcing gdb scripts directly, so the Xcode XML // has a break point script to source the GdbRun script. // SecGdbConfigBreak (); - + // // If dlopen doesn't work, then we build a gdb script to allow the // symbols to be loaded. @@ -141,7 +141,7 @@ main ( } printf ("\nEDK II UNIX Host Emulation Environment from edk2.sourceforge.net\n"); - + setbuf (stdout, 0); setbuf (stderr, 0); @@ -154,23 +154,23 @@ main ( AddThunkPpi (EFI_PEI_PPI_DESCRIPTOR_PPI, &gEmuThunkPpiGuid, &mSecEmuThunkPpi); SecInitThunkProtocol (); - + // // Emulator Bus Driver Thunks // - AddThunkProtocol (&gX11ThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuGop), TRUE); - AddThunkProtocol (&gPosixFileSystemThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuFileSystem), TRUE); - AddThunkProtocol (&gBlockIoThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuVirtualDisk), TRUE); - AddThunkProtocol (&gSnpThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuNetworkInterface), TRUE); + AddThunkProtocol (&gX11ThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuGop), TRUE); + AddThunkProtocol (&gPosixFileSystemThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuFileSystem), TRUE); + AddThunkProtocol (&gBlockIoThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuVirtualDisk), TRUE); + AddThunkProtocol (&gSnpThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuNetworkInterface), TRUE); // // Emulator other Thunks // - AddThunkProtocol (&gPthreadThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuApCount), FALSE); + AddThunkProtocol (&gPthreadThunkIo, (CHAR16 *)PcdGetPtr (PcdEmuApCount), FALSE); // EmuSecLibConstructor (); - - gPpiList = GetThunkPpiList (); + + gPpiList = GetThunkPpiList (); // // Allocate space for gSystemMemory Array @@ -272,8 +272,8 @@ main ( // FileHandle = NULL; Status = PeiServicesFfsFindNextFile ( - EFI_FV_FILETYPE_SECURITY_CORE, - (EFI_PEI_FV_HANDLE)(UINTN)gFdInfo[Index].Address, + EFI_FV_FILETYPE_SECURITY_CORE, + (EFI_PEI_FV_HANDLE)(UINTN)gFdInfo[Index].Address, &FileHandle ); if (!EFI_ERROR (Status)) { @@ -408,7 +408,7 @@ MapFile ( perror ("MapFile() Failed"); return EFI_DEVICE_ERROR; } - + *Length = (UINT64) FileSize; *BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res; @@ -433,16 +433,16 @@ MapFd0 ( return EFI_NOT_FOUND; } FileSize = lseek (fd, 0, SEEK_END); - + FvSize = FixedPcdGet64 (PcdEmuFlashFvRecoverySize); // Assume start of FD is Recovery FV, and make it write protected res = mmap ( - (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase), - FvSize, - PROT_READ | PROT_EXEC, - MAP_PRIVATE, - fd, + (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase), + FvSize, + PROT_READ | PROT_EXEC, + MAP_PRIVATE, + fd, 0 ); if (res == MAP_FAILED) { @@ -453,11 +453,11 @@ MapFd0 ( // We could not load at the build address, so we need to allow writes munmap (res, FvSize); res = mmap ( - (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase), - FvSize, - PROT_READ | PROT_WRITE | PROT_EXEC, - MAP_PRIVATE, - fd, + (void *)(UINTN)FixedPcdGet64 (PcdEmuFlashFvRecoveryBase), + FvSize, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, + fd, 0 ); if (res == MAP_FAILED) { @@ -466,14 +466,14 @@ MapFd0 ( return EFI_DEVICE_ERROR; } } - + // Map the rest of the FD as read/write res2 = mmap ( - (void *)(UINTN)(FixedPcdGet64 (PcdEmuFlashFvRecoveryBase) + FvSize), - FileSize - FvSize, - PROT_READ | PROT_WRITE | PROT_EXEC, + (void *)(UINTN)(FixedPcdGet64 (PcdEmuFlashFvRecoveryBase) + FvSize), + FileSize - FvSize, + PROT_READ | PROT_WRITE | PROT_EXEC, MAP_SHARED, - fd, + fd, FvSize ); close (fd); @@ -483,7 +483,7 @@ MapFd0 ( } // - // If enabled use the magic page to communicate between modules + // If enabled use the magic page to communicate between modules // This replaces the PI PeiServicesTable pointer mechanism that // deos not work in the emulator. It also allows the removal of // writable globals from SEC, PEI_CORE (libraries), PEIMs @@ -491,11 +491,11 @@ MapFd0 ( EmuMagicPage = (void *)(UINTN)FixedPcdGet64 (PcdPeiServicesTablePage); if (EmuMagicPage != NULL) { res3 = mmap ( - (void *)EmuMagicPage, - 4096, - PROT_READ | PROT_WRITE, + (void *)EmuMagicPage, + 4096, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, - 0, + 0, 0 ); if (res3 != EmuMagicPage) { @@ -503,11 +503,11 @@ MapFd0 ( return EFI_DEVICE_ERROR; } } - + *Length = (UINT64) FileSize; *BaseAddress = (EFI_PHYSICAL_ADDRESS) (UINTN) res; - return EFI_SUCCESS; + return EFI_SUCCESS; } @@ -658,10 +658,10 @@ SecUnixPeiAutoScan ( Routine Description: Check to see if an address range is in the EFI GCD memory map. - - This is all of GCD for system memory passed to DXE Core. FV + + This is all of GCD for system memory passed to DXE Core. FV mapping and other device mapped into system memory are not - inlcuded in the check. + inlcuded in the check. Arguments: Index - Which memory region to use @@ -680,7 +680,7 @@ EfiSystemMemoryRange ( { UINTN Index; EFI_PHYSICAL_ADDRESS MemoryBase; - + MemoryBase = (EFI_PHYSICAL_ADDRESS)(UINTN)MemoryAddress; for (Index = 0; Index < gSystemMemoryCount; Index++) { if ((MemoryBase >= gSystemMemory[Index].Memory) && @@ -688,7 +688,7 @@ EfiSystemMemoryRange ( return TRUE; } } - + return FALSE; } @@ -765,7 +765,7 @@ SecPeCoffGetEntryPoint ( // On Unix a dlopen is done that will change the entry point SecPeCoffRelocateImageExtraAction (&ImageContext); *EntryPoint = (VOID *)(UINTN)ImageContext.EntryPoint; - + return Status; } diff --git a/EmulatorPkg/Unix/Host/SecMain.h b/EmulatorPkg/Unix/Host/SecMain.h index 5cd717818e..aff7c36d79 100644 --- a/EmulatorPkg/Unix/Host/SecMain.h +++ b/EmulatorPkg/Unix/Host/SecMain.h @@ -73,7 +73,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include <termio.h>
#include <sys/vfs.h>
#include <linux/fs.h>
-#endif
+#endif
#include <utime.h>
@@ -126,7 +126,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. #include "Gasket.h"
-#define STACK_SIZE 0x20000
+#define STACK_SIZE 0x20000
typedef struct {
EFI_PHYSICAL_ADDRESS Address;
@@ -150,10 +150,10 @@ typedef struct { EFI_STATUS
EFIAPI
SecUnixPeiLoadFile (
- VOID *Pe32Data,
- EFI_PHYSICAL_ADDRESS *ImageAddress,
- UINT64 *ImageSize,
- EFI_PHYSICAL_ADDRESS *EntryPoint
+ VOID *Pe32Data,
+ EFI_PHYSICAL_ADDRESS *ImageAddress,
+ UINT64 *ImageSize,
+ EFI_PHYSICAL_ADDRESS *EntryPoint
);
int
@@ -268,7 +268,7 @@ SecTemporaryRamSupport ( IN EFI_PHYSICAL_ADDRESS PermanentMemoryBase,
IN UINTN CopySize
);
-
+
EFI_STATUS
EFIAPI
GasketSecTemporaryRamSupport (
@@ -311,8 +311,8 @@ VOID SecInitThunkProtocol (
VOID
);
-
-
+
+
EFI_PHYSICAL_ADDRESS *
MapMemory (
INTN fd,
diff --git a/EmulatorPkg/Unix/Host/SecMain.inf b/EmulatorPkg/Unix/Host/SecMain.inf index 9bda6f8d31..c9ba71dc4e 100644 --- a/EmulatorPkg/Unix/Host/SecMain.inf +++ b/EmulatorPkg/Unix/Host/SecMain.inf @@ -38,7 +38,7 @@ LinuxPacketFilter.c
BerkeleyPacketFilter.c
MemoryAllocationLib.c
-
+
[Sources.X64]
X64/Gasket.S # convert between Emu x86_64 ABI and EFI X64 ABI
X64/SwitchStack.S
diff --git a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c index ddcf1e7675..00d8c58a5b 100644 --- a/EmulatorPkg/Unix/Host/X11GraphicsWindow.c +++ b/EmulatorPkg/Unix/Host/X11GraphicsWindow.c @@ -40,7 +40,7 @@ typedef struct { EMU_GRAPHICS_WINDOW_PROTOCOL GraphicsIo; Display *display; - int screen; // values for window_size in main + int screen; // values for window_size in main Window win; GC gc; Visual *visual; @@ -65,11 +65,11 @@ typedef struct { EFI_KEY_DATA keys[NBR_KEYS]; EFI_KEY_STATE KeyState; - + EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeRegisterdKeyCallback; EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakRegisterdKeyCallback; VOID *RegisterdKeyCallbackContext; - + int previous_x; int previous_y; EFI_SIMPLE_POINTER_STATE pointer_state; @@ -83,7 +83,7 @@ HandleEvents( void fill_shift_mask ( - IN struct uga_drv_shift_mask *sm, + IN struct uga_drv_shift_mask *sm, IN unsigned long mask ) { @@ -134,18 +134,18 @@ TryCreateShmImage ( XDestroyImage(Drv->image); return 0; } - + Drv->image_data = shmat (Drv->xshm_info.shmid, NULL, 0); if(!Drv->image_data) { shmctl (Drv->xshm_info.shmid, IPC_RMID, NULL); XDestroyImage(Drv->image); return 0; } - -#ifndef __APPLE__ + +#ifndef __APPLE__ // // This closes shared memory in real time on OS X. Only closes after folks quit using - // it on Linux. + // it on Linux. // shmctl (Drv->xshm_info.shmid, IPC_RMID, NULL); #endif @@ -164,18 +164,18 @@ TryCreateShmImage ( EFI_STATUS X11Size ( - IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, - IN UINT32 Width, + IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, + IN UINT32 Width, IN UINT32 Height ) { GRAPHICS_IO_PRIVATE *Drv; XSizeHints size_hints; - // Destroy current buffer if created. + // Destroy current buffer if created. Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; if (Drv->image != NULL) { - // Before destroy buffer, need to make sure the buffer available for access. + // Before destroy buffer, need to make sure the buffer available for access. XDestroyImage (Drv->image); if (Drv->use_shm) { @@ -190,7 +190,7 @@ X11Size ( Drv->height = Height; XResizeWindow (Drv->display, Drv->win, Width, Height); - // Allocate image. + // Allocate image. if (XShmQueryExtension(Drv->display) && TryCreateShmImage(Drv)) { Drv->use_shm = 1; } else { @@ -202,7 +202,7 @@ X11Size ( } else { Drv->pixel_shift = 0; } - + Drv->image_data = malloc ((Drv->width * Drv->height) << Drv->pixel_shift); Drv->image = XCreateImage ( Drv->display, Drv->visual, Drv->depth, @@ -211,14 +211,14 @@ X11Size ( 8 << Drv->pixel_shift, 0 ); } - + Drv->line_bytes = Drv->image->bytes_per_line; fill_shift_mask (&Drv->r, Drv->image->red_mask); fill_shift_mask (&Drv->g, Drv->image->green_mask); fill_shift_mask (&Drv->b, Drv->image->blue_mask); - // Set WM hints. + // Set WM hints. size_hints.flags = PSize | PMinSize | PMaxSize; size_hints.min_width = size_hints.max_width = size_hints.base_width = Width; size_hints.min_height = size_hints.max_height = size_hints.base_height = Height; @@ -231,15 +231,15 @@ X11Size ( void handleKeyEvent ( - IN GRAPHICS_IO_PRIVATE *Drv, - IN XEvent *ev, + IN GRAPHICS_IO_PRIVATE *Drv, + IN XEvent *ev, IN BOOLEAN Make ) { KeySym *KeySym; EFI_KEY_DATA KeyData; int KeySymArraySize; - + if (Make) { if (Drv->key_count == NBR_KEYS) { return; @@ -252,16 +252,16 @@ handleKeyEvent ( // // Returns an array of KeySymArraySize of KeySym for the keycode. [0] is lower case, [1] is upper case, // [2] and [3] are based on option and command modifiers. The problem we have is command V - // could be mapped to a crazy Unicode character so the old scheme of returning a string. + // could be mapped to a crazy Unicode character so the old scheme of returning a string. // KeySym = XGetKeyboardMapping (Drv->display, ev->xkey.keycode, 1, &KeySymArraySize); - + KeyData.Key.ScanCode = 0; KeyData.Key.UnicodeChar = 0; KeyData.KeyState.KeyShiftState = 0; // - // Skipping EFI_SCROLL_LOCK_ACTIVE & EFI_NUM_LOCK_ACTIVE since they are not on Macs + // Skipping EFI_SCROLL_LOCK_ACTIVE & EFI_NUM_LOCK_ACTIVE since they are not on Macs // if ((ev->xkey.state & LockMask) == 0) { Drv->KeyState.KeyToggleState &= ~EFI_CAPS_LOCK_ACTIVE; @@ -270,9 +270,9 @@ handleKeyEvent ( Drv->KeyState.KeyToggleState |= EFI_CAPS_LOCK_ACTIVE; } } - + // Skipping EFI_MENU_KEY_PRESSED and EFI_SYS_REQ_PRESSED - + switch (*KeySym) { case XK_Control_R: if (Make) { @@ -282,7 +282,7 @@ handleKeyEvent ( } break; case XK_Control_L: - if (Make) { + if (Make) { Drv->KeyState.KeyShiftState |= EFI_LEFT_CONTROL_PRESSED; } else { Drv->KeyState.KeyShiftState &= ~EFI_LEFT_CONTROL_PRESSED; @@ -303,7 +303,7 @@ handleKeyEvent ( Drv->KeyState.KeyShiftState &= ~EFI_LEFT_SHIFT_PRESSED; } break; - + case XK_Mode_switch: if (Make) { Drv->KeyState.KeyShiftState |= EFI_LEFT_ALT_PRESSED; @@ -326,44 +326,44 @@ handleKeyEvent ( Drv->KeyState.KeyShiftState &= ~EFI_LEFT_LOGO_PRESSED; } break; - + case XK_KP_Home: case XK_Home: KeyData.Key.ScanCode = SCAN_HOME; break; - + case XK_KP_End: case XK_End: KeyData.Key.ScanCode = SCAN_END; break; - - case XK_KP_Left: + + case XK_KP_Left: case XK_Left: KeyData.Key.ScanCode = SCAN_LEFT; break; - + case XK_KP_Right: case XK_Right: KeyData.Key.ScanCode = SCAN_RIGHT; break; - + case XK_KP_Up: case XK_Up: KeyData.Key.ScanCode = SCAN_UP; break; - + case XK_KP_Down: case XK_Down: KeyData.Key.ScanCode = SCAN_DOWN; break; - + case XK_KP_Delete: case XK_Delete: KeyData.Key.ScanCode = SCAN_DELETE; break; - - case XK_KP_Insert: + + case XK_KP_Insert: case XK_Insert: KeyData.Key.ScanCode = SCAN_INSERT; break; - + case XK_KP_Page_Up: case XK_Page_Up: KeyData.Key.ScanCode = SCAN_PAGE_UP; break; - + case XK_KP_Page_Down: case XK_Page_Down: KeyData.Key.ScanCode = SCAN_PAGE_DOWN; break; - + case XK_Escape: KeyData.Key.ScanCode = SCAN_ESC; break; case XK_Pause: KeyData.Key.ScanCode = SCAN_PAUSE; break; case XK_KP_F1: case XK_F1: KeyData.Key.ScanCode = SCAN_F1; break; - + case XK_KP_F2: case XK_F2: KeyData.Key.ScanCode = SCAN_F2; break; @@ -376,18 +376,18 @@ handleKeyEvent ( case XK_F5: KeyData.Key.ScanCode = SCAN_F5; break; case XK_F6: KeyData.Key.ScanCode = SCAN_F6; break; case XK_F7: KeyData.Key.ScanCode = SCAN_F7; break; - + // Don't map into X11 by default on a Mac - // System Preferences->Keyboard->Keyboard Shortcuts can be configured + // System Preferences->Keyboard->Keyboard Shortcuts can be configured // to not use higher function keys as shortcuts and the will show up - // in X11. + // in X11. case XK_F8: KeyData.Key.ScanCode = SCAN_F8; break; case XK_F9: KeyData.Key.ScanCode = SCAN_F9; break; case XK_F10: KeyData.Key.ScanCode = SCAN_F10; break; - + case XK_F11: KeyData.Key.ScanCode = SCAN_F11; break; case XK_F12: KeyData.Key.ScanCode = SCAN_F12; break; - + case XK_F13: KeyData.Key.ScanCode = SCAN_F13; break; case XK_F14: KeyData.Key.ScanCode = SCAN_F14; break; case XK_F15: KeyData.Key.ScanCode = SCAN_F15; break; @@ -402,16 +402,16 @@ handleKeyEvent ( case XK_F24: KeyData.Key.ScanCode = SCAN_F24; break; // No mapping in X11 - //case XK_: KeyData.Key.ScanCode = SCAN_MUTE; break; - //case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_UP; break; - //case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_DOWN; break; - //case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_UP; break; - //case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_DOWN; break; - //case XK_: KeyData.Key.ScanCode = SCAN_SUSPEND; break; - //case XK_: KeyData.Key.ScanCode = SCAN_HIBERNATE; break; - //case XK_: KeyData.Key.ScanCode = SCAN_TOGGLE_DISPLAY; break; - //case XK_: KeyData.Key.ScanCode = SCAN_RECOVERY; break; - //case XK_: KeyData.Key.ScanCode = SCAN_EJECT; break; + //case XK_: KeyData.Key.ScanCode = SCAN_MUTE; break; + //case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_UP; break; + //case XK_: KeyData.Key.ScanCode = SCAN_VOLUME_DOWN; break; + //case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_UP; break; + //case XK_: KeyData.Key.ScanCode = SCAN_BRIGHTNESS_DOWN; break; + //case XK_: KeyData.Key.ScanCode = SCAN_SUSPEND; break; + //case XK_: KeyData.Key.ScanCode = SCAN_HIBERNATE; break; + //case XK_: KeyData.Key.ScanCode = SCAN_TOGGLE_DISPLAY; break; + //case XK_: KeyData.Key.ScanCode = SCAN_RECOVERY; break; + //case XK_: KeyData.Key.ScanCode = SCAN_EJECT; break; case XK_BackSpace: KeyData.Key.UnicodeChar = 0x0008; break; @@ -419,28 +419,28 @@ handleKeyEvent ( case XK_Tab: KeyData.Key.UnicodeChar = 0x0009; break; case XK_Linefeed: KeyData.Key.UnicodeChar = 0x000a; break; - + case XK_KP_Enter: case XK_Return: KeyData.Key.UnicodeChar = 0x000d; break; - case XK_KP_Equal : KeyData.Key.UnicodeChar = L'='; break; - case XK_KP_Multiply : KeyData.Key.UnicodeChar = L'*'; break; - case XK_KP_Add : KeyData.Key.UnicodeChar = L'+'; break; - case XK_KP_Separator : KeyData.Key.UnicodeChar = L'~'; break; - case XK_KP_Subtract : KeyData.Key.UnicodeChar = L'-'; break; - case XK_KP_Decimal : KeyData.Key.UnicodeChar = L'.'; break; - case XK_KP_Divide : KeyData.Key.UnicodeChar = L'/'; break; - - case XK_KP_0 : KeyData.Key.UnicodeChar = L'0'; break; - case XK_KP_1 : KeyData.Key.UnicodeChar = L'1'; break; - case XK_KP_2 : KeyData.Key.UnicodeChar = L'2'; break; - case XK_KP_3 : KeyData.Key.UnicodeChar = L'3'; break; - case XK_KP_4 : KeyData.Key.UnicodeChar = L'4'; break; - case XK_KP_5 : KeyData.Key.UnicodeChar = L'5'; break; - case XK_KP_6 : KeyData.Key.UnicodeChar = L'6'; break; - case XK_KP_7 : KeyData.Key.UnicodeChar = L'7'; break; - case XK_KP_8 : KeyData.Key.UnicodeChar = L'8'; break; - case XK_KP_9 : KeyData.Key.UnicodeChar = L'9'; break; + case XK_KP_Equal : KeyData.Key.UnicodeChar = L'='; break; + case XK_KP_Multiply : KeyData.Key.UnicodeChar = L'*'; break; + case XK_KP_Add : KeyData.Key.UnicodeChar = L'+'; break; + case XK_KP_Separator : KeyData.Key.UnicodeChar = L'~'; break; + case XK_KP_Subtract : KeyData.Key.UnicodeChar = L'-'; break; + case XK_KP_Decimal : KeyData.Key.UnicodeChar = L'.'; break; + case XK_KP_Divide : KeyData.Key.UnicodeChar = L'/'; break; + + case XK_KP_0 : KeyData.Key.UnicodeChar = L'0'; break; + case XK_KP_1 : KeyData.Key.UnicodeChar = L'1'; break; + case XK_KP_2 : KeyData.Key.UnicodeChar = L'2'; break; + case XK_KP_3 : KeyData.Key.UnicodeChar = L'3'; break; + case XK_KP_4 : KeyData.Key.UnicodeChar = L'4'; break; + case XK_KP_5 : KeyData.Key.UnicodeChar = L'5'; break; + case XK_KP_6 : KeyData.Key.UnicodeChar = L'6'; break; + case XK_KP_7 : KeyData.Key.UnicodeChar = L'7'; break; + case XK_KP_8 : KeyData.Key.UnicodeChar = L'8'; break; + case XK_KP_9 : KeyData.Key.UnicodeChar = L'9'; break; default: ; @@ -453,23 +453,23 @@ handleKeyEvent ( if (*KeySym < XK_BackSpace) { if (((Drv->KeyState.KeyShiftState & (EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED)) != 0) || ((Drv->KeyState.KeyToggleState & EFI_CAPS_LOCK_ACTIVE) != 0) ) { - + KeyData.Key.UnicodeChar = (CHAR16)KeySym[KEYSYM_UPPER]; - // Per UEFI spec since we converted the Unicode clear the shift bits we pass up + // Per UEFI spec since we converted the Unicode clear the shift bits we pass up KeyData.KeyState.KeyShiftState &= ~(EFI_LEFT_SHIFT_PRESSED | EFI_RIGHT_SHIFT_PRESSED); } else { KeyData.Key.UnicodeChar = (CHAR16)KeySym[KEYSYM_LOWER]; } } else { - // XK_BackSpace is the start of XK_MISCELLANY. These are the XK_? keys we process in this file - ; + // XK_BackSpace is the start of XK_MISCELLANY. These are the XK_? keys we process in this file + ; } - + if (Make) { memcpy (&Drv->keys[Drv->key_wr], &KeyData, sizeof (EFI_KEY_DATA)); Drv->key_wr = (Drv->key_wr + 1) % NBR_KEYS; - Drv->key_count++; + Drv->key_count++; if (Drv->MakeRegisterdKeyCallback != NULL) { ReverseGasketUint64Uint64 (Drv->MakeRegisterdKeyCallback ,Drv->RegisterdKeyCallbackContext, &KeyData); } @@ -483,7 +483,7 @@ handleKeyEvent ( void handleMouseMoved( - IN GRAPHICS_IO_PRIVATE *Drv, + IN GRAPHICS_IO_PRIVATE *Drv, IN XEvent *ev ) { @@ -504,8 +504,8 @@ handleMouseMoved( void handleMouseDown ( - IN GRAPHICS_IO_PRIVATE *Drv, - IN XEvent *ev, + IN GRAPHICS_IO_PRIVATE *Drv, + IN XEvent *ev, IN BOOLEAN Pressed ) { @@ -521,10 +521,10 @@ handleMouseDown ( void Redraw ( - IN GRAPHICS_IO_PRIVATE *Drv, - IN UINTN X, - IN UINTN Y, - IN UINTN Width, + IN GRAPHICS_IO_PRIVATE *Drv, + IN UINTN X, + IN UINTN Y, + IN UINTN Width, IN UINTN Height ) { @@ -597,7 +597,7 @@ HandleEvents ( unsigned long X11PixelToColor ( - IN GRAPHICS_IO_PRIVATE *Drv, + IN GRAPHICS_IO_PRIVATE *Drv, IN EFI_UGA_PIXEL pixel ) { @@ -608,14 +608,14 @@ X11PixelToColor ( EFI_UGA_PIXEL X11ColorToPixel ( - IN GRAPHICS_IO_PRIVATE *Drv, + IN GRAPHICS_IO_PRIVATE *Drv, IN unsigned long val ) { EFI_UGA_PIXEL Pixel; memset (&Pixel, 0, sizeof (EFI_UGA_PIXEL)); - + // Truncation not an issue since X11 and EFI are both using 8 bits per color Pixel.Red = (val >> Drv->r.shift) << Drv->r.csize; Pixel.Green = (val >> Drv->g.shift) << Drv->g.csize; @@ -631,52 +631,52 @@ X11CheckKey ( ) { GRAPHICS_IO_PRIVATE *Drv; - + Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; - + HandleEvents (Drv); - + if (Drv->key_count != 0) { return EFI_SUCCESS; } - + return EFI_NOT_READY; } EFI_STATUS X11GetKey ( - IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, + IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, IN EFI_KEY_DATA *KeyData ) { EFI_STATUS EfiStatus; GRAPHICS_IO_PRIVATE *Drv; - + Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; EfiStatus = X11CheckKey (GraphicsIo); if (EFI_ERROR (EfiStatus)) { return EfiStatus; } - + CopyMem (KeyData, &Drv->keys[Drv->key_rd], sizeof (EFI_KEY_DATA)); Drv->key_rd = (Drv->key_rd + 1) % NBR_KEYS; Drv->key_count--; - + return EFI_SUCCESS; } EFI_STATUS X11KeySetState ( - IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, + IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, IN EFI_KEY_TOGGLE_STATE *KeyToggleState ) { GRAPHICS_IO_PRIVATE *Drv; - - Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; - + + Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; + if (*KeyToggleState & EFI_CAPS_LOCK_ACTIVE) { if ((Drv->KeyState.KeyToggleState & EFI_CAPS_LOCK_ACTIVE) == 0) { // @@ -685,7 +685,7 @@ X11KeySetState ( // } } - + Drv->KeyState.KeyToggleState = *KeyToggleState; return EFI_SUCCESS; } @@ -693,7 +693,7 @@ X11KeySetState ( EFI_STATUS X11RegisterKeyNotify ( - IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, + IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK MakeCallBack, IN EMU_GRAPHICS_WINDOW_REGISTER_KEY_NOTIFY_CALLBACK BreakCallBack, IN VOID *Context @@ -701,7 +701,7 @@ X11RegisterKeyNotify ( { GRAPHICS_IO_PRIVATE *Drv; - Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; + Drv = (GRAPHICS_IO_PRIVATE *)GraphicsIo; Drv->MakeRegisterdKeyCallback = MakeCallBack; Drv->BreakRegisterdKeyCallback = BreakCallBack; @@ -834,10 +834,10 @@ X11Blt ( case EfiUgaVideoToVideo: XCopyArea( Private->display, Private->win, Private->win, Private->gc, - Args->SourceX, Args->SourceY, Args->Width, Args->Height, + Args->SourceX, Args->SourceY, Args->Width, Args->Height, Args->DestinationX, Args->DestinationY ); - + while (1) { XNextEvent (Private->display, &ev); HandleEvent (Private, &ev); @@ -878,14 +878,14 @@ X11CheckPointer ( if (Drv->pointer_state_changed != 0) { return EFI_SUCCESS; } - + return EFI_NOT_READY; } EFI_STATUS X11GetPointerState ( - IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, + IN EMU_GRAPHICS_WINDOW_PROTOCOL *GraphicsIo, IN EFI_SIMPLE_POINTER_STATE *State ) { @@ -898,7 +898,7 @@ X11GetPointerState ( if (EfiStatus != EFI_SUCCESS) { return EfiStatus; } - + memcpy (State, &Drv->pointer_state, sizeof (EFI_SIMPLE_POINTER_STATE)); Drv->pointer_state.RelativeMovementX = 0; @@ -932,7 +932,7 @@ X11GraphicsWindowOpen ( Drv->GraphicsIo.Blt = GasketX11Blt; Drv->GraphicsIo.CheckPointer = GasketX11CheckPointer; Drv->GraphicsIo.GetPointerState = GasketX11GetPointerState; - + Drv->key_count = 0; Drv->key_rd = 0; @@ -942,8 +942,8 @@ X11GraphicsWindowOpen ( Drv->MakeRegisterdKeyCallback = NULL; Drv->BreakRegisterdKeyCallback = NULL; Drv->RegisterdKeyCallbackContext = NULL; - - + + Drv->display = XOpenDisplay (display_name); if (Drv->display == NULL) { fprintf (stderr, "uga: cannot connect to X server %s\n", XDisplayName (display_name)); @@ -960,16 +960,16 @@ X11GraphicsWindowOpen ( ); Drv->depth = DefaultDepth (Drv->display, Drv->screen); - XDefineCursor (Drv->display, Drv->win, XCreateFontCursor (Drv->display, XC_pirate)); + XDefineCursor (Drv->display, Drv->win, XCreateFontCursor (Drv->display, XC_pirate)); - Drv->Title = malloc (StrSize (This->ConfigString)); + Drv->Title = malloc (StrSize (This->ConfigString)); UnicodeStrToAsciiStr (This->ConfigString, Drv->Title); XStoreName (Drv->display, Drv->win, Drv->Title); // XAutoRepeatOff (Drv->display); XSelectInput ( Drv->display, Drv->win, - ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask + ExposureMask | KeyPressMask | KeyReleaseMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask ); Drv->gc = DefaultGC (Drv->display, Drv->screen); @@ -991,7 +991,7 @@ X11GraphicsWindowClose ( if (Drv == NULL) { return EFI_SUCCESS; } - + if (Drv->image != NULL) { XDestroyImage(Drv->image); @@ -1004,12 +1004,12 @@ X11GraphicsWindowClose ( } XDestroyWindow (Drv->display, Drv->win); XCloseDisplay (Drv->display); - + #ifdef __APPLE__ // Free up the shared memory shmctl (Drv->xshm_info.shmid, IPC_RMID, NULL); #endif - + free (Drv); return EFI_SUCCESS; } diff --git a/EmulatorPkg/Unix/Host/X64/Gasket.S b/EmulatorPkg/Unix/Host/X64/Gasket.S index 7ea49bb422..c339461cd8 100644 --- a/EmulatorPkg/Unix/Host/X64/Gasket.S +++ b/EmulatorPkg/Unix/Host/X64/Gasket.S @@ -27,13 +27,13 @@ // 32 byte shadow to spill rcx-r9, 8 bytes to align stack on 16 byte boundry // Any call with 0 - 4 arguments allocates 40 bytes on the stack. -// For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56, +// For more than 4 args you always have to increase in quanta of 16 so 5 or 6 args is 56, // 7 or 8 args is 72, and 9 or 10 args is 88 .text - + // // EMU_THUNK_PROTOCOL gaskets (EFIAPI to UNIX ABI) // @@ -49,11 +49,11 @@ ASM_PFX(GasketSecWriteStdErr): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecWriteStdErr) - + popq %rdi // restore state popq %rsi popq %rbp @@ -69,7 +69,7 @@ ASM_PFX(GasketSecConfigStdIn): pushq %rdi call ASM_PFX(SecConfigStdIn) - + popq %rdi // restore state popq %rsi popq %rbp @@ -83,11 +83,11 @@ ASM_PFX(GasketSecWriteStdOut): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecWriteStdOut) - + popq %rdi // restore state popq %rsi popq %rbp @@ -101,11 +101,11 @@ ASM_PFX(GasketSecReadStdIn): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecReadStdIn) - + popq %rdi // restore state popq %rsi popq %rbp @@ -120,7 +120,7 @@ ASM_PFX(GasketSecPollStdIn): pushq %rdi call ASM_PFX(SecPollStdIn) - + popq %rdi // restore state popq %rsi popq %rbp @@ -134,10 +134,10 @@ ASM_PFX(GasketSecMalloc): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecMalloc) - + popq %rdi // restore state popq %rsi popq %rbp @@ -151,10 +151,10 @@ ASM_PFX(GasketSecValloc): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecValloc) - + popq %rdi // restore state popq %rsi popq %rbp @@ -168,10 +168,10 @@ ASM_PFX(GasketSecFree): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecFree) - + popq %rdi // restore state popq %rsi popq %rbp @@ -186,11 +186,11 @@ ASM_PFX(GasketSecSetTimer): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecSetTimer) - + popq %rdi // restore state popq %rsi popq %rbp @@ -206,7 +206,7 @@ ASM_PFX(GasketSecEnableInterrupt): pushq %rdi call ASM_PFX(SecEnableInterrupt) - + popq %rdi // restore state popq %rsi popq %rbp @@ -222,7 +222,7 @@ ASM_PFX(GasketSecDisableInterrupt): pushq %rdi call ASM_PFX(SecDisableInterrupt) - + popq %rdi // restore state popq %rsi popq %rbp @@ -237,7 +237,7 @@ ASM_PFX(GasketQueryPerformanceFrequency): pushq %rdi call ASM_PFX(QueryPerformanceFrequency) - + popq %rdi // restore state popq %rsi popq %rbp @@ -253,7 +253,7 @@ ASM_PFX(GasketQueryPerformanceCounter): pushq %rdi call ASM_PFX(QueryPerformanceCounter) - + popq %rdi // restore state popq %rsi popq %rbp @@ -268,16 +268,16 @@ ASM_PFX(GasketSecSleep): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecSleep) - + popq %rdi // restore state popq %rsi popq %rbp ret - - + + ASM_GLOBAL ASM_PFX(GasketSecCpuSleep) ASM_PFX(GasketSecCpuSleep): pushq %rbp // stack frame is for the debugger @@ -287,24 +287,24 @@ ASM_PFX(GasketSecCpuSleep): pushq %rdi call ASM_PFX(SecCpuSleep) - + popq %rdi // restore state popq %rsi popq %rbp ret - - + + ASM_GLOBAL ASM_PFX(GasketSecExit) ASM_PFX(GasketSecExit): pushq %rbp // stack frame is for the debugger movq %rsp, %rbp - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecExit) // Less to do as we will never return to EFI ABI world LDEAD_LOOP: jmp LDEAD_LOOP // _exit should never return - + ASM_GLOBAL ASM_PFX(GasketSecGetTime) ASM_PFX(GasketSecGetTime): pushq %rbp // stack frame is for the debugger @@ -313,8 +313,8 @@ ASM_PFX(GasketSecGetTime): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecGetTime) @@ -331,8 +331,8 @@ ASM_PFX(GasketSecSetTime): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecSetTime) @@ -350,13 +350,13 @@ ASM_PFX(GasketSecGetNextProtocol): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx call ASM_PFX(SecGetNextProtocol) - + popq %rdi // restore state popq %rsi popq %rbp @@ -372,16 +372,16 @@ ASM_PFX(GasketSecPeCoffGetEntryPoint): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(SecPeCoffGetEntryPoint) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketSecPeCoffRelocateImageExtraAction) ASM_PFX(GasketSecPeCoffRelocateImageExtraAction): pushq %rbp // stack frame is for the debugger @@ -390,15 +390,15 @@ ASM_PFX(GasketSecPeCoffRelocateImageExtraAction): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecPeCoffRelocateImageExtraAction) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketSecPeCoffUnloadImageExtraAction) ASM_PFX(GasketSecPeCoffUnloadImageExtraAction): pushq %rbp // stack frame is for the debugger @@ -407,15 +407,15 @@ ASM_PFX(GasketSecPeCoffUnloadImageExtraAction): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(SecPeCoffUnloadImageExtraAction) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketSecEmuThunkAddress) ASM_PFX(GasketSecEmuThunkAddress): @@ -426,7 +426,7 @@ ASM_PFX(GasketSecEmuThunkAddress): pushq %rdi call ASM_PFX(SecEmuThunkAddress) - + popq %rdi // restore state popq %rsi popq %rbp @@ -444,13 +444,13 @@ ASM_PFX(GasketX11Size): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx call ASM_PFX(X11Size) - + popq %rdi // restore state popq %rsi popq %rbp @@ -465,10 +465,10 @@ ASM_PFX(GasketX11CheckKey): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(X11CheckKey) - + popq %rdi // restore state popq %rsi popq %rbp @@ -482,11 +482,11 @@ ASM_PFX(GasketX11GetKey): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(X11GetKey) - + popq %rdi // restore state popq %rsi popq %rbp @@ -501,17 +501,17 @@ ASM_PFX(GasketX11KeySetState): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(X11KeySetState) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketX11RegisterKeyNotify) ASM_PFX(GasketX11RegisterKeyNotify): pushq %rbp // stack frame is for the debugger @@ -520,19 +520,19 @@ ASM_PFX(GasketX11RegisterKeyNotify): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx call ASM_PFX(X11RegisterKeyNotify) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketX11Blt) ASM_PFX(GasketX11Blt): pushq %rbp // stack frame is for the debugger @@ -541,13 +541,13 @@ ASM_PFX(GasketX11Blt): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx call ASM_PFX(X11Blt) - + popq %rdi // restore state popq %rsi popq %rbp @@ -562,10 +562,10 @@ ASM_PFX(GasketX11CheckPointer): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(X11CheckPointer) - + popq %rdi // restore state popq %rsi popq %rbp @@ -580,11 +580,11 @@ ASM_PFX(GasketX11GetPointerState): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(X11GetPointerState) - + popq %rdi // restore state popq %rsi popq %rbp @@ -599,16 +599,16 @@ ASM_PFX(GasketX11GraphicsWindowOpen): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(X11GraphicsWindowOpen) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketX11GraphicsWindowClose) ASM_PFX(GasketX11GraphicsWindowClose): pushq %rbp // stack frame is for the debugger @@ -617,11 +617,11 @@ ASM_PFX(GasketX11GraphicsWindowClose): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args movq %r9, %rcx call ASM_PFX(X11GraphicsWindowClose) - + popq %rdi // restore state popq %rsi popq %rbp @@ -638,10 +638,10 @@ ASM_PFX(GasketPthreadMutexLock): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadMutexLock) - + popq %rdi // restore state popq %rsi popq %rbp @@ -656,10 +656,10 @@ ASM_PFX(GasketPthreadMutexUnLock): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadMutexUnLock) - + popq %rdi // restore state popq %rsi popq %rbp @@ -673,10 +673,10 @@ ASM_PFX(GasketPthreadMutexTryLock): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadMutexTryLock) - + popq %rdi // restore state popq %rsi popq %rbp @@ -692,14 +692,14 @@ ASM_PFX(GasketPthreadMutexInit): call ASM_PFX(PthreadMutexInit) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketPthreadMutexDestroy) ASM_PFX(GasketPthreadMutexDestroy): pushq %rbp // stack frame is for the debugger @@ -708,10 +708,10 @@ ASM_PFX(GasketPthreadMutexDestroy): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadMutexDestroy) - + popq %rdi // restore state popq %rsi popq %rbp @@ -726,19 +726,19 @@ ASM_PFX(GasketPthreadCreate): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx call ASM_PFX(PthreadCreate) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketPthreadExit) ASM_PFX(GasketPthreadExit): pushq %rbp // stack frame is for the debugger @@ -747,17 +747,17 @@ ASM_PFX(GasketPthreadExit): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadExit) - + popq %rdi // restore state popq %rsi popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketPthreadSelf) ASM_PFX(GasketPthreadSelf): pushq %rbp // stack frame is for the debugger @@ -768,7 +768,7 @@ ASM_PFX(GasketPthreadSelf): call ASM_PFX(PthreadSelf) - + popq %rdi // restore state popq %rsi popq %rbp @@ -783,10 +783,10 @@ ASM_PFX(GasketPthreadOpen): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadOpen) - + popq %rdi // restore state popq %rsi popq %rbp @@ -801,10 +801,10 @@ ASM_PFX(GasketPthreadClose): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PthreadClose) - + popq %rdi // restore state popq %rsi popq %rbp @@ -826,14 +826,14 @@ ASM_PFX(ReverseGasketUint64): pushq %rbp // stack frame is for the debugger movq %rsp, %rbp - movq %rdi, %rax // Swizzle args - movq %rsi, %rcx + movq %rdi, %rax // Swizzle args + movq %rsi, %rcx subq $32, %rsp // 32-byte shadow space call *%rax addq $32, %rsp - popq %rbp + popq %rbp ret // @@ -850,16 +850,16 @@ ASM_PFX(ReverseGasketUint64Uint64): pushq %rbp // stack frame is for the debugger movq %rsp, %rbp - movq %rdi, %rax // Swizzle args - movq %rsi, %rcx + movq %rdi, %rax // Swizzle args + movq %rsi, %rcx subq $32, %rsp // 32-byte shadow space call *%rax addq $32, %rsp - popq %rbp + popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketSecUnixPeiAutoScan) ASM_PFX(GasketSecUnixPeiAutoScan): @@ -869,12 +869,12 @@ ASM_PFX(GasketSecUnixPeiAutoScan): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx call ASM_PFX(SecUnixPeiAutoScan) - + popq %rdi // restore state popq %rsi popq %rbp @@ -889,8 +889,8 @@ ASM_PFX(GasketSecUnixFdAddress): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx @@ -912,8 +912,8 @@ ASM_PFX(GasketPosixOpenVolume): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx @@ -933,12 +933,12 @@ ASM_PFX(GasketPosixFileOpen): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 - + movq 48(%rbp), %r8 + call ASM_PFX(PosixFileOpen) popq %rdi // restore state @@ -955,7 +955,7 @@ ASM_PFX(GasketPosixFileCLose): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PosixFileCLose) @@ -964,7 +964,7 @@ ASM_PFX(GasketPosixFileCLose): popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketPosixFileDelete) ASM_PFX(GasketPosixFileDelete): pushq %rbp // stack frame is for the debugger @@ -973,7 +973,7 @@ ASM_PFX(GasketPosixFileDelete): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PosixFileDelete) @@ -991,8 +991,8 @@ ASM_PFX(GasketPosixFileRead): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx call ASM_PFX(PosixFileRead) @@ -1002,7 +1002,7 @@ ASM_PFX(GasketPosixFileRead): popq %rbp ret - + ASM_GLOBAL ASM_PFX(GasketPosixFileWrite) ASM_PFX(GasketPosixFileWrite): pushq %rbp // stack frame is for the debugger @@ -1011,8 +1011,8 @@ ASM_PFX(GasketPosixFileWrite): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx call ASM_PFX(PosixFileWrite) @@ -1031,8 +1031,8 @@ ASM_PFX(GasketPosixFileSetPossition): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(PosixFileSetPossition) @@ -1050,8 +1050,8 @@ ASM_PFX(GasketPosixFileGetPossition): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(PosixFileGetPossition) @@ -1069,8 +1069,8 @@ ASM_PFX(GasketPosixFileGetInfo): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx @@ -1090,8 +1090,8 @@ ASM_PFX(GasketPosixFileSetInfo): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx @@ -1111,7 +1111,7 @@ ASM_PFX(GasketPosixFileFlush): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PosixFileFlush) @@ -1129,7 +1129,7 @@ ASM_PFX(GasketPosixFileSystmeThunkOpen): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PosixFileSystmeThunkOpen) @@ -1147,7 +1147,7 @@ ASM_PFX(GasketPosixFileSystmeThunkClose): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(PosixFileSystmeThunkClose) @@ -1164,8 +1164,8 @@ ASM_PFX(GasketEmuBlockIoReset): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(EmuBlockIoReset) @@ -1183,12 +1183,12 @@ ASM_PFX(GasketEmuBlockIoReadBlocks): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 - movq 56(%rbp), %r9 + movq 48(%rbp), %r8 + movq 56(%rbp), %r9 call ASM_PFX(EmuBlockIoReadBlocks) @@ -1206,12 +1206,12 @@ ASM_PFX(GasketEmuBlockIoWriteBlocks): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 - movq 56(%rbp), %r9 + movq 48(%rbp), %r8 + movq 56(%rbp), %r9 call ASM_PFX(EmuBlockIoWriteBlocks) @@ -1229,8 +1229,8 @@ ASM_PFX(GasketEmuBlockIoFlushBlocks): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(EmuBlockIoFlushBlocks) @@ -1248,8 +1248,8 @@ ASM_PFX(GasketEmuBlockIoCreateMapping): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(EmuBlockIoCreateMapping) @@ -1267,7 +1267,7 @@ ASM_PFX(GasketBlockIoThunkOpen): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuBlockIoThunkOpen) @@ -1285,7 +1285,7 @@ ASM_PFX(GasketBlockIoThunkClose): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuBlockIoThunkClose) @@ -1304,8 +1304,8 @@ ASM_PFX(GasketSnpCreateMapping): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(EmuSnpCreateMapping) @@ -1323,7 +1323,7 @@ ASM_PFX(GasketSnpStart): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuSnpStart) @@ -1341,7 +1341,7 @@ ASM_PFX(GasketSnpStop): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuSnpStop) @@ -1359,8 +1359,8 @@ ASM_PFX(GasketSnpInitialize): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx call ASM_PFX(EmuSnpInitialize) @@ -1380,8 +1380,8 @@ ASM_PFX(GasketSnpReset): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi call ASM_PFX(EmuSnpReset) @@ -1399,7 +1399,7 @@ ASM_PFX(GasketSnpShutdown): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuSnpShutdown) @@ -1417,12 +1417,12 @@ ASM_PFX(GasketSnpReceiveFilters): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 - movq 56(%rbp), %r9 + movq 48(%rbp), %r8 + movq 56(%rbp), %r9 call ASM_PFX(EmuSnpReceiveFilters) @@ -1440,8 +1440,8 @@ ASM_PFX(GasketSnpStationAddress): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx call ASM_PFX(EmuSnpStationAddress) @@ -1461,8 +1461,8 @@ ASM_PFX(GasketSnpStatistics): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx @@ -1482,8 +1482,8 @@ ASM_PFX(GasketSnpMCastIpToMac): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx @@ -1503,11 +1503,11 @@ ASM_PFX(GasketSnpNvData): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 + movq 48(%rbp), %r8 call ASM_PFX(EmuSnpNvData) @@ -1525,8 +1525,8 @@ ASM_PFX(GasketSnpGetStatus): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx call ASM_PFX(EmuSnpGetStatus) @@ -1542,17 +1542,17 @@ ASM_GLOBAL ASM_PFX(GasketSnpTransmit) ASM_PFX(GasketSnpTransmit): pushq %rbp // stack frame is for the debugger movq %rsp, %rbp - subq $16, %rsp // Allocate space for args on the stack + subq $16, %rsp // Allocate space for args on the stack pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 - movq 56(%rbp), %r9 + movq 48(%rbp), %r8 + movq 56(%rbp), %r9 movq 64(%rbp), %rax movq %rax, (%rsp) @@ -1575,12 +1575,12 @@ ASM_PFX(GasketSnpReceive): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args - movq %rdx, %rsi + movq %rcx, %rdi // Swizzle args + movq %rdx, %rsi movq %r8, %rdx movq %r9, %rcx - movq 48(%rbp), %r8 - movq 56(%rbp), %r9 + movq 48(%rbp), %r8 + movq 56(%rbp), %r9 movq 64(%rbp), %rax movq %rax, (%rsp) @@ -1601,7 +1601,7 @@ ASM_PFX(GasketSnpThunkOpen): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuSnpThunkOpen) @@ -1619,7 +1619,7 @@ ASM_PFX(GasketSnpThunkClose): pushq %rsi // %rsi & %rdi are volatile in Unix and callee-save in EFI ABI pushq %rdi - movq %rcx, %rdi // Swizzle args + movq %rcx, %rdi // Swizzle args call ASM_PFX(EmuSnpThunkClose) diff --git a/EmulatorPkg/Unix/Host/X64/SwitchStack.S b/EmulatorPkg/Unix/Host/X64/SwitchStack.S index 8a57b781b5..e82b352b6a 100644 --- a/EmulatorPkg/Unix/Host/X64/SwitchStack.S +++ b/EmulatorPkg/Unix/Host/X64/SwitchStack.S @@ -23,7 +23,7 @@ #
# (rdi) EntryPoint - Entry point with new stack.
# (rsi) Context1 - Parameter1 for entry point. (rcx)
-# (rdx) Context2 - Parameter2 for entry point. (rdx)
+# (rdx) Context2 - Parameter2 for entry point. (rdx)
# (rcx) NewStack - The pointer to new stack.
#
# Returns:
@@ -37,11 +37,11 @@ ASM_PFX(PeiSwitchStacks): 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.
@@ -49,5 +49,5 @@ ASM_PFX(PeiSwitchStacks): subq $32, %rsp // 32-byte shadow space plus alignment pad
call *%rax
-
+
diff --git a/EmulatorPkg/Unix/UnixX64.dsc b/EmulatorPkg/Unix/UnixX64.dsc index 922df012fa..0b08a7357c 100644 --- a/EmulatorPkg/Unix/UnixX64.dsc +++ b/EmulatorPkg/Unix/UnixX64.dsc @@ -105,7 +105,7 @@ #
PlatformBdsLib|EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf
KeyMapLib|EmulatorPkg/Library/KeyMapLibNull/KeyMapLibNull.inf
-
+
#
# Misc
#
@@ -178,7 +178,7 @@ [LibraryClasses.common.UEFI_DRIVER]
PcdLib|MdePkg/Library/DxePcdLib/DxePcdLib.inf
-
+
[LibraryClasses.common.UEFI_APPLICATION]
PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
@@ -204,7 +204,7 @@ gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareFdSize|0x002a0000
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareBlockSize|0x10000
gEmulatorPkgTokenSpaceGuid.PcdEmuFirmwareVolume|L"../FV/FV_RECOVERY.fd"
-
+
gEmulatorPkgTokenSpaceGuid.PcdEmuMemorySizeForSecMain|L"64!64"
!if $(BUILD_NEW_SHELL)
@@ -227,7 +227,7 @@ #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"
@@ -288,7 +288,7 @@ }
[Components.IA32]
- MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
+ MdeModulePkg/Core/DxeIplPeim/DxeIpl.inf
!endif
[Components]
@@ -314,8 +314,8 @@ PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
}
MdeModulePkg/Universal/ReportStatusCodeRouter/Pei/ReportStatusCodeRouterPei.inf
- MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
-
+ MdeModulePkg/Universal/StatusCodeHandler/Pei/StatusCodeHandlerPei.inf
+
IntelFrameworkModulePkg/Universal/StatusCode/Pei/StatusCodePei.inf
EmulatorPkg/BootModePei/BootModePei.inf
MdeModulePkg/Universal/Variable/Pei/VariablePei.inf
@@ -342,7 +342,7 @@ MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf {
<LibraryClasses>
DebugLib|MdePkg/Library/BaseDebugLibSerialPort/BaseDebugLibSerialPort.inf
- SerialPortLib|EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
+ SerialPortLib|EmulatorPkg/Library/DxeEmuStdErrSerialPortLib/DxeEmuStdErrSerialPortLib.inf
}
MdeModulePkg/Universal/Metronome/Metronome.inf
@@ -370,17 +370,17 @@ EmbeddedPkg/SerialDxe/SerialDxe.inf {
<LibraryClasses>
DebugLib|MdePkg/Library/BaseDebugLibNull/BaseDebugLibNull.inf
- SerialPortLib|EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
+ SerialPortLib|EmulatorPkg/Library/DxeEmuSerialPortLib/DxeEmuSerialPortLib.inf
}
-
+
MdeModulePkg/Universal/Console/TerminalDxe/TerminalDxe.inf
IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
- MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
+ MdeModulePkg/Universal/DevicePathDxe/DevicePathDxe.inf
#{
- # <LibraryClasses>
+ # <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
diff --git a/EmulatorPkg/Unix/UnixX64.fdf b/EmulatorPkg/Unix/UnixX64.fdf index 2977a9ff7b..0778612f58 100644 --- a/EmulatorPkg/Unix/UnixX64.fdf +++ b/EmulatorPkg/Unix/UnixX64.fdf @@ -28,7 +28,7 @@ ################################################################################
[FD.Fv_Recovery]
#
-# In OS X PEIMs are really XIP, so we need to make this address match the malloced
+# 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).
#
@@ -184,7 +184,7 @@ 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/PCD/Dxe/Pcd.inf
INF MdeModulePkg/Universal/ReportStatusCodeRouter/RuntimeDxe/ReportStatusCodeRouterRuntimeDxe.inf
INF MdeModulePkg/Universal/StatusCodeHandler/RuntimeDxe/StatusCodeHandlerRuntimeDxe.inf
INF MdeModulePkg/Universal/Metronome/Metronome.inf
@@ -220,7 +220,7 @@ 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/EmuBusDriverDxe/EmuBusDriverDxe.inf
INF EmulatorPkg/EmuGopDxe/EmuGopDxe.inf
INF EmulatorPkg/EmuSimpleFileSystemDxe/EmuSimpleFileSystemDxe.inf
INF EmulatorPkg/EmuBlockIoDxe/EmuBlockIoDxe.inf
@@ -229,7 +229,7 @@ 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 IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf
INF MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf
INF MdeModulePkg/Application/HelloWorld/HelloWorld.inf
@@ -250,7 +250,7 @@ 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
@@ -270,22 +270,22 @@ INF RuleOverride = BINARY EdkShellBinPkg/FullShell/FullShell.inf 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 #
+# 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
@@ -302,24 +302,24 @@ FILE FREEFORM = PCD(gEfiIntelFrameworkModulePkgTokenSpaceGuid.PcdLogoFile) { [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)
+ 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)
+ 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)
+ UI STRING="$(MODULE_NAME)" Optional
+ VERSION STRING="$(INF_VERSION)" Optional BUILD_NUM=$(BUILD_NUMBER)
}
[Rule.Common.DXE_CORE]
|