x86_instrumentation_subscribe x86_memory_access
API Reference Manual  /  4 Model-to-Model Interfaces  / 

x86_instrumentation_subscribe_v2

Description
The x86_instrumentation_subscribe_v2 interface is an x86 specific complement to the cpu_instrumentation_subscribe interface. It is implemented by x86 processor objects that support instrumentation. It works in the same way as the cpu_instrumentation_subscribe interface, and the methods remove/enabled/disable_callback and remove/enabled/disable_connection_callbacks in that interface should be used to operate on callbacks in this interface as well, using the cpu_cb_handle_t handle.

The v2 variant fixes some problems with the x86_instrumentation_subscribe. In that interface, the register_mode_switch_cb method was invoked when the new mode had already been set up. This means that if you need to do some bookkeeping when leaving a mode, that mode had already been switched out in the callback. For instance, descriptor registers has already been changed.

This interface adds two methods to handle this, register_mode_leave_cb and register_mode_enter_cb. The leave variant is called when the processor still is located in the previous mode, but about to enter a new mode, and the enter variant is called when the processor has switched to the new mode (corresponds to the register_mode_switch_cb in the old x86_instrumentation_subscribe interface).

The register_illegal_instruction_cb works as in the x86_instrumentation_subscribe interface.

SIM_INTERFACE(x86_instrumentation_subscribe_v2) {
        cpu_cb_handle_t *(*register_mode_enter_cb)(
                conf_object_t *cpu, conf_object_t *connection,
                x86_mode_switch_cb_t cb,
                lang_void *user_data);
        cpu_cb_handle_t *(*register_mode_leave_cb)(
                conf_object_t *cpu, conf_object_t *connection,
                x86_mode_switch_cb_t cb,
                lang_void *user_data);
        cpu_cb_handle_t *(*register_illegal_instruction_cb)(
                conf_object_t *NOTNULL cpu,
                conf_object_t *connection,
                cpu_instruction_decoder_cb_t cb,
                cpu_instruction_disassemble_cb_t disass_cb,
                lang_void *data);
};

#define X86_INSTRUMENTATION_SUBSCRIBE_V2_INTERFACE \
        "x86_instrumentation_subscribe_v2"

Execution Context
Global Context for all methods.

x86_instrumentation_subscribe x86_memory_access