mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-02-16 15:40:14 +00:00
GP-0 Corrected loongarch ilp32f pentry sizing issue. Improved cspec
parse error reporting to include line number.
This commit is contained in:
parent
ece2739b29
commit
e65bede08b
@ -139,11 +139,9 @@ public class SleighLanguageValidator {
|
||||
throw new SleighException(
|
||||
specFile + " is not properly case dependent: " + result.getMessage());
|
||||
}
|
||||
try {
|
||||
InputStream in = specFile.getInputStream();
|
||||
try (InputStream in = specFile.getInputStream()) {
|
||||
verifier.setErrorHandler(new VerifierErrorHandler(specFile));
|
||||
verifier.verify(new InputSource(in));
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SleighException(
|
||||
@ -211,11 +209,9 @@ public class SleighLanguageValidator {
|
||||
catch (Exception e) {
|
||||
throw new SleighException("Error creating verifier", e);
|
||||
}
|
||||
try {
|
||||
InputStream in = fileToValidate.getInputStream();
|
||||
try (InputStream in = fileToValidate.getInputStream()) {
|
||||
verifier.setErrorHandler(new VerifierErrorHandler(fileToValidate));
|
||||
verifier.verify(new InputSource(in));
|
||||
in.close();
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new SleighException(
|
||||
|
@ -121,36 +121,41 @@ public class BasicCompilerSpec implements CompilerSpec {
|
||||
Exception parseException = null;
|
||||
|
||||
ErrorHandler errHandler = getErrorHandler(cspecFile.toString());
|
||||
InputStream stream;
|
||||
XmlPullParser parser = null;
|
||||
try {
|
||||
SleighLanguageValidator.validateCspecFile(cspecFile);
|
||||
|
||||
stream = cspecFile.getInputStream();
|
||||
XmlPullParser parser =
|
||||
XmlPullParserFactory.create(stream, cspecFile.getAbsolutePath(), errHandler, false);
|
||||
initialize(cspecFile.getAbsolutePath(), parser);
|
||||
stream.close();
|
||||
try (InputStream stream = cspecFile.getInputStream()) {
|
||||
parser = XmlPullParserFactory.create(stream, cspecFile.getAbsolutePath(),
|
||||
errHandler, false);
|
||||
initialize(cspecFile.getAbsolutePath(), parser);
|
||||
}
|
||||
|
||||
if (models == null || models.length == 0) {
|
||||
throw new SAXException("No prototype models defined");
|
||||
}
|
||||
}
|
||||
catch (SleighException e) {
|
||||
catch (Exception e) {
|
||||
parseException = e;
|
||||
Throwable cause = e.getCause(); // Recover the cause (from the validator exception)
|
||||
if (cause != null) {
|
||||
if (cause instanceof SAXException || cause instanceof IOException) {
|
||||
parseException = (Exception) cause;
|
||||
if (e instanceof SleighException) {
|
||||
Throwable cause = e.getCause(); // Recover the cause (from the validator exception)
|
||||
if (cause != null) {
|
||||
if (cause instanceof SAXException || cause instanceof IOException) {
|
||||
parseException = (Exception) cause;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (IOException | SAXException | XmlParseException | DuplicateNameException e) {
|
||||
parseException = e;
|
||||
}
|
||||
|
||||
if (parseException != null) {
|
||||
String lineInfo = "";
|
||||
if (parser != null) {
|
||||
lineInfo = ":" + parser.getLineNumber();
|
||||
}
|
||||
throw new CompilerSpecNotFoundException(language.getLanguageID(),
|
||||
description.getCompilerSpecID(), cspecFile.getName(), parseException);
|
||||
description.getCompilerSpecID(), cspecFile.getName() + lineInfo, parseException);
|
||||
}
|
||||
finally {
|
||||
if (parser != null) {
|
||||
parser.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1084,8 +1089,7 @@ public class BasicCompilerSpec implements CompilerSpec {
|
||||
|
||||
@Override
|
||||
public PrototypeModel matchConvention(String conventionName) {
|
||||
if (conventionName == null ||
|
||||
CALLING_CONVENTION_unknown.equals(conventionName) ||
|
||||
if (conventionName == null || CALLING_CONVENTION_unknown.equals(conventionName) ||
|
||||
CALLING_CONVENTION_default.equals(conventionName)) {
|
||||
return defaultModel;
|
||||
}
|
||||
|
@ -29,28 +29,28 @@
|
||||
<default_proto>
|
||||
<prototype name="__stdcall" extrapop="0" stackshift="0">
|
||||
<input>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa0"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa1"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa2"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa3"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa4"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa5"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa6"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa7"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="4">
|
||||
@ -94,7 +94,7 @@
|
||||
</pentry>
|
||||
</input>
|
||||
<output>
|
||||
<pentry minsize="1" maxsize="8" metatype="float">
|
||||
<pentry minsize="1" maxsize="4" metatype="float">
|
||||
<register name="fa0"/>
|
||||
</pentry>
|
||||
<pentry minsize="1" maxsize="4">
|
||||
|
@ -29,6 +29,19 @@
|
||||
<external_name tool="gnu" name="Loongarch32"/>
|
||||
</language>
|
||||
|
||||
<language processor="Loongarch"
|
||||
endian="little"
|
||||
size="64"
|
||||
variant="lp64f"
|
||||
version="1.0"
|
||||
slafile="loongarch64_f32.sla"
|
||||
processorspec="loongarch64.pspec"
|
||||
manualindexfile="../manuals/loongarch.idx"
|
||||
id="Loongarch:LE:64:lp64f">
|
||||
<description>Loongson 3 64-bit with 32-bit FP</description>
|
||||
<compiler name="default" spec="lp64f.cspec" id="default"/>
|
||||
<external_name tool="gnu" name="Loongarch64"/>
|
||||
</language>
|
||||
|
||||
<language processor="Loongarch"
|
||||
endian="little"
|
||||
@ -43,19 +56,5 @@
|
||||
<compiler name="default" spec="lp64d.cspec" id="default"/>
|
||||
<external_name tool="gnu" name="Loongarch64"/>
|
||||
</language>
|
||||
|
||||
<language processor="Loongarch"
|
||||
endian="little"
|
||||
size="64"
|
||||
variant="lp64f"
|
||||
version="1.0"
|
||||
slafile="loongarch64_f32.sla"
|
||||
processorspec="loongarch64.pspec"
|
||||
manualindexfile="../manuals/loongarch.idx"
|
||||
id="Loongarch:LE:64:lp64f">
|
||||
<description>Loongson 3 64-bit with 64-bit FP</description>
|
||||
<compiler name="default" spec="lp64f.cspec" id="default"/>
|
||||
<external_name tool="gnu" name="Loongarch64"/>
|
||||
</language>
|
||||
|
||||
</language_definitions>
|
Loading…
Reference in New Issue
Block a user