diff --git a/MdePkg/Include/Library/UefiApplicationEntryPoint.h b/MdePkg/Include/Library/UefiApplicationEntryPoint.h
new file mode 100644
index 0000000000..ff8b5b241e
--- /dev/null
+++ b/MdePkg/Include/Library/UefiApplicationEntryPoint.h
@@ -0,0 +1,129 @@
+/** @file
+ Entry point to a UEFI Application.
+
+Copyright (c) 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+#ifndef __UEFI_APPLICATION_ENTRY_POINT_H__
+#define __UEFI_APPLICATION_ENTRY_POINT_H__
+
+//
+// Declare the EFI/UEFI Specification Revision to which this driver is implemented
+//
+extern const UINT32 _gUefiDriverRevision;
+
+/**
+ Enrty point to UEFI Application.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS One or more of the drivers returned a success code.
+ @retval !EFI_SUCESS The return status from the last driver entry point in the list.
+
+**/
+EFI_STATUS
+EFIAPI
+_ModuleEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+
+/**
+ Enrty point wrapper of UEFI Application.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS One or more of the drivers returned a success code.
+ @retval !EFI_SUCESS The return status from the last driver entry point in the list.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+
+/**
+ Invoke the destuctors of all libraries and call gBS->Exit
+ to return control to firmware core.
+
+ @param Status Status returned by the application that is exiting.
+
+ @retval VOID
+
+**/
+VOID
+EFIAPI
+Exit (
+ IN EFI_STATUS Status
+ );
+
+
+/**
+ Call constructors for all libraries. Autogen tool inserts the implementation
+ of this function into Autogen.c.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval VOID
+
+**/
+VOID
+EFIAPI
+ProcessLibraryConstructorList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+
+/**
+ Call destructors for all libraries. Autogen tool inserts the implementation
+ of this function into Autogen.c.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval VOID
+**/
+VOID
+EFIAPI
+ProcessLibraryDestructorList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+/**
+ Call driver entry point. For UEFI application, user
+ can only specify one entry point. Tool will automatically insert
+ this to Autogen.c.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @return Status returned by entry points specified by
+ the user.
+
+**/
+
+EFI_STATUS
+EFIAPI
+ProcessModuleEntryPointList (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ );
+
+#endif
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c b/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
new file mode 100644
index 0000000000..d6d9beaaa1
--- /dev/null
+++ b/MdePkg/Library/UefiApplicationEntryPoint/ApplicationEntryPoint.c
@@ -0,0 +1,103 @@
+/** @file
+ Entry point library instance to a UEFI application.
+
+Copyright (c) 2007, Intel Corporation
+All rights reserved. This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD License
+which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+**/
+
+/**
+ Enrty point to UEFI application.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS One or more of the drivers returned a success code.
+ @retval !EFI_SUCESS The return status from the last driver entry point in the list.
+
+**/
+EFI_STATUS
+EFIAPI
+_ModuleEntryPoint (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ EFI_STATUS Status;
+
+ if (_gUefiDriverRevision != 0) {
+ //
+ // Make sure that the EFI/UEFI spec revision of the platform is >= EFI/UEFI spec revision of the application.
+ //
+ if (SystemTable->Hdr.Revision < _gUefiDriverRevision) {
+ return EFI_INCOMPATIBLE_VERSION;
+ }
+ }
+
+ //
+ // Call constructor for all libraries.
+ //
+ ProcessLibraryConstructorList (ImageHandle, SystemTable);
+
+ //
+ // Call the module's entry point
+ //
+ Status = ProcessModuleEntryPointList (ImageHandle, SystemTable);
+
+ //
+ // Process destructor for all libraries.
+ //
+ ProcessLibraryDestructorList (ImageHandle, SystemTable);
+
+ //
+ // Return the return status code from the driver entry point
+ //
+ return Status;
+}
+
+/**
+ Invoke the destuctors of all libraries and call gBS->Exit
+ to return control to firmware core.
+
+ @param Status Status returned by the application that is exiting.
+
+ @retval VOID
+
+**/
+VOID
+EFIAPI
+Exit (
+ IN EFI_STATUS Status
+ )
+
+{
+ ProcessLibraryDestructorList (gImageHandle, gST);
+
+ gBS->Exit (gImageHandle, Status, 0, NULL);
+}
+
+/**
+ Enrty point wrapper of UEFI Application.
+
+ @param ImageHandle ImageHandle of the loaded driver.
+ @param SystemTable Pointer to the EFI System Table.
+
+ @retval EFI_SUCCESS One or more of the drivers returned a success code.
+ @retval !EFI_SUCESS The return status from the last driver entry point in the list.
+
+**/
+EFI_STATUS
+EFIAPI
+EfiMain (
+ IN EFI_HANDLE ImageHandle,
+ IN EFI_SYSTEM_TABLE *SystemTable
+ )
+{
+ return _ModuleEntryPoint (ImageHandle, SystemTable);
+}
diff --git a/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa
new file mode 100644
index 0000000000..35650850d6
--- /dev/null
+++ b/MdePkg/Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa
@@ -0,0 +1,42 @@
+
+
+
+ UefiApplicationEntryPoint
+ UEFI_DRIVER
+ DADE8301-CB29-4fd5-8148-56FD246C5B88
+ 1.0
+ Component description file for the entry point to a EFI Application
+ Library to abstract entry point to a EFI Application.
+ Copyright (c) 2007, Intel Corporation.
+ All rights reserved. This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the BSD License
+ which accompanies this distribution. The full text of the license may be found at
+ http://opensource.org/licenses/bsd-license.php
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+ FRAMEWORK_BUILD_PACKAGING_SPECIFICATION 0x00000052
+
+
+ IA32 X64 IPF EBC
+ false
+ UefiApplicationEntryPoint
+
+
+
+ UefiApplicationEntryPoint
+
+
+ UefiBootServicesTableLib
+
+
+
+ ApplicationEntryPoint.c
+
+
+
+
+
+ EFI_SPECIFICATION_VERSION 0x00020000
+ EDK_RELEASE_VERSION 0x00020000
+
+
diff --git a/MdePkg/MdePkg.fpd b/MdePkg/MdePkg.fpd
index 113b8eedae..2fba0c6f08 100644
--- a/MdePkg/MdePkg.fpd
+++ b/MdePkg/MdePkg.fpd
@@ -6,7 +6,7 @@
0.3
EFI/Tiano MdePkg Package
This FPD file is used for Package Level build.
- Copyright (c) 2006, Intel Corporation
+ Copyright (c) 2006 - 2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -100,16 +100,6 @@
-
-
- PcdIoBlockBaseAddressForIpf
- 0x0000000c
- gEfiMdePkgTokenSpaceGuid
- UINT64
- 8
- 0x0ffffc000000
-
-
NULL
LIBRARY
@@ -1248,16 +1238,6 @@
-
-
- PcdIoBlockBaseAddressForIpf
- 0x0000000c
- gEfiMdePkgTokenSpaceGuid
- UINT64
- 8
- 0x0ffffc000000
-
-
NULL
LIBRARY
@@ -2332,6 +2312,14 @@
LIBRARY
+
+
+
+
+
+
+
+
diff --git a/MdePkg/MdePkg.spd b/MdePkg/MdePkg.spd
index 86fa64c265..e92e203b01 100644
--- a/MdePkg/MdePkg.spd
+++ b/MdePkg/MdePkg.spd
@@ -6,7 +6,7 @@
0.3
Framework Module Development Environment Industry Standards
This Package provides headers and libraries that conform to EFI/Framework Industry standards.
- Copyright (c) 2006, Intel Corporation.
+ Copyright (c) 2006 - 2007, Intel Corporation.
All rights reserved.
This program and the accompanying materials are licensed and made available under
the terms and conditions of the BSD License which accompanies this distribution.
@@ -174,6 +174,10 @@
Include/Library/UefiRuntimeServicesTableLib.h
+
+ Include/Library/UefiApplicationEntryPoint.h
+ Library to abstract entry point to a EFI Application.
+
@@ -1180,6 +1184,7 @@
Library/UefiLib/UefiLib.msa
Library/DxeMemoryLib/DxeMemoryLib.msa
Library/UefiRuntimeServicesTableLib/UefiRuntimeServicesTableLib.msa
+ Library/UefiApplicationEntryPoint/UefiApplicationEntryPoint.msa
Include/Base.h