Skip to content

Commit

Permalink
Add loader progressbar
Browse files Browse the repository at this point in the history
  • Loading branch information
domenukk committed Jan 9, 2024
1 parent eaf74e1 commit c528c34
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,9 @@ protected void loadProgramInto(ByteProvider provider, LoadSpec loadSpec, List<Op
memoryHelper = new MemoryBlockHelper(program, messageLog, 0L);
fapi = new FlatProgramAPI(program);

monitor.setMaximum(100);
monitor.incrementProgress(3);

if (!processTOCHeader(reader)) {
throw new LoadException("The file does not look like a Shannon Baseband. TOC Mismatch.");
}
Expand All @@ -334,14 +337,20 @@ protected void loadProgramInto(ByteProvider provider, LoadSpec loadSpec, List<Op
throw new LoadException("The file does not look like a Shannon Baseband. One or more of the required sections [MAIN, BOOT] were not found.");
}

monitor.incrementProgress(10);

PatternFinder finder = new PatternFinder(
provider.getInputStream(sec_main.getOffset()), sec_main.getSize(),
patternDB);

monitor.incrementProgress(5);

// purely informational for now
discoverSocVersion(finder);
monitor.incrementProgress(5);

findShannonPatterns(finder, sec_main);
monitor.incrementProgress(20);

if (mpuTableOffset != -1) {
if (!readMPUTable(reader)) {
Expand All @@ -352,10 +361,12 @@ protected void loadProgramInto(ByteProvider provider, LoadSpec loadSpec, List<Op
throw new LoadException("Error calculating shannon memory map.");
}
}
monitor.incrementProgress(10);

if (!loadBasicTOCSections(provider, sec_boot, sec_main)) {
throw new LoadException("Error loading basic TOC sections.");
}
monitor.incrementProgress(10);

////////////////////////////////////////
// All operations use FlatProgramAPI
Expand All @@ -365,13 +376,16 @@ protected void loadProgramInto(ByteProvider provider, LoadSpec loadSpec, List<Op
if (mpuTableOffset != -1) {
typeMPUTable();
}
monitor.incrementProgress(10);

if (!doScatterload(program, finder, headerMap.get("MAIN").getLoadAddress())) {
Msg.warn(this, "Unable to process scatterload table. This table is used to unpack the MAIN image during baseband boot (runtime relocations). We would like to unpack it at load time in order to capture important regions, like TCM. Without this significant portions of critical code and data may appear to be missing.");
}

Msg.info(this, "==== Finalizing program trees ====");

monitor.incrementProgress(30);

syncProgramTreeWithMemoryMap(program);
organizeProgramTree(program);
}
Expand Down

0 comments on commit c528c34

Please sign in to comment.