pool_protect processor_cli
API Reference Manual  /  5 Model-to-Simulator Interfaces  / 

pre_decoder

Description
This interface extends the cpu_instrumentation_subscribe interface and allows a user to observe and change the bytes in the instruction stream before the target processor tries to decode them. This can be used to model data encryption of memory or instruction caches with different content than the memory.

It is currently offered as a separate interface for backwards compatibility, and only available for C/C++ development, i.e., no Python mapping exists. The interface is only implemented for x86 target processors.

The register_pre_decoder_cb method registers a callback, cb of type pre_decoder_cb_t, which is called before an instruction is decoded an put into Simics internal decode cache. This means that this callback is called only the first time an instruction is executed (unless it is evicted from the decode cache).

The cpu is the processor that decodes the instructions, and connection is the instrumentation connect object that receives the callback. The connection can be NULL, if no connection is available. The data is the callback data for the callback.

See the documentation for the pre_decoder_cb_t for more information.

To remove the callback use either remove_callback or remove_connection_callbacks methods in the cpu_instrumentation_subscribe interface. To identify the callback to remove, pass the return value, a cpu_cb_handle_t handle, from the register method or the connection object used. The callback cannot be disabled.

SIM_INTERFACE(pre_decoder) {
        cpu_cb_handle_t *(*register_pre_decoder_cb)(
                conf_object_t *cpu,
                conf_object_t *connection,
                pre_decoder_cb_t cb,
                lang_void *data);
};
#endif

#define PRE_DECODER_INTERFACE "pre_decoder"

Execution Context
Global context.

pool_protect processor_cli