cpu_instruction_query
interface can be used in functions
of the following types:
cpu_instruction_cb_t
cpu_cached_instruction_cb_t
cpu_instruction_decoder_cb_t
where an instruction_handle_t
pointer is available. The
handle is only valid in the callback. The interface is used to request
information about the instruction being executed by the processor
cpu.
SIM_INTERFACE(cpu_instruction_query) { logical_address_t (*logical_address)( conf_object_t *cpu, instruction_handle_t *handle); physical_address_t (*physical_address)( conf_object_t *cpu, instruction_handle_t *handle); cpu_bytes_t (*get_instruction_bytes)( conf_object_t *cpu, instruction_handle_t *handle); }; #define CPU_INSTRUCTION_QUERY_INTERFACE "cpu_instruction_query"
The logical_address and physical_address is used to get the different addresses of the instruction being executed.
Note that if the instruction crosses a page boundary the last part of the
instruction will have a different mapping for the physical address than
returned by physical_address. To get hold of the physical address
on the second page, use the logical_to_physical method of the
processor_info(_v2)
and provide the logical address of the
first byte on the second page.
The get_instruction_bytes method is used to read the instruction bytes. The returned data is of a cpu_bytes_t type that contains the data and the size. The data member is only available during the execution of the callback. The data cannot be changed. Corresponding type in Python is a string of bytes.
typedef struct cpu_bytes { size_t size; #ifndef PYWRAP const uint8 *data; #endif } cpu_bytes_t;
Additional information can be read out with an architectural specific query
interface, see x86_instruction_query
for details.
instruction_handle_t
.