Fixed EDKT498(enchance makedep tool to support asm file), EDKT500(dep file needs to be created for uni file) and tracker ID 454(report real driver entrypoint address through debug output) in PVCS.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2246 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2007-01-15 01:59:23 +00:00
parent b991a45139
commit a387de3b32
3 changed files with 568 additions and 579 deletions

View File

@ -29,15 +29,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</not>
</and>
<then>
<if>
<available type="file" file="${DEST_DIR_OUTPUT}/AutoGen.h.gch"/>
<then>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep">
<makedeps DepsFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"
TargetFile="${DEST_DIR_OUTPUT}/AutoGen.h.gch">
<input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
<EXTRA.INC/>
</makedeps>
</then>
</if>
<OnDependency>
<sourcefiles>
@ -102,20 +98,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<var name="FILE_PATH" value="@{FILEPATH}" />
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<if>
<available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
<then>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
<EXTRA.INC/>
</makedeps>
</then>
</if>
<OnDependency>
<sourcefiles>
<file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
</sourcefiles>
<targetfiles>
<file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
@ -161,20 +153,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<var name="FILE_PATH" value="@{FILEPATH}" />
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<if>
<available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
<then>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<input file="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
<EXTRA.INC/>
</makedeps>
</then>
</if>
<OnDependency>
<sourcefiles>
<file ListFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
</sourcefiles>
<targetfiles>
<file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
@ -304,9 +292,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<var name="FILE_PATH" value="@{FILEPATH}" />
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<EXTRA.INC.1/>
</makedeps>
<OnDependency>
<sourcefiles>
<file Name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<file Listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
</sourcefiles>
<targetfiles>
<file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
@ -379,9 +374,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<var name="FILE_PATH" value="@{FILEPATH}" />
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<EXTRA.INC.1/>
</makedeps>
<OnDependency>
<sourcefiles>
<file Name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<file Listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
</sourcefiles>
<targetfiles>
<file Name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
@ -429,20 +431,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<if>
<available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
<then>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
<EXTRA.INC.1/>
</makedeps>
</then>
</if>
<OnDependency>
<sourcefiles>
<file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
</sourcefiles>
<targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
@ -485,6 +483,9 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</macrodef>
<!--
Assembly the preprocessed IPF assembly code
-->
<macrodef name="Build_IPF_PP_Code">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
@ -516,7 +517,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<!--
Library private HashMap map = new HashMap();
Library
-->
<macrodef name="Build_Library">
<attribute name="FILENAME" />
@ -563,10 +564,15 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<mkdir dir="${DEST_DIR_OUTPUT}/@{FILEPATH}"/>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb">
<input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<EXTRA.INC/>
</makedeps>
<OnDependency>
<sourcefiles>
<file name="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
</sourcefiles>
<targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.sdb"/>
@ -689,20 +695,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<sequential>
<mkdir dir="${DEST_DIR_DEBUG}/@{FILEPATH}"/>
<if>
<available type="file" file="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
<then>
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep">
<makedeps DepsFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"
TargetFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj">
<input file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
<input file="${DEST_DIR_DEBUG}/AutoGen.h"/>
<EXTRA.INC/>
</makedeps>
</then>
</if>
<OnDependency>
<sourcefiles>
<file listfile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}.dep"/>
<file ListFile="${DEST_DIR_OUTPUT}/AutoGen.h.dep"/>
</sourcefiles>
<targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.obj"/>
@ -911,7 +913,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</macrodef>
<!--
DUMMY
DUMMY - for skipping the source file which should not be built
-->
<macrodef name="Build_DUMMY">
<attribute name="FILEPATH"/>

View File

@ -14,9 +14,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
package org.tianocore.framework.tasks;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
@ -44,6 +46,7 @@ public class MakeDeps extends Task {
//
// private members, use set/get to access them
//
private String targetFile = "";
private String depsFilePath = "";
private IncludePath includePathList = new IncludePath();
private Input inputFileList = new Input();
@ -54,7 +57,7 @@ public class MakeDeps extends Task {
//
// regular expression for "#include ..." directive
//
private static final Pattern incPattern = Pattern.compile("[\n\r \t]*#[ \t]*include[ \t\"<]+([^\n\r\"<>]+)");
private static final Pattern incPattern = Pattern.compile("[\n\r]+[ \t#]*[ \t]*include[ \t]+[\"<]*([^\n\r\"<>]+)[>\"]*[\n\r]+");
public MakeDeps() {
@ -69,6 +72,13 @@ public class MakeDeps extends Task {
@throws BuildException
**/
public void execute() throws BuildException {
//
// if target file is specified and it hasn't been generated, don't generate
// dep file
//
if (targetFile.length() != 0 && (new File(targetFile)).exists() == false) {
return;
}
//
// check if the dependency list file is uptodate or not
//
@ -124,6 +134,14 @@ public class MakeDeps extends Task {
FileTimeStamp.update(depsFilePath, depsFile.lastModified());
}
public void setTargetFile(String name) {
targetFile = name;
}
public String getTargetFile() {
return targetFile;
}
/**
Set method for "DepsFile" attribute
@ -280,24 +298,30 @@ public class MakeDeps extends Task {
if (!srcFile.exists()) {
continue;
}
//
// try cache first
//
Set<String> incFiles = includesCache.get(src);
if (incFiles == null) {
incFiles = new HashSet<String>();
FileReader fileReader = null;
BufferedReader bufReader = null;
FileInputStream fileReader = null;
BufferedInputStream bufReader = null;
String fileContent = "";
int fileLength = (int)srcFile.length();
try {
fileReader = new FileReader(srcFile);
bufReader = new BufferedReader(fileReader);
char[] buf = new char[fileLength];
fileReader = new FileInputStream(srcFile);
bufReader = new BufferedInputStream(fileReader);
byte[] buf = new byte[fileLength];
bufReader.read(buf, 0, fileLength);
//
// check if the file is utf-16 encoded
//
if (buf[0] == (byte)0xff || buf[0] == (byte)0xfe) {
fileContent = new String(buf, "UTF-16");
buf = fileContent.getBytes("UTF-8");
}
fileContent = new String(buf);
} catch (IOException e) {
throw new BuildException(e.getMessage());

View File

@ -458,11 +458,9 @@ public class AutoGen {
//
String guid = CommonDefinition.formatGuidName(saq.getModuleGuid());
if (this.moduleId.getModuleType().equalsIgnoreCase(EdkDefinitions.MODULE_TYPE_BASE)) {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED GUID gEfiCallerIdGuid = {");
} else {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID gEfiCallerIdGuid = {");
}
if (guid == null) {
@ -590,8 +588,7 @@ public class AutoGen {
//
// Write library class's related *.h file to autogen.h
//
String[] libClassList = saq
.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch);
String[] libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSCONSUMED, this.arch);
if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
@ -600,8 +597,7 @@ public class AutoGen {
}
}
libClassList = saq
.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
libClassList = saq.getLibraryClasses(CommonDefinition.ALWAYSPRODUCED, this.arch);
if (libClassList != null) {
libClassIncludeH = LibraryClassToAutogenH(libClassList);
item = libClassIncludeH.iterator();
@ -778,6 +774,7 @@ public class AutoGen {
throws EdkException {
String typeStr = saq.getModuleType();
String debugStr = "DEBUG ((EFI_D_INFO | EFI_D_LOAD, \"Module Entry Point (%s) 0x%%p\\n\", (VOID *)(UINTN)%s));\n";
int unloadImageCount = 0;
int entryPointCount = 0;
@ -795,21 +792,19 @@ public class AutoGen {
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (\r\n");
fileBuffer
.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
fileBuffer
.append(" IN VOID *OldCoreData\r\n");
fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
fileBuffer.append(" IN VOID *OldCoreData\r\n");
fileBuffer.append(" );\r\n\r\n");
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append("ProcessModuleEntryPointList (\r\n");
fileBuffer
.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
fileBuffer
.append(" IN VOID *OldCoreData\r\n");
fileBuffer.append(" IN EFI_PEI_STARTUP_DESCRIPTOR *PeiStartupDescriptor,\r\n");
fileBuffer.append(" IN VOID *OldCoreData\r\n");
fileBuffer.append(" )\r\n\r\n");
fileBuffer.append("{\r\n");
// fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[0] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));
fileBuffer.append(" return ");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (PeiStartupDescriptor, OldCoreData);\r\n");
@ -820,10 +815,8 @@ public class AutoGen {
case CommonDefinition.ModuleTypeDxeCore:
fileBuffer.append("const UINT32 _gUefiDriverRevision = 0;\r\n");
if (entryPointList == null || entryPointList.length != 1) {
throw new AutoGenException(
"Module type = 'DXE_CORE', can have only one module entry point!");
throw new AutoGenException("Module type = 'DXE_CORE', can have only one module entry point!");
} else {
fileBuffer.append("VOID\r\n");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (\n");
@ -836,6 +829,8 @@ public class AutoGen {
fileBuffer.append(" IN VOID *HobStart\r\n");
fileBuffer.append(" )\r\n\r\n");
fileBuffer.append("{\r\n");
//fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[0] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));
fileBuffer.append(" ");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (HobStart);\r\n");
@ -845,8 +840,7 @@ public class AutoGen {
case CommonDefinition.ModuleTypePeim:
entryPointCount = 0;
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\r\n");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT32 _gPeimRevision = 0;\r\n");
if (entryPointList == null || entryPointList.length == 0) {
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n");
@ -863,13 +857,10 @@ public class AutoGen {
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (\r\n");
fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" );\r\n");
entryPointCount++;
}
fileBuffer.append("EFI_STATUS\r\n");
@ -880,6 +871,8 @@ public class AutoGen {
fileBuffer.append(" )\r\n\r\n");
fileBuffer.append("{\r\n");
if (entryPointCount == 1) {
//fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[0] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));
fileBuffer.append(" return ");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (FfsHeader, PeiServices);\r\n");
@ -889,11 +882,12 @@ public class AutoGen {
fileBuffer.append(" CombinedStatus = EFI_LOAD_ERROR;\r\n\r\n");
for (int i = 0; i < entryPointList.length; i++) {
if (!entryPointList[i].equals("")) {
//fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[i] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));
fileBuffer.append(" Status = ");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (FfsHeader, PeiServices);\r\n");
fileBuffer
.append(" if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {\r\n");
fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (CombinedStatus)) {\r\n");
fileBuffer.append(" CombinedStatus = Status;\r\n");
fileBuffer.append(" }\r\n\r\n");
} else {
@ -912,8 +906,7 @@ public class AutoGen {
// function.
//
if (entryPointList == null || entryPointList.length == 0) {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
fileBuffer.append(Integer.toString(entryPointCount));
fileBuffer.append(";\r\n");
fileBuffer.append("EFI_STATUS\r\n");
@ -936,14 +929,11 @@ public class AutoGen {
fileBuffer.append(" );\r\n");
entryPointCount++;
}
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
fileBuffer.append(Integer.toString(entryPointCount));
fileBuffer.append(";\r\n");
fileBuffer
.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
fileBuffer
.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n\r\n");
fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n\r\n");
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n");
@ -953,16 +943,15 @@ public class AutoGen {
fileBuffer.append(" )\r\n\r\n");
fileBuffer.append("{\r\n");
for (int i = 0; i < entryPointList.length; i++) {
fileBuffer
.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
//fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[i] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));
fileBuffer.append(" ExitDriver (");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (ImageHandle, SystemTable));\r\n");
fileBuffer.append(" ASSERT (FALSE);\r\n");
fileBuffer.append(" }\r\n");
}
fileBuffer.append(" return mDriverEntryPointStatus;\r\n");
fileBuffer.append("}\r\n\r\n");
@ -973,14 +962,12 @@ public class AutoGen {
fileBuffer.append(" IN EFI_STATUS Status\n");
fileBuffer.append(" )\r\n\r\n");
fileBuffer.append("{\r\n");
fileBuffer
.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");
fileBuffer.append(" }\r\n");
fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
fileBuffer.append(" ASSERT (FALSE);\r\n");
fileBuffer.append("}\r\n\r\n");
}
@ -997,15 +984,13 @@ public class AutoGen {
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append(unloadImageList[i]);
fileBuffer.append(" (\r\n");
fileBuffer
.append(" IN EFI_HANDLE ImageHandle\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");
fileBuffer.append(" );\r\n");
unloadImageCount++;
}
}
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
fileBuffer.append(Integer.toString(unloadImageCount));
fileBuffer.append(";\r\n\r\n");
@ -1058,8 +1043,7 @@ public class AutoGen {
// If entry point is null, create a empty ProcessModuleEntryPointList function.
//
if (entryPointList == null || entryPointList.length == 0) {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = 0;\r\n");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = 0;\r\n");
fileBuffer.append("EFI_STATUS\r\n");
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append("ProcessModuleEntryPointList (\r\n");
@ -1082,15 +1066,12 @@ public class AutoGen {
entryPointCount++;
}
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverEntryPointCount = ");
fileBuffer.append(Integer.toString(entryPointCount));
fileBuffer.append(";\r\n");
if (entryPointCount > 1) {
fileBuffer
.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
fileBuffer
.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n");
fileBuffer.append("static BASE_LIBRARY_JUMP_BUFFER mJumpContext;\r\n");
fileBuffer.append("static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;\r\n");
}
fileBuffer.append("\n");
@ -1103,14 +1084,17 @@ public class AutoGen {
fileBuffer.append("{\r\n");
if (entryPointCount == 1) {
fileBuffer.append(" return (");
//fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[0] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[0], entryPointList[0]));
fileBuffer.append(" return ");
fileBuffer.append(entryPointList[0]);
fileBuffer.append(" (ImageHandle, SystemTable));\r\n");
fileBuffer.append(" (ImageHandle, SystemTable);\r\n");
} else {
for (int i = 0; i < entryPointList.length; i++) {
if (!entryPointList[i].equals("")) {
fileBuffer
.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
fileBuffer.append(" if (SetJump (&mJumpContext) == 0) {\r\n");
//fileBuffer.append(" DEBUG ((EFI_D_INFO, \"Module Entry Point 0x%08x\\n\", (UINTN)" + entryPointList[i] + "));\n");
fileBuffer.append(String.format(" " + debugStr, entryPointList[i], entryPointList[i]));
fileBuffer.append(" ExitDriver (");
fileBuffer.append(entryPointList[i]);
fileBuffer.append(" (ImageHandle, SystemTable));\r\n");
@ -1132,21 +1116,18 @@ public class AutoGen {
fileBuffer.append("{\r\n");
if (entryPointCount <= 1) {
fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");
fileBuffer
.append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");
fileBuffer.append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");
fileBuffer.append(" }\r\n");
fileBuffer
.append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");
} else {
fileBuffer
.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");
fileBuffer.append(" }\r\n");
fileBuffer.append(" LongJump (&mJumpContext, (UINTN)-1);\r\n");
fileBuffer.append(" ASSERT (FALSE);\r\n");
}
fileBuffer.append("}\r\n\r\n");
}
//
@ -1165,15 +1146,13 @@ public class AutoGen {
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(unloadImageList[i]);
fileBuffer.append(" (\r\n");
fileBuffer
.append(" IN EFI_HANDLE ImageHandle\r\n");
fileBuffer.append(" IN EFI_HANDLE ImageHandle\r\n");
fileBuffer.append(" );\r\n");
unloadImageCount++;
}
}
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverUnloadImageCount = ");
fileBuffer.append(Integer.toString(unloadImageCount));
fileBuffer.append(";\r\n\r\n");
@ -1255,8 +1234,7 @@ public class AutoGen {
ppiKeyWord = ppiIterator.next().toString();
cNameGuid = GlobalData.getPpiGuid(this.mDepPkgList, ppiKeyWord);
if (cNameGuid != null) {
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
fileBuffer.append(cNameGuid[0]);
fileBuffer.append(" = { ");
fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));
@ -1294,8 +1272,7 @@ public class AutoGen {
this.mProtocolList.add(protocolList[i]);
}
String[] protocolNotifyList = saq
.getProtocolNotifyArray(this.arch);
String[] protocolNotifyList = saq.getProtocolNotifyArray(this.arch);
for (int i = 0; i < protocolNotifyList.length; i++) {
this.mProtocolList.add(protocolNotifyList[i]);
@ -1312,8 +1289,7 @@ public class AutoGen {
protocolKeyWord = protocolIterator.next().toString();
cNameGuid = GlobalData.getProtocolGuid(this.mDepPkgList, protocolKeyWord);
if (cNameGuid != null) {
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
fileBuffer.append(cNameGuid[0]);
fileBuffer.append(" = { ");
fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));
@ -1355,8 +1331,7 @@ public class AutoGen {
cNameGuid = GlobalData.getGuid(this.mDepPkgList, guidKeyWord);
if (cNameGuid != null) {
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED EFI_GUID ");
fileBuffer.append(cNameGuid[0]);
fileBuffer.append(" = { ");
fileBuffer.append(CommonDefinition.formatGuidName(cNameGuid[1]));
@ -1443,10 +1418,8 @@ public class AutoGen {
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n");
fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" );\r\n");
break;
@ -1594,10 +1567,8 @@ public class AutoGen {
fileBuffer.append("EFIAPI\r\n");
fileBuffer.append(libInstanceList.get(i)[0]);
fileBuffer.append(" (\r\n");
fileBuffer
.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" );\r\n");
break;
case CommonDefinition.ModuleTypeDxeCore:
@ -1760,16 +1731,14 @@ public class AutoGen {
//
// Write driver module protocol bitmask.
//
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverModelProtocolBitmask = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINT8 _gDriverModelProtocolBitmask = ");
fileBuffer.append(Integer.toString(BitMask));
fileBuffer.append(";\r\n");
//
// Write driver module protocol list entry
//
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverModelProtocolListEntries = ");
fileBuffer.append(Integer.toString(driverBindingGroup.length));
fileBuffer.append(";\r\n");
@ -1778,8 +1747,7 @@ public class AutoGen {
// Write drive module protocol list to autogen.c
//
if (driverBindingGroup.length > 0) {
fileBuffer
.append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");
fileBuffer.append("GLOBAL_REMOVE_IF_UNREFERENCED const EFI_DRIVER_MODEL_PROTOCOL_LIST _gDriverModelProtocolList[] = {");
}
@ -1908,14 +1876,14 @@ public class AutoGen {
//
if ((!outFile.exists()) ||(inFile.lastModified() - outFile.lastModified()) >= 0) {
if (inFile.exists()) {
try{
try {
FileInputStream fis = new FileInputStream (inFile);
fis.read(buffer);
FileOutputStream fos = new FileOutputStream(outFile);
fos.write(buffer);
fis.close();
fos.close();
} catch (IOException e){
} catch (IOException e) {
throw new AutoGenException("The file, flashMap.h can't be open!");
}
@ -2057,8 +2025,7 @@ public class AutoGen {
// Entry point lib for these module types needs to know the count
// of entryPoint.
//
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverSetVirtualAddressMapEventCount = ");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const UINTN _gDriverSetVirtualAddressMapEventCount = ");
//
// If the list is not valid or has no entries set count to zero else
@ -2081,8 +2048,7 @@ public class AutoGen {
//
// No data so make a NULL list
//
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {\r\n");
fileBuffer.append(" NULL\r\n");
fileBuffer.append("};\r\n\r\n");
} else {
@ -2105,8 +2071,7 @@ public class AutoGen {
//
// Write SetVirtualAddressMap entry point array.
//
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverSetVirtualAddressMapEvent[] = {");
for (i = 0; i < this.setVirtalAddList.size(); i++) {
if (this.setVirtalAddList.get(i).equalsIgnoreCase("")) {
break;
@ -2157,8 +2122,7 @@ public class AutoGen {
//
// No data so make a NULL list.
//
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {\r\n");
fileBuffer.append(" NULL\r\n");
fileBuffer.append("};\r\n\r\n");
} else {
@ -2182,8 +2146,7 @@ public class AutoGen {
//
// Write DriverExitBootServices entry point array.
//
fileBuffer
.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");
fileBuffer.append("\r\nGLOBAL_REMOVE_IF_UNREFERENCED const EFI_EVENT_NOTIFY _gDriverExitBootServicesEvent[] = {");
for (i = 0; i < this.exitBootServiceList.size(); i++) {
if (this.exitBootServiceList.get(i).equalsIgnoreCase("")) {
break;