/*++ @file\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2008 - 2011, Apple Inc. All rights reserved.<BR>\r
-This program and the accompanying materials \r
-are licensed and made available under the terms and conditions of the BSD License \r
-which accompanies this distribution. The full text of the license may be found at \r
-http://opensource.org/licenses/bsd-license.php \r
- \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
+\r
+This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
\r
**/\r
\r
#ifndef _SEC_MAIN_H__\r
#define _SEC_MAIN_H__\r
\r
-#include <PiPei.h>\r
-#include <Uefi.h>\r
-\r
-#include <Library/PeCoffLib.h>\r
-#include <Library/BaseLib.h>\r
-#include <Library/BaseMemoryLib.h>\r
-#include <Library/PrintLib.h>\r
-#include <Library/PcdLib.h>\r
-#include <Library/DebugLib.h>\r
-#include <Library/ReportStatusCodeLib.h>\r
-\r
-#include <Library/ThunkPpiList.h>\r
-#include <Library/ThunkProtocolList.h>\r
-\r
-#include <Ppi/EmuThunk.h>\r
-#include <Ppi/StatusCode.h>\r
-#include <Ppi/TemporaryRamSupport.h>\r
-#include <Ppi/EmuPeiServicesTableUpdate.h>\r
-\r
-#include <Protocol/SimplePointer.h>\r
-#include <Protocol/SimpleTextIn.h>\r
-#include <Protocol/SimpleTextInEx.h>\r
-#include <Protocol/UgaDraw.h>\r
-#include <Protocol/SimpleFileSystem.h>\r
-\r
-#include <Protocol/EmuThunk.h>\r
-#include <Protocol/EmuIoThunk.h>\r
-#include <Protocol/EmuGraphicsWindow.h>\r
-#include <Protocol/EmuPthreadThunk.h>\r
-\r
-#include <Guid/FileInfo.h>\r
-#include <Guid/FileSystemInfo.h>\r
-#include <Guid/FileSystemVolumeLabelInfo.h>\r
+//\r
+// Name mangle to prevent build errors. I.e conflicts between EFI and OS\r
+//\r
+#define NTOHL _UNIX_EFI_NAME_MANGLE_NTOHL_\r
+#define HTONL _UNIX_EFI_NAME_MANGLE_HTONL_\r
+#define NTOHS _UNIX_EFI_NAME_MANGLE_NTOHS_\r
+#define HTONS _UNIX_EFI_NAME_MANGLE_HTOHS_\r
+#define B0 _UNIX_EFI_NAME_MANGLE_B0_\r
\r
#include <stdio.h>\r
#include <stdlib.h>\r
#include <string.h>\r
#include <stdlib.h>\r
#include <sys/ioctl.h>\r
+#include <sys/statvfs.h>\r
\r
#include <sys/socket.h>\r
#include <netdb.h>\r
#include <net/bpf.h>\r
#include <sys/param.h>\r
#include <sys/mount.h>\r
+#include <sys/disk.h>\r
#define _XOPEN_SOURCE\r
#ifndef _Bool\r
#define _Bool char // for clang debug\r
#else\r
#include <termio.h>\r
#include <sys/vfs.h>\r
+#include <linux/fs.h>\r
#endif \r
\r
#include <utime.h>\r
\r
+#undef NTOHL\r
+#undef HTONL\r
+#undef NTOHS\r
+#undef HTONS\r
+#undef B0\r
+\r
+\r
+#include <PiPei.h>\r
+#include <Uefi.h>\r
+\r
+#include <Library/PeCoffLib.h>\r
+#include <Library/BaseLib.h>\r
+#include <Library/BaseMemoryLib.h>\r
+#include <Library/PrintLib.h>\r
+#include <Library/PcdLib.h>\r
+#include <Library/DebugLib.h>\r
+#include <Library/ReportStatusCodeLib.h>\r
+\r
+#include <Library/ThunkPpiList.h>\r
+#include <Library/ThunkProtocolList.h>\r
+#include <Library/PeiServicesLib.h>\r
+#include <Library/PeCoffGetEntryPointLib.h>\r
+#include <Library/EmuMagicPageLib.h>\r
+\r
+#include <Ppi/EmuThunk.h>\r
+#include <Ppi/StatusCode.h>\r
+\r
+#include <Protocol/SimplePointer.h>\r
+#include <Protocol/SimpleTextIn.h>\r
+#include <Protocol/SimpleTextInEx.h>\r
+#include <Protocol/UgaDraw.h>\r
+#include <Protocol/SimpleFileSystem.h>\r
+\r
+#include <Protocol/EmuThunk.h>\r
+#include <Protocol/EmuIoThunk.h>\r
+#include <Protocol/EmuGraphicsWindow.h>\r
+#include <Protocol/EmuThread.h>\r
+#include <Protocol/EmuBlockIo.h>\r
+#include <Protocol/EmuSnp.h>\r
+\r
+#include <Guid/FileInfo.h>\r
+#include <Guid/FileSystemInfo.h>\r
+#include <Guid/FileSystemVolumeLabelInfo.h>\r
+\r
+\r
#include "Gasket.h"\r
\r
\r
);\r
\r
EFI_STATUS\r
-EFIAPI\r
SecUnixFdAddress (\r
IN UINTN Index,\r
IN OUT EFI_PHYSICAL_ADDRESS *FdBase,\r
\r
\r
VOID\r
-EFIAPI\r
PeiSwitchStacks (\r
IN SWITCH_STACK_ENTRY_POINT EntryPoint,\r
IN VOID *Context1, OPTIONAL\r
IN VOID *Context2, OPTIONAL\r
- IN VOID *Context3, OPTIONAL\r
IN VOID *NewStack\r
);\r
\r
SecInitThunkProtocol (\r
VOID\r
);\r
+ \r
\r
+EFI_PHYSICAL_ADDRESS *\r
+MapMemory (\r
+ INTN fd,\r
+ UINT64 length,\r
+ INTN prot,\r
+ INTN flags);\r
+\r
+EFI_STATUS\r
+MapFile (\r
+ IN CHAR8 *FileName,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
+ OUT UINT64 *Length\r
+ );\r
+\r
+EFI_STATUS\r
+MapFd0 (\r
+ IN CHAR8 *FileName,\r
+ IN OUT EFI_PHYSICAL_ADDRESS *BaseAddress,\r
+ OUT UINT64 *Length\r
+ );\r
+\r
+ \r
\r
VOID SecSleep (UINT64 Milliseconds);\r
VOID SecEnableInterrupt (VOID);\r
extern EMU_IO_THUNK_PROTOCOL gX11ThunkIo;\r
extern EMU_IO_THUNK_PROTOCOL gPosixFileSystemThunkIo;\r
extern EMU_IO_THUNK_PROTOCOL gPthreadThunkIo;\r
-\r
+extern EMU_IO_THUNK_PROTOCOL gBlockIoThunkIo;\r
+extern EMU_IO_THUNK_PROTOCOL gSnpThunkIo;\r
\r
#endif\r