GP-1576 fix NeLoader signed-ness issue

This commit is contained in:
dev747368 2021-12-08 20:35:51 +00:00
parent 01d0ee1d76
commit d3c5223cf2

View file

@ -146,7 +146,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
return; return;
} }
monitor.setMessage("Processing entry table..."); monitor.setMessage("Processing entry table...");
processEntryTable(st, ib, et, symbolTable, space); processEntryTable(st, ib, et, symbolTable, space, log);
if (monitor.isCancelled()) { if (monitor.isCancelled()) {
return; return;
@ -340,7 +340,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
} }
//create a comment to describe this resource... //create a comment to describe this resource...
StringBuffer buf = new StringBuffer(); StringBuilder buf = new StringBuilder();
buf.append("Resource Type: " + Conv.toHexString(type.getTypeID()) + " (" + type + buf.append("Resource Type: " + Conv.toHexString(type.getTypeID()) + " (" + type +
")" + "\n"); ")" + "\n");
buf.append( buf.append(
@ -380,14 +380,10 @@ public class NeLoader extends AbstractLibrarySupportLoader {
listing.createData(straddr, new StringDataType(), listing.createData(straddr, new StringDataType(),
Conv.byteToInt(string.getLength())); Conv.byteToInt(string.getLength()));
} }
catch (AddressOverflowException e) { catch (AddressOverflowException | CodeUnitInsertionException
//TODO: | DataTypeConflictException e) {
} log.appendMsg("Error creating data");
catch (CodeUnitInsertionException e) { log.appendException(e);
//TODO:
}
catch (DataTypeConflictException e) {
//TODO:
} }
} }
} }
@ -507,7 +503,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
} }
private void processEntryTable(SegmentTable st, InformationBlock ib, EntryTable et, private void processEntryTable(SegmentTable st, InformationBlock ib, EntryTable et,
SymbolTable symbolTable, SegmentedAddressSpace space) { SymbolTable symbolTable, SegmentedAddressSpace space, MessageLog log) {
//process the main entry point defined in the information block... //process the main entry point defined in the information block...
short segmentIdx = ib.getEntryPointSegment(); short segmentIdx = ib.getEntryPointSegment();
@ -520,8 +516,8 @@ public class NeLoader extends AbstractLibrarySupportLoader {
symbolTable.createLabel(entryAddr, "entry", SourceType.IMPORTED); symbolTable.createLabel(entryAddr, "entry", SourceType.IMPORTED);
} }
catch (InvalidInputException e) { catch (InvalidInputException e) {
// TODO Auto-generated catch block log.appendMsg("Error creating label at " + entryAddr);
e.printStackTrace(); log.appendException(e);
} }
} }
@ -539,11 +535,16 @@ public class NeLoader extends AbstractLibrarySupportLoader {
for (EntryPoint pt : pts) { for (EntryPoint pt : pts) {
int seg = 0; int seg = 0;
if (bundle.isMoveable()) { if (bundle.isMoveable()) {
seg = st.getSegments()[pt.getSegment() - 1].getSegmentID(); int segmentIndex = Byte.toUnsignedInt(pt.getSegment()) - 1;
if (segmentIndex < 0 || segmentIndex >= st.getSegments().length) {
log.appendMsg("Invalid segmentIndex " + segmentIndex);
continue;
}
seg = st.getSegments()[segmentIndex].getSegmentID();
} }
else if (bundle.isConstant()) { else if (bundle.isConstant()) {
//todo: how to handle constants...? //todo: how to handle constants...?
System.out.println("NE - constant entry point..."); log.appendMsg("NE - constant entry point...");
} }
else { else {
seg = st.getSegments()[bundle.getType() - 1].getSegmentID(); seg = st.getSegments()[bundle.getType() - 1].getSegmentID();
@ -785,8 +786,7 @@ public class NeLoader extends AbstractLibrarySupportLoader {
SourceType.IMPORTED); SourceType.IMPORTED);
} }
catch (InvalidInputException e) { catch (InvalidInputException e) {
// TODO Auto-generated catch block Msg.error(this, "Error creating label " + name + "@" + addr, e);
e.printStackTrace();
} }
} }
} }