mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Merge remote-tracking branch 'origin/GP-343_AARCH64neon' into Ghidra_9.2
This commit is contained in:
commit
d3950946e6
23 changed files with 9618 additions and 38765 deletions
|
@ -119,6 +119,7 @@ tokens {
|
|||
OP_SUBTABLE;
|
||||
OP_TABLE;
|
||||
OP_TOKEN;
|
||||
OP_TOKEN_ENDIAN;
|
||||
OP_TRUNCATION_SIZE;
|
||||
OP_TYPE;
|
||||
OP_UNIMPL;
|
||||
|
|
|
@ -183,10 +183,20 @@ tokendef
|
|||
if (sym != null) {
|
||||
redefinedError(sym, n, "token");
|
||||
} else {
|
||||
$tokendef::tokenSymbol = sc.defineToken(find(n), $n.value.getText(), $i.value.intValue());
|
||||
$tokendef::tokenSymbol = sc.defineToken(find(n), $n.value.getText(), $i.value.intValue(), 0);
|
||||
}
|
||||
}
|
||||
} fielddefs)
|
||||
| ^(OP_TOKEN_ENDIAN n=specific_identifier["token definition"] i=integer s=endian {
|
||||
if (n != null) {
|
||||
SleighSymbol sym = sc.findSymbol($n.value.getText());
|
||||
if (sym != null) {
|
||||
redefinedError(sym, n, "token");
|
||||
} else {
|
||||
$tokendef::tokenSymbol = sc.defineToken(find(n), $n.value.getText(), $i.value.intValue(), $s.value ==0 ? -1 : 1);
|
||||
}
|
||||
}
|
||||
} fielddefs)
|
||||
;
|
||||
|
||||
fielddefs
|
||||
|
|
|
@ -60,6 +60,7 @@ aligndef
|
|||
|
||||
tokendef
|
||||
: ^(OP_TOKEN n=identifier i=integer { out("define token " + $n.value + "(" + $i.value + ")"); } fielddefs)
|
||||
| ^(OP_TOKEN_ENDIAN n=identifier i=integer s=endian { out("define token endian" + $n.value + "(" + $i.value + ")"); } fielddefs)
|
||||
;
|
||||
|
||||
fielddefs
|
||||
|
|
|
@ -74,6 +74,7 @@ aligndef
|
|||
|
||||
tokendef
|
||||
: lc=KEY_DEFINE KEY_TOKEN identifier LPAREN integer rp=RPAREN fielddefs[$rp] -> ^(OP_TOKEN[$lc, "define token"] identifier integer fielddefs)
|
||||
| lc=KEY_DEFINE KEY_TOKEN identifier LPAREN integer RPAREN rp=KEY_ENDIAN ASSIGN endian fielddefs[$rp] -> ^(OP_TOKEN_ENDIAN[$lc, "define token"] identifier integer endian fielddefs)
|
||||
;
|
||||
|
||||
fielddefs[Token lc]
|
||||
|
|
|
@ -888,11 +888,13 @@ public class SleighLanguage implements Language {
|
|||
throw new SleighException(".sla file for " + getLanguageID() + " has the wrong format");
|
||||
}
|
||||
boolean isBigEndian = SpecXmlUtils.decodeBoolean(el.getAttribute("bigendian"));
|
||||
// check the instruction endianess, not the program data endianess
|
||||
if (isBigEndian ^ description.getInstructionEndian().isBigEndian()) {
|
||||
throw new SleighException(
|
||||
".ldefs says " + getLanguageID() + " is " + description.getInstructionEndian() +
|
||||
" but .sla says " + el.getAttribute("bigendian"));
|
||||
if (isBigEndian ^ description.getEndian().isBigEndian()) {
|
||||
if (description.getInstructionEndian().isBigEndian() == description.getEndian()
|
||||
.isBigEndian()) {
|
||||
throw new SleighException(
|
||||
".ldefs says " + getLanguageID() + " is " + description.getEndian() +
|
||||
" but .sla says " + el.getAttribute("bigendian"));
|
||||
}
|
||||
}
|
||||
uniqueBase = SpecXmlUtils.decodeLong(el.getAttribute("uniqbase"));
|
||||
alignment = SpecXmlUtils.decodeInt(el.getAttribute("align"));
|
||||
|
|
|
@ -529,8 +529,8 @@ public class SleighCompile extends SleighBase {
|
|||
static int findCollision(Map<Long, Integer> local2Operand, ArrayList<Long> locals,
|
||||
int operand) {
|
||||
Integer boxOperand = Integer.valueOf(operand);
|
||||
for (int i = 0; i < locals.size(); ++i) {
|
||||
Integer previous = local2Operand.putIfAbsent(locals.get(i), boxOperand);
|
||||
for (Long local : locals) {
|
||||
Integer previous = local2Operand.putIfAbsent(local, boxOperand);
|
||||
if (previous != null) {
|
||||
if (previous.intValue() != operand) {
|
||||
return previous.intValue();
|
||||
|
@ -842,7 +842,7 @@ public class SleighCompile extends SleighBase {
|
|||
}
|
||||
|
||||
// Parser functions
|
||||
public TokenSymbol defineToken(Location location, String name, long sz) {
|
||||
public TokenSymbol defineToken(Location location, String name, long sz, int endian) {
|
||||
entry("defineToken", location, name, sz);
|
||||
int size = (int) sz;
|
||||
if ((size & 7) != 0) {
|
||||
|
@ -853,8 +853,15 @@ public class SleighCompile extends SleighBase {
|
|||
else {
|
||||
size = size / 8;
|
||||
}
|
||||
boolean isBig;
|
||||
if (endian == 0) {
|
||||
isBig = isBigEndian();
|
||||
}
|
||||
else {
|
||||
isBig = (endian > 0);
|
||||
}
|
||||
ghidra.pcodeCPort.context.Token newtoken =
|
||||
new ghidra.pcodeCPort.context.Token(name, size, isBigEndian(), tokentable.size());
|
||||
new ghidra.pcodeCPort.context.Token(name, size, isBig, tokentable.size());
|
||||
tokentable.push_back(newtoken);
|
||||
TokenSymbol res = new TokenSymbol(location, newtoken);
|
||||
addSymbol(res);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue