mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-10 06:02:09 +00:00
GP-4667 Removed problematic scalar adjustment values for low byte mask
and high byte shift. Also included mask and shift as part of the field option "Include Scalar Reference Adjustment"
This commit is contained in:
parent
2b4036d314
commit
5b8c5644a7
@ -45,12 +45,12 @@ public class CodeUnitFormat {
|
||||
/**
|
||||
* Supported memory address shift cases (bits)
|
||||
*/
|
||||
private static final int[] SHIFT_CASES = new int[] { 1, 2, 8, 16, 32 };
|
||||
private static final int[] SHIFT_CASES = new int[] { 1, 2, 8, 16 };
|
||||
|
||||
/**
|
||||
* Supported memory address mask cases (mask value)
|
||||
*/
|
||||
private static final long[] MASK_CASES = new long[] { 0x0ff, 0x0ffff, 0x0ffffffff };
|
||||
private static final long[] MASK_CASES = new long[] { 0x0ffff, 0x0ffffffff };
|
||||
|
||||
/**
|
||||
* Default code unit format
|
||||
@ -834,29 +834,31 @@ public class CodeUnitFormat {
|
||||
if (addr.isMemoryAddress()) {
|
||||
|
||||
// Include "offset" prefix since addrOffset does not match originalValue
|
||||
list.add("offset ");
|
||||
if (options.includeScalarReferenceAdjustment) {
|
||||
list.add("offset ");
|
||||
|
||||
// Check for shift cases
|
||||
for (int element : SHIFT_CASES) {
|
||||
if ((addrOffset >>> element) == originalValue && originalValue != 0x0) {
|
||||
list.add(opObj);
|
||||
if (options.includeScalarReferenceAdjustment) {
|
||||
list.add(" >>");
|
||||
list.add(Integer.toString(element));
|
||||
// Check for shift cases
|
||||
for (int element : SHIFT_CASES) {
|
||||
if ((addrOffset >>> element) == originalValue && originalValue != 0x0) {
|
||||
list.add(opObj);
|
||||
if (options.includeScalarReferenceAdjustment) {
|
||||
list.add(" >>");
|
||||
list.add(Integer.toString(element));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for mask cases
|
||||
for (long element : MASK_CASES) {
|
||||
if ((addrOffset & element) == originalValue) {
|
||||
list.add(opObj);
|
||||
if (options.includeScalarReferenceAdjustment) {
|
||||
list.add(" &");
|
||||
list.add("0x" + Long.toHexString(element));
|
||||
// Check for mask cases
|
||||
for (long element : MASK_CASES) {
|
||||
if ((addrOffset & element) == originalValue) {
|
||||
list.add(opObj);
|
||||
if (options.includeScalarReferenceAdjustment) {
|
||||
list.add(" &");
|
||||
list.add("0x" + Long.toHexString(element));
|
||||
}
|
||||
return list;
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user