]> git.proxmox.com Git - mirror_edk2.git/blobdiff - UnixPkg/Sec/SecMain.c
merge the generation of SecMain into the whole build process.
[mirror_edk2.git] / UnixPkg / Sec / SecMain.c
index a6da20b135e540745a162aed625b46c6cf014f78..2f2a1d26a26beb3b34fc4d9d0023ef425d3fc7c4 100644 (file)
@@ -53,17 +53,17 @@ EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE  mPeiEfiPeiPeCoffLoaderInstance = {
 
 
 
-EFI_PEI_PE_COFF_LOADER_PROTOCOL           *gPeiEfiPeiPeCoffLoader = &mPeiEfiPeiPeCoffLoaderInstance.PeCoff;
+EFI_PEI_PE_COFF_LOADER_PROTOCOL           *gPeiEfiPeiPeCoffLoader    = &mPeiEfiPeiPeCoffLoaderInstance.PeCoff;
 
-UNIX_PEI_LOAD_FILE_PPI                      mSecNtLoadFilePpi     = { SecWinNtPeiLoadFile };
+UNIX_PEI_LOAD_FILE_PPI                    mSecNtLoadFilePpi          = { SecWinNtPeiLoadFile };
 
-PEI_UNIX_AUTOSCAN_PPI                       mSecNtAutoScanPpi     = { SecWinNtPeiAutoScan };
+PEI_UNIX_AUTOSCAN_PPI                     mSecNtAutoScanPpi          = { SecWinNtPeiAutoScan };
 
-PEI_UNIX_THUNK_PPI                          mSecWinNtThunkPpi     = { SecWinNtWinNtThunkAddress };
+PEI_UNIX_THUNK_PPI                        mSecWinNtThunkPpi          = { SecWinNtWinNtThunkAddress };
 
-EFI_PEI_PROGRESS_CODE_PPI                 mSecStatusCodePpi     = { SecPeiReportStatusCode };
+EFI_PEI_PROGRESS_CODE_PPI                 mSecStatusCodePpi          = { SecPeiReportStatusCode };
 
-UNIX_FWH_PPI                                mSecFwhInformationPpi = { SecWinNtFdAddress };
+UNIX_FWH_PPI                              mSecFwhInformationPpi      = { SecWinNtFdAddress };
 
 TEMPORARY_RAM_SUPPORT_PPI                 mSecTemporaryRamSupportPpi = {SecTemporaryRamSupport};
 
@@ -983,6 +983,21 @@ SecNt32PeCoffRelocateImage (
      (unsigned long)ImageContext->ImageAddress,
      (unsigned long)ImageContext->EntryPoint);
 
+  Handle = dlopen(ImageContext->PdbPointer, RTLD_NOW);
+  
+  if (Handle) {
+    Entry = dlsym(Handle, "_ModuleEntryPoint");
+  } else {
+    printf("%s\n", dlerror());  
+  }
+  
+  if (Entry != NULL) {
+    ImageContext->EntryPoint = Entry;
+    printf("Change %s Entrypoint to :0x%08lx\n", ImageContext->PdbPointer, Entry);
+  } else {
+    printf("Could not find _ModuleEntryPoint Entry, Module may be built error\n");
+  }
+
   SecUnixLoaderBreak ();
 
   return Status;