mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Refactor getBaseSpaceID -> getSpaceID
This commit is contained in:
parent
875eed4c3b
commit
93c8171ffa
28 changed files with 172 additions and 126 deletions
|
@ -1,6 +1,5 @@
|
|||
/* ###
|
||||
* IP: GHIDRA
|
||||
* REVIEWED: YES
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,11 +15,14 @@
|
|||
*/
|
||||
package ghidra.app.plugin.processors.generic;
|
||||
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.mem.MemBuffer;
|
||||
import ghidra.program.model.pcode.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Hashtable;
|
||||
|
||||
import java.util.*;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.program.model.address.AddressSpace;
|
||||
import ghidra.program.model.mem.MemBuffer;
|
||||
import ghidra.program.model.pcode.PcodeOp;
|
||||
import ghidra.program.model.pcode.Varnode;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -50,7 +52,7 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
right = r;
|
||||
wordSize = c.getSize()/8;
|
||||
// wordMask = c.getMaxOffset();
|
||||
spaceID = c.getBaseSpaceID();
|
||||
spaceID = c.getSpaceID();
|
||||
constantSpace = c;
|
||||
switch (opType) {
|
||||
case ADD:
|
||||
|
@ -65,11 +67,12 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
}
|
||||
|
||||
public void setSpace(AddressSpace space) {
|
||||
spaceID = space.getBaseSpaceID();
|
||||
spaceID = space.getSpaceID();
|
||||
wordSize = space.getSize()/8;
|
||||
// wordMask = space.getMaxOffset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int length(MemBuffer buf,int off) throws Exception {
|
||||
int leftLen = left.length(buf,off);
|
||||
int rightLen = right.length(buf, off);
|
||||
|
@ -77,10 +80,12 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
return (leftLen > rightLen ? leftLen : rightLen);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConstructorInfo getInfo(MemBuffer buf, int off) throws Exception {
|
||||
return new ConstructorInfo(length(buf,off),0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long longValue(MemBuffer buf, int off) throws Exception {
|
||||
|
||||
long l = left.longValue(buf, off);
|
||||
|
@ -98,9 +103,12 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString(MemBuffer buf, int off) throws Exception {
|
||||
long val = longValue(buf, off);
|
||||
if (val >= 0) return "0x" + Long.toString(val,16);
|
||||
if (val >= 0) {
|
||||
return "0x" + Long.toString(val,16);
|
||||
}
|
||||
return "-0x" + Long.toString(-val,16);
|
||||
}
|
||||
|
||||
|
@ -113,6 +121,7 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
right.linkRelativeOffsets(opHash);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Handle getHandle(Position position, int off) throws Exception {
|
||||
long val = /* wordMask & */ longValue(position.buffer(),off);
|
||||
Address a = constantSpace.getAddress(val);
|
||||
|
@ -120,10 +129,12 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
return new Handle(v,spaceID,wordSize);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Handle getHandle(ArrayList<PcodeOp> pcode, Position position, int off) throws Exception {
|
||||
return getHandle(position,off); // a binary expression never has any associated pcode
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getAllHandles(ArrayList<Handle> handles,Position position,int off) throws Exception {
|
||||
handles.add(getHandle(position,off));
|
||||
}
|
||||
|
@ -131,6 +142,7 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
/* (non-Javadoc)
|
||||
* @see ghidra.app.plugin.processors.generic.OperandValue#toList(java.util.ArrayList, ghidra.program.model.mem.MemBuffer, int)
|
||||
*/
|
||||
@Override
|
||||
public void toList(ArrayList<Handle> list, Position position, int off) throws Exception {
|
||||
list.add(getHandle(position, off));
|
||||
}
|
||||
|
@ -138,6 +150,7 @@ public class BinaryExpression implements OperandValue, ExpressionValue {
|
|||
/* (non-Javadoc)
|
||||
* @see ghidra.app.plugin.processors.generic.OperandValue#getSize()
|
||||
*/
|
||||
@Override
|
||||
public int getSize() {
|
||||
return wordSize * 8;
|
||||
}
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
*/
|
||||
package ghidra.app.plugin.processors.generic;
|
||||
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@ -101,7 +101,7 @@ public class ConstantTemplate implements Serializable {
|
|||
|
||||
case JUMP_CODESPACE:
|
||||
Address addr = position.buffer().getAddress();
|
||||
return addr.getAddressSpace().getBaseSpaceID();
|
||||
return addr.getAddressSpace().getSpaceID();
|
||||
|
||||
default: // Should never reach here
|
||||
return 0;
|
||||
|
@ -114,8 +114,9 @@ public class ConstantTemplate implements Serializable {
|
|||
* @return long
|
||||
*/
|
||||
public long resolve(HashMap<Object, Handle> handles, Position position, int off) throws Exception {
|
||||
if (type == HANDLE)
|
||||
if (type == HANDLE) {
|
||||
return handles.get(op).getLong(select1,select2);
|
||||
}
|
||||
return resolve(position,off);
|
||||
}
|
||||
|
||||
|
@ -126,14 +127,26 @@ public class ConstantTemplate implements Serializable {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (o.getClass() != ConstantTemplate.class) return false;
|
||||
if (o.getClass() != ConstantTemplate.class) {
|
||||
return false;
|
||||
}
|
||||
ConstantTemplate ct = (ConstantTemplate) o;
|
||||
if (ct.hashCode() != hashCode) return false;
|
||||
if (ct.type() != type) return false;
|
||||
if (ct.hashCode() != hashCode) {
|
||||
return false;
|
||||
}
|
||||
if (ct.type() != type) {
|
||||
return false;
|
||||
}
|
||||
if (type == HANDLE) {
|
||||
if (!ct.operand().equals(op)) return false;
|
||||
if (ct.select1() != select1) return false;
|
||||
if (ct.select2() != select2) return false;
|
||||
if (!ct.operand().equals(op)) {
|
||||
return false;
|
||||
}
|
||||
if (ct.select1() != select1) {
|
||||
return false;
|
||||
}
|
||||
if (ct.select2() != select2) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -498,7 +498,7 @@ public abstract class PcodeEmit {
|
|||
dyncache[2].size = incache[i].size;
|
||||
AddressSpace spc = generatePointer(vn, dyncache[1]);
|
||||
dyncache[0].space = const_space;
|
||||
dyncache[0].offset = spc.getBaseSpaceID();
|
||||
dyncache[0].offset = spc.getSpaceID();
|
||||
dyncache[0].size = 4; // Size of spaceid
|
||||
dump(startAddress, PcodeOp.LOAD, dyncache, 2, dyncache[2]);
|
||||
numOps += 1;
|
||||
|
@ -529,7 +529,7 @@ public abstract class PcodeEmit {
|
|||
dyncache[2].size = outcache.size;
|
||||
AddressSpace spc = generatePointer(outvn, dyncache[1]);
|
||||
dyncache[0].space = const_space;
|
||||
dyncache[0].offset = spc.getBaseSpaceID();
|
||||
dyncache[0].offset = spc.getSpaceID();
|
||||
dyncache[0].size = 4; // Size of spaceid;
|
||||
dump(startAddress, PcodeOp.STORE, dyncache, 3, null);
|
||||
numOps += 1;
|
||||
|
@ -738,7 +738,7 @@ public abstract class PcodeEmit {
|
|||
AddressSpace space = uniqueFactory.getAddressFactory().getAddressSpace(spaceId);
|
||||
if (space.isOverlaySpace()) {
|
||||
space = ((OverlayAddressSpace) space).getOverlayedSpace();
|
||||
in[0].offset = space.getBaseSpaceID();
|
||||
in[0].offset = space.getSpaceID();
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < isize; ++i) {
|
||||
|
|
|
@ -96,14 +96,16 @@ public class ConstTpl {
|
|||
}
|
||||
|
||||
public boolean isConstSpace() {
|
||||
if (type == SPACEID)
|
||||
if (type == SPACEID) {
|
||||
return (value_spaceid.getType() == AddressSpace.TYPE_CONSTANT);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isUniqueSpace() {
|
||||
if (type == SPACEID)
|
||||
if (type == SPACEID) {
|
||||
return (value_spaceid.getType() == AddressSpace.TYPE_UNIQUE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -140,32 +142,38 @@ public class ConstTpl {
|
|||
case J_CURSPACE_SIZE:
|
||||
return walker.getCurSpace().getPointerSize();
|
||||
case J_CURSPACE:
|
||||
return walker.getCurSpace().getBaseSpaceID();
|
||||
return walker.getCurSpace().getSpaceID();
|
||||
case HANDLE: {
|
||||
FixedHandle hand = walker.getFixedHandle(handle_index);
|
||||
switch (select) {
|
||||
case V_SPACE:
|
||||
if (hand.offset_space == null)
|
||||
return hand.space.getBaseSpaceID();
|
||||
return hand.temp_space.getBaseSpaceID();
|
||||
if (hand.offset_space == null) {
|
||||
return hand.space.getSpaceID();
|
||||
}
|
||||
return hand.temp_space.getSpaceID();
|
||||
case V_OFFSET:
|
||||
if (hand.offset_space == null)
|
||||
if (hand.offset_space == null) {
|
||||
return hand.offset_offset;
|
||||
}
|
||||
return hand.temp_offset;
|
||||
case V_SIZE:
|
||||
return hand.size;
|
||||
case V_OFFSET_PLUS:
|
||||
if (hand.space.getType() != AddressSpace.TYPE_CONSTANT) { // If we are not a constant
|
||||
if (hand.offset_space == null)
|
||||
{
|
||||
return hand.offset_offset + (value_real & 0xffff); // Adjust offset by truncation amount
|
||||
}
|
||||
return hand.temp_offset + (value_real & 0xffff);
|
||||
}
|
||||
// If we are a constant, shift by the truncation amount
|
||||
long val;
|
||||
if (hand.offset_space == null)
|
||||
if (hand.offset_space == null) {
|
||||
val = hand.offset_offset;
|
||||
else
|
||||
}
|
||||
else {
|
||||
val = hand.temp_offset;
|
||||
}
|
||||
val >>= 8 * (value_real >> 16);
|
||||
return val;
|
||||
}
|
||||
|
@ -175,7 +183,7 @@ public class ConstTpl {
|
|||
case REAL:
|
||||
return value_real;
|
||||
case SPACEID:
|
||||
return value_spaceid.getBaseSpaceID();
|
||||
return value_spaceid.getSpaceID();
|
||||
}
|
||||
return 0; // Should never reach here
|
||||
}
|
||||
|
@ -188,8 +196,9 @@ public class ConstTpl {
|
|||
FixedHandle hand = walker.getFixedHandle(handle_index);
|
||||
switch (select) {
|
||||
case V_SPACE:
|
||||
if (hand.offset_space == null)
|
||||
if (hand.offset_space == null) {
|
||||
return hand.space;
|
||||
}
|
||||
return hand.temp_space;
|
||||
default:
|
||||
break;
|
||||
|
@ -272,18 +281,22 @@ public class ConstTpl {
|
|||
type = HANDLE;
|
||||
handle_index = (short) SpecXmlUtils.decodeInt(el.getAttribute("val"));
|
||||
String selstr = el.getAttribute("s");
|
||||
if (selstr.equals("space"))
|
||||
if (selstr.equals("space")) {
|
||||
select = V_SPACE;
|
||||
else if (selstr.equals("offset"))
|
||||
}
|
||||
else if (selstr.equals("offset")) {
|
||||
select = V_OFFSET;
|
||||
else if (selstr.equals("size"))
|
||||
}
|
||||
else if (selstr.equals("size")) {
|
||||
select = V_SIZE;
|
||||
}
|
||||
else if (selstr.equals("offset_plus")) {
|
||||
select = V_OFFSET_PLUS;
|
||||
value_real = SpecXmlUtils.decodeLong(el.getAttribute("plus"));
|
||||
}
|
||||
else
|
||||
else {
|
||||
throw new SleighException("Bad handle selector");
|
||||
}
|
||||
}
|
||||
else if (typestr.equals("start")) {
|
||||
type = J_START;
|
||||
|
@ -317,8 +330,9 @@ public class ConstTpl {
|
|||
else if (typestr.equals("flowdest_size")) {
|
||||
type = J_FLOWDEST_SIZE;
|
||||
}
|
||||
else
|
||||
else {
|
||||
throw new SleighException("Bad xml for ConstTpl");
|
||||
}
|
||||
parser.end(el);
|
||||
}
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@ public class ProgramAddressFactory extends DefaultAddressFactory {
|
|||
@Override
|
||||
public Address getAddress(int spaceID, long offset) {
|
||||
Address addr = super.getAddress(spaceID, offset);
|
||||
if (addr == null && spaceID == stackSpace.getUniqueSpaceID()) {
|
||||
if (addr == null && spaceID == stackSpace.getSpaceID()) {
|
||||
return stackSpace.getAddress(offset);
|
||||
}
|
||||
return addr;
|
||||
|
|
|
@ -282,9 +282,13 @@ abstract class AbstractAddressSpace implements AddressSpace {
|
|||
public long subtract(Address addr1, Address addr2) {
|
||||
AddressSpace space1 = addr1.getAddressSpace();
|
||||
AddressSpace space2 = addr2.getAddressSpace();
|
||||
if (!addr1.getAddressSpace().equals(addr2.getAddressSpace())) {
|
||||
if (!space1.equals(space2)) {
|
||||
// if the two spaces are actually based in the same space, calculate the offset
|
||||
if (space1.getBaseSpaceID() != space2.getBaseSpaceID()) {
|
||||
int base1 = space1.isOverlaySpace() ? ((OverlayAddressSpace) space1).getBaseSpaceID()
|
||||
: space1.getSpaceID();
|
||||
int base2 = space2.isOverlaySpace() ? ((OverlayAddressSpace) space2).getBaseSpaceID()
|
||||
: space2.getSpaceID();
|
||||
if (base1 != base2) {
|
||||
throw new IllegalArgumentException("Address are in different spaces " +
|
||||
addr1.getAddressSpace().getName() + " != " + addr2.getAddressSpace().getName());
|
||||
}
|
||||
|
@ -478,8 +482,9 @@ abstract class AbstractAddressSpace implements AddressSpace {
|
|||
return minAddress;
|
||||
}
|
||||
|
||||
private int compareToOverlaySpace(AddressSpace overlaySpace) {
|
||||
int baseCompare = getBaseSpaceID() - overlaySpace.getBaseSpaceID();
|
||||
private int compareAsOverlaySpace(AddressSpace overlaySpace) {
|
||||
int baseCompare = ((OverlayAddressSpace) this).getBaseSpaceID() -
|
||||
((OverlayAddressSpace) overlaySpace).getBaseSpaceID();
|
||||
if (baseCompare == 0) {
|
||||
long otherMinOffset = overlaySpace.getMinAddress().getOffset();
|
||||
if (minOffset == otherMinOffset) {
|
||||
|
@ -498,7 +503,7 @@ abstract class AbstractAddressSpace implements AddressSpace {
|
|||
if (isOverlaySpace()) {
|
||||
if (space.isOverlaySpace()) {
|
||||
// Both spaces are overlay spaces
|
||||
return compareToOverlaySpace(space);
|
||||
return compareAsOverlaySpace(space);
|
||||
}
|
||||
// I'm an overlay, other space is NOT an overlay
|
||||
return 1;
|
||||
|
@ -519,7 +524,7 @@ abstract class AbstractAddressSpace implements AddressSpace {
|
|||
// source within a list/set of addresses from a second source.
|
||||
return 0;
|
||||
}
|
||||
int c = getBaseSpaceID() - space.getBaseSpaceID();
|
||||
int c = getSpaceID() - space.getSpaceID();
|
||||
if (c == 0) {
|
||||
c = getClass().getName().compareTo(space.getClass().getName());
|
||||
}
|
||||
|
@ -557,12 +562,7 @@ abstract class AbstractAddressSpace implements AddressSpace {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int getBaseSpaceID() {
|
||||
return spaceID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getUniqueSpaceID() {
|
||||
public int getSpaceID() {
|
||||
return spaceID;
|
||||
}
|
||||
|
||||
|
|
|
@ -111,9 +111,7 @@ public interface AddressSpace extends Comparable<AddressSpace> {
|
|||
*
|
||||
* @return space ID
|
||||
*/
|
||||
int getBaseSpaceID();
|
||||
|
||||
int getUniqueSpaceID();
|
||||
int getSpaceID();
|
||||
|
||||
/** Returns the number of bits that are used to form the address. Thus
|
||||
* the maximum offset for this address space will be 2^size-1.
|
||||
|
|
|
@ -71,7 +71,7 @@ public class DefaultAddressFactory implements AddressFactory {
|
|||
this.defaultSpace = space;
|
||||
}
|
||||
spaceNameTable.put(space.getName(), space);
|
||||
spaceLookup.put(space.getUniqueSpaceID(), space);
|
||||
spaceLookup.put(space.getSpaceID(), space);
|
||||
if (space.getType() == AddressSpace.TYPE_CONSTANT) {
|
||||
constantSpace = space;
|
||||
}
|
||||
|
@ -270,7 +270,7 @@ public class DefaultAddressFactory implements AddressFactory {
|
|||
@Override
|
||||
public long getIndex(Address addr) {
|
||||
AddressSpace space = addr.getAddressSpace();
|
||||
int id = space.getUniqueSpaceID();
|
||||
int id = space.getSpaceID();
|
||||
if (spaceLookup.get(id) == null) {
|
||||
spaceLookup.put(id, space);
|
||||
}
|
||||
|
@ -385,7 +385,7 @@ public class DefaultAddressFactory implements AddressFactory {
|
|||
}
|
||||
spaces.add(space);
|
||||
spaceNameTable.put(space.getName(), space);
|
||||
spaceLookup.put(space.getUniqueSpaceID(), space);
|
||||
spaceLookup.put(space.getSpaceID(), space);
|
||||
|
||||
if (space.isMemorySpace()) {
|
||||
memoryAddressSet.addRange(space.getMinAddress(), space.getMaxAddress());
|
||||
|
@ -415,7 +415,7 @@ public class DefaultAddressFactory implements AddressFactory {
|
|||
if (deletedSpace != null) {
|
||||
spaces.remove(deletedSpace);
|
||||
spaceNameTable.remove(deletedSpace.getName());
|
||||
spaceLookup.remove(deletedSpace.getUniqueSpaceID());
|
||||
spaceLookup.remove(deletedSpace.getSpaceID());
|
||||
if (deletedSpace.getType() == AddressSpace.TYPE_RAM ||
|
||||
deletedSpace.getType() == AddressSpace.TYPE_CODE) {
|
||||
memoryAddressSet.deleteRange(deletedSpace.getMinAddress(),
|
||||
|
|
|
@ -96,8 +96,12 @@ public class OverlayAddressSpace extends AbstractAddressSpace {
|
|||
public long subtract(Address addr1, Address addr2) {
|
||||
AddressSpace space1 = addr1.getAddressSpace();
|
||||
AddressSpace space2 = addr2.getAddressSpace();
|
||||
if (space1.equals(this)) space1 = originalSpace;
|
||||
if (space2.equals(this)) space2 = originalSpace;
|
||||
if (space1.equals(this)) {
|
||||
space1 = originalSpace;
|
||||
}
|
||||
if (space2.equals(this)) {
|
||||
space2 = originalSpace;
|
||||
}
|
||||
if (!space1.equals(space2)) {
|
||||
throw new IllegalArgumentException("Address are in different spaces " +
|
||||
addr1.getAddressSpace().getName() + " != " + addr2.getAddressSpace().getName());
|
||||
|
@ -204,9 +208,11 @@ public class OverlayAddressSpace extends AbstractAddressSpace {
|
|||
return new GenericAddress(originalSpace, addr.getOffset());
|
||||
}
|
||||
|
||||
@Override
|
||||
/**
|
||||
* @return the ID of the address space underlying this space
|
||||
*/
|
||||
public int getBaseSpaceID() {
|
||||
return originalSpace.getBaseSpaceID();
|
||||
return originalSpace.getSpaceID();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -50,7 +50,7 @@ public class Varnode {
|
|||
public Varnode(Address a, int sz) {
|
||||
address = a;
|
||||
AddressSpace space = address.getAddressSpace();
|
||||
spaceID = space.getBaseSpaceID();
|
||||
spaceID = space.getSpaceID();
|
||||
size = sz;
|
||||
offset = address.getOffset();
|
||||
}
|
||||
|
@ -127,7 +127,7 @@ public class Varnode {
|
|||
* @return true if this varnode contains the specified address
|
||||
*/
|
||||
public boolean contains(Address address) {
|
||||
if (spaceID != address.getAddressSpace().getUniqueSpaceID()) {
|
||||
if (spaceID != address.getAddressSpace().getSpaceID()) {
|
||||
return false;
|
||||
}
|
||||
if (isConstant() || isUnique() || isHash()) {
|
||||
|
@ -193,7 +193,7 @@ public class Varnode {
|
|||
}
|
||||
for (AddressRange range : set.getAddressRanges()) {
|
||||
Address minAddr = range.getMinAddress();
|
||||
if (minAddr.getAddressSpace().getUniqueSpaceID() != spaceID) {
|
||||
if (minAddr.getAddressSpace().getSpaceID() != spaceID) {
|
||||
continue;
|
||||
}
|
||||
Address maxAddr = range.getMaxAddress();
|
||||
|
@ -244,7 +244,7 @@ public class Varnode {
|
|||
}
|
||||
|
||||
public boolean isHash() {
|
||||
return spaceID == AddressSpace.HASH_SPACE.getUniqueSpaceID();
|
||||
return spaceID == AddressSpace.HASH_SPACE.getSpaceID();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -588,7 +588,7 @@ public class Varnode {
|
|||
String localName = el.getName();
|
||||
if (localName.equals("spaceid")) {
|
||||
AddressSpace spc = addrFactory.getAddressSpace(el.getAttribute("name"));
|
||||
int spaceid = spc.getBaseSpaceID();
|
||||
int spaceid = spc.getSpaceID();
|
||||
spc = addrFactory.getConstantSpace();
|
||||
return spc.getAddress(spaceid);
|
||||
}
|
||||
|
@ -613,7 +613,7 @@ public class Varnode {
|
|||
AddressFactory addrFactory) {
|
||||
if (localName.equals("spaceid")) {
|
||||
AddressSpace spc = addrFactory.getAddressSpace(attr.getValue("name"));
|
||||
int spaceid = spc.getBaseSpaceID();
|
||||
int spaceid = spc.getSpaceID();
|
||||
spc = addrFactory.getConstantSpace();
|
||||
return spc.getAddress(spaceid);
|
||||
}
|
||||
|
@ -658,7 +658,7 @@ public class Varnode {
|
|||
if (nameend >= 0) {
|
||||
AddressSpace spc =
|
||||
addrfactory.getAddressSpace(addrstring.substring(attrstart, nameend));
|
||||
int spaceid = spc.getBaseSpaceID();
|
||||
int spaceid = spc.getSpaceID();
|
||||
spc = addrfactory.getConstantSpace();
|
||||
return spc.getAddress(spaceid);
|
||||
}
|
||||
|
|
|
@ -550,7 +550,7 @@ public class RefTypeFactory {
|
|||
}
|
||||
}
|
||||
else if (op.getOpcode() == PcodeOp.LOAD) {
|
||||
if (memAddr.getAddressSpace().getUniqueSpaceID() == inputs[0].getOffset() &&
|
||||
if (memAddr.getAddressSpace().getSpaceID() == inputs[0].getOffset() &&
|
||||
(memOffset == inputs[1].getOffset() || inputs[1].equals(offsetVarnode))) {
|
||||
if (refType != null && refType.isWrite()) {
|
||||
return RefType.READ_WRITE;
|
||||
|
|
|
@ -300,16 +300,22 @@ public class SimpleDiffUtility {
|
|||
Program otherProgram) {
|
||||
AddressSpace otherSpace =
|
||||
otherProgram.getAddressFactory().getAddressSpace(addrSpace.getName());
|
||||
if (otherSpace != null && otherSpace.getType() == addrSpace.getType() &&
|
||||
otherSpace.getBaseSpaceID() == addrSpace.getBaseSpaceID()) {
|
||||
if (otherSpace.isOverlaySpace()) {
|
||||
long addrOffset = addrSpace.getMinAddress().getOffset();
|
||||
long otherOffset = otherSpace.getMinAddress().getOffset();
|
||||
if (addrOffset != otherOffset) {
|
||||
return null; // Overlays didn't begin at same address.
|
||||
if (otherSpace != null && otherSpace.getType() == addrSpace.getType()) {
|
||||
int id = addrSpace.isOverlaySpace() ? ((OverlayAddressSpace) addrSpace).getBaseSpaceID()
|
||||
: addrSpace.getSpaceID();
|
||||
int otherid =
|
||||
otherSpace.isOverlaySpace() ? ((OverlayAddressSpace) otherSpace).getBaseSpaceID()
|
||||
: otherSpace.getSpaceID();
|
||||
if (id == otherid) {
|
||||
if (otherSpace.isOverlaySpace()) {
|
||||
long addrOffset = addrSpace.getMinAddress().getOffset();
|
||||
long otherOffset = otherSpace.getMinAddress().getOffset();
|
||||
if (addrOffset != otherOffset) {
|
||||
return null; // Overlays didn't begin at same address.
|
||||
}
|
||||
}
|
||||
return otherSpace;
|
||||
}
|
||||
return otherSpace;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue