Class Emulator


  • public class Emulator
    extends java.lang.Object
    • Method Detail

      • dispose

        public void dispose()
      • genAddress

        public Address genAddress​(java.lang.String addr)
      • getPC

        public long getPC()
      • getPCRegisterName

        public java.lang.String getPCRegisterName()
      • getFilteredMemState

        public ghidra.app.emulator.FilteredMemoryState getFilteredMemState()
      • addMemoryAccessFilter

        public void addMemoryAccessFilter​(MemoryAccessFilter filter)
      • setExecuteAddress

        public void setExecuteAddress​(long addressableWordOffset)
      • getExecuteAddress

        public Address getExecuteAddress()
      • getLastExecuteAddress

        public Address getLastExecuteAddress()
      • getDefaultContext

        public java.util.Set<java.lang.String> getDefaultContext()
      • setHalt

        public void setHalt​(boolean halt)
      • getHalt

        public boolean getHalt()
      • isAtBreakpoint

        public boolean isAtBreakpoint()
        Returns:
        true if halted at a breakpoint
      • getEmulateExecutionState

        public EmulateExecutionState getEmulateExecutionState()
        Returns:
        emulator execution state. This can be useful within a memory fault handler to determine if a memory read was associated with instruction parsing (i.e., PCODE_EMIT) or normal an actual emulated read (i.e., EXECUTE).
      • isExecuting

        public boolean isExecuting()
        Returns:
        true if emulator is busy executing an instruction
      • disassemble

        public java.util.List<java.lang.String> disassemble​(java.lang.Integer count)
        Disassemble from the current execute address
        Parameters:
        count - number of contiguous instructions to disassemble
        Returns:
        list of instructions
      • getTickCount

        public int getTickCount()
      • getContextRegisterValue

        public RegisterValue getContextRegisterValue()
        Returns the current context register value. The context value returned reflects its state when the previously executed instruction was parsed/executed. The context value returned will feed into the next instruction to be parsed with its non-flowing bits cleared and any future context state merged in.
        Returns:
        context as a RegisterValue object
      • setContextRegisterValue

        public void setContextRegisterValue​(RegisterValue regValue)
        Sets the context register value at the current execute address. The Emulator should not be running when this method is invoked. Only flowing context bits should be set, as non-flowing bits will be cleared prior to parsing on instruction. In addition, any future context state set by the pcode emitter will take precedence over context set using this method. This method is primarily intended to be used to establish the initial context state.
        Parameters:
        regValue - is the value to set context to
      • addProvider

        public void addProvider​(MemoryLoadImage provider,
                                AddressSetView view)
        Add memory load image provider
        Parameters:
        provider - memory load image provider
        view - memory region which corresponds to provider