Java Code Examples for ghidra.program.model.address.AddressSpace#getUnique()

The following examples show how to use ghidra.program.model.address.AddressSpace#getUnique() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MemoryState.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * MemoryBanks associated with specific address spaces must be registers with this MemoryState
 * via this method.  Each address space that will be used during emulation must be registered
 * separately.  The MemoryState object does not assume responsibility for freeing the MemoryBank.
 * @param bank is a pointer to the MemoryBank to be registered
 */
public final void setMemoryBank(MemoryBank bank) {
	AddressSpace spc = bank.getSpace();
	int index = spc.getUnique();

	while (index >= memspace.size())
		memspace.push_back(null);

	memspace.set(index, bank);
}
 
Example 2
Source File: MemoryState.java    From ghidra with Apache License 2.0 5 votes vote down vote up
/**
 * Any MemoryBank that has been registered with this MemoryState can be retrieved via this
 * method if the MemoryBank's associated address space is known.
 * @param spc is the address space of the desired MemoryBank
 * @return the MemoryBank or null if no bank is associated with spc.
 */
public final MemoryBank getMemoryBank(AddressSpace spc) {
	int index = spc.getUnique();
	if (index >= memspace.size())
		return null;
	return memspace.get(index);
}