access_filter_cb_t — instrumentation callback type for access filter
#include <simics/model-iface/ram-instrumentation.h> // in C
import "simics/model-iface/ram-instrumentation.dml"; // in DML
typedef access_t (*access_filter_cb_t)(conf_object_t *obj,
conf_object_t *ram,
conf_object_t *initiator,
uint64 offset,
unsigned size,
access_t access,
lang_void *user_data);
Instrumentation callback function registered through the register_access_filter_cb method of the ram_access_subscribe interface to get a callback when a direct page is requested which is typically done by CPU models. The obj is the object that registered the callback, and the initiator is the object which tries to get the direct page. The target object of the direct page lookup is passed in the ram argument. Typically, it is an object of the ram class. The offset, size and access are the ram offset, the size of the cached page, and the access type, respectively. The user_data is the user data for the callback. To allow caching of a page, the corresponding bits in an access_t should be returned. If 0 is returned the page will not be cached.
after_read_callback_t — Callback type used with bank_instrumentation_subscribe interface
#include <simics/model-iface/bank-instrumentation.h> // in C
import "simics/model-iface/bank-instrumentation.dml"; // in DML
typedef void (*after_read_callback_t)(conf_object_t *connection,
bank_after_read_interface_t *access,
bank_access_t *handle,
lang_void *user_data);
An implementation of this callback type can be registered with the register_after_read method in the bank_instrumentation_subscribe interface.
The connection is the object used to group the callback with any other callbacks, which may be NULL. The access object provides a number of methods via the bank_after_read interface which may be used along with the handle to perform a certain set of actions at the particular point of the access. The user_data is the custom data which was associated with the callback at registration.
after_write_callback_t — Callback type used with bank_instrumentation_subscribe interface
#include <simics/model-iface/bank-instrumentation.h> // in C
import "simics/model-iface/bank-instrumentation.dml"; // in DML
typedef void (*after_write_callback_t)(conf_object_t *connection,
bank_after_write_interface_t *access,
bank_access_t *handle,
lang_void *user_data);
An implementation of this callback type can be registered with the register_after_write method in the bank_instrumentation_subscribe interface.
The connection is the object used to group the callback with any other callbacks, which may be NULL. The access object provides a number of methods via the bank_after_write interface which may be used along with the handle to perform a certain set of actions at the particular point of the access. The user_data is the custom data which was associated with the callback at registration.
bank_access_t — callback handle retrieved from the bank_instrumentation_subscribe interface
#include <simics/model-iface/bank-instrumentation.h> // in C
import "simics/model-iface/bank-instrumentation.dml"; // in DML
typedef struct bank_access bank_access_t;
import simics
class simics.bank_access_t
Handle used to monitor and modify the state of register accesses using the bank_before_read, bank_after_read, bank_before_write, and bank_after_write interfaces.
bank_callback_handle_t — bank callback handle
#include <simics/model-iface/bank-instrumentation.h> // in C
import "simics/model-iface/bank-instrumentation.dml"; // in DML
typedef uintptr_t bank_callback_handle_t;
Unique handle associated with a callback registered through the bank_instrumentation_subscribe interface.
before_read_callback_t — Callback type used with bank_instrumentation_subscribe interface
#include <simics/model-iface/bank-instrumentation.h> // in C
import "simics/model-iface/bank-instrumentation.dml"; // in DML
typedef void (*before_read_callback_t)(conf_object_t *connection,
bank_before_read_interface_t *access,
bank_access_t *handle,
lang_void *user_data);
An implementation of this callback type can be registered with the register_before_read method in the bank_instrumentation_subscribe interface.
The connection is the object used to group the callback with any other callbacks, which may be NULL. The access object provides a number of methods via the bank_before_read interface which may be used along with the handle to perform a certain set of actions at the particular point of the access. The user_data is the custom data which was associated with the callback at registration.
before_write_callback_t — Callback type used with bank_instrumentation_subscribe interface
#include <simics/model-iface/bank-instrumentation.h> // in C
import "simics/model-iface/bank-instrumentation.dml"; // in DML
typedef void (*before_write_callback_t)(conf_object_t *connection,
bank_before_write_interface_t *access,
bank_access_t *handle,
lang_void *user_data);
An implementation of this callback type can be registered with the register_before_write method in the bank_instrumentation_subscribe interface.
The connection is the object used to group the callback with any other callbacks, which may be NULL. The access object provides a number of methods via the bank_before_write interface which may be used along with the handle to perform a certain set of actions at the particular point of the access. The user_data is the custom data which was associated with the callback at registration.
cpu_access_scope_t — type to describe scope of memory access for instrumentation
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef enum {
CPU_Access_Scope_Explicit,
CPU_Access_Scope_Implicit
} cpu_access_scope_t;
import simics
simics.CPU_Access_Scope_Implicit
simics.CPU_Access_Scope_Explicit
Used to select the access scope for instrumentation of memory accesses. CPU_Access_Scope_Explicit selects explicit accesses used by an instruction such as loading or storing a value. CPU_Access_Scope_Implicit selects implicit accesses such as table walks and exceptions handling. See the cpu_instrumentation_subscribe for more information.
cpu_address_cb_t — type of callback function to handle addresses
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef logical_address_t (*cpu_address_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
logical_address_t address,
address_handle_t *handle,
lang_void *user_data);
Instrumentation callback function registered through the cpu_instrumentation_subscribe interface’s register_address_before member function.
The callback will be called prior to a processor memory access, allowing the callback to change the logical address for an access.
The argument obj is the object installing the callback and the cpu is the processor generating the logical address. If the access crosses a page boundary the access will be split into two calls. The part argument tells if the address belongs to the first or the second part. The cpu_address_part_t type has two values: CPU_Address_Part_First and CPU_Address_Part_Second. The handle can be used to extract more information about he address by using a architecture specific interface. See the x86_address_query for example.
cpu_bytes_t — type used for bytes in cpu accesses
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef struct cpu_bytes {
size_t size;
#ifndef PYWRAP
const uint8 *data;
#endif
} cpu_bytes_t;
An immutable sequence of bytes. The ownership is not transferred to the callee/caller when called or returned. The corresponding Python type is a string of bytes. May only be used in a defined scope which should be documented in each use case.
The member data contains the data pointer, and the member size contains tha size of the data. It is illegal to access beyond the limit.
cpu_cached_instruction_cb_t — type of cached instruction callback function
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_cached_instruction_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
cached_instruction_handle_t *ci_handle,
instruction_handle_t *iq_handle,
lang_void *user_data);
Instrumentation callback function registered through the cpu_instrumentation_subscribe interface’s register_cached_instruction_cb member function.
This callback will be called when an instruction is about to be cached in the processor model (this is not the same as being in the processor’s real hardware instruction cache).
cpu is the processor which executed an instruction.
ci_handle is an opaque handle associated with the instruction being executed, it is used with the cpu_cached_instruction interface to install instruction specific callbacks.
iq_handle together with the cpu_instruction_query interface let a user examine instruction properties.
user_data is the user data for the callback.
cpu_callback_free_user_data_cb_t — callback type used for freeing user data
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_callback_free_user_data_cb_t)(
conf_object_t *obj, conf_object_t *cpu, lang_void *user_data);
Callback function registered through the cpu_cached_instruction interface to free instruction specific user data when the instruction is not being cached anymore. The user_data is the pointer to the callback data. obj is the connection object and cpu is the processor that the callback was registered for.
cpu_control_register_read_cb_t — type of callback function for control register read
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_control_register_read_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
int register_number,
lang_void *user_data);
The obj is the object registering the callback and cpu is the processor that reads the control register register_number. The user_data is the user data for the callback.
cpu_control_register_scope_t — type used to describe control register scope
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef enum {
CPU_Control_Register_All = -1
/* Any other value corresponds to the register number as
defined in the int_register interface for the processor */
} cpu_control_register_scope_t;
import simics
simics.CPU_Control_Register_All
cpu_control_register_write_cb_t — type of callback function for control register write
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_control_register_write_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
int register_number,
uint64 value,
lang_void *user_data);
The obj is the object registering the callback and cpu is the processor that writes to the control register register_number. The value is the value that will be written. The user_data is the user data for the callback.
cpu_emulation_cb_t — type of instruction decode callback function
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef cpu_emulation_t (*cpu_emulation_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
lang_void *user_data);
Instrumentation callback function registered through the cpu_instruction_decoder interface.
This callback will be called when an user added instruction is about to be executed in the processor. The cpu is the processor which executes an instruction. The instruction_user_data is the user-data associated with the instruction. The return type cpu_emulation_t is used to tell Simics how the next instruction should be fetched. For more information, see the cpu_instruction_decoder interface.
cpu_emulation_t — type of instruction decode callback function
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef enum {
CPU_Emulation_Fall_Through,
CPU_Emulation_Control_Flow,
CPU_Emulation_Default_Semantics,
CPU_Emulation_Stall,
} cpu_emulation_t;
import simics
simics.CPU_Emulation_Fall_Through
simics.CPU_Emulation_Default_Semantics
simics.CPU_Emulation_Control_Flow
simics.CPU_Emulation_Stall
cpu_exception_cb_t — type of callback function for exception
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_exception_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
exception_handle_t *exception_handle,
lang_void *user_data);
The obj is the object registering the callback and cpu is the processor that takes the exception or receives the interrupt. The handle is used to get more architectural information about the exception, for example, see the x86_exception_query for details. The user_data is the callback user data.
No architectural state has been changed in this callback to reflect the exception or interrupt, e.g., the program counter will still be at the faulting instruction. Since an exception can occur while handling an exception it is not always the case that this callback corresponds to the final taken exception. Recursive exception will result in another call to this callback.
cpu_exception_return_cb_t — type of callback function for exception return
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_exception_return_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
exception_return_handle_t *exception_handle,
lang_void *user_data);
The obj is the object registering the callback and cpu is the processor that takes the exception or receives an interrupt. The handle is used to get more architectural information about the exception. Currently there is no interface available for this.
cpu_exception_scope_t — type used to describe exception scope
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef enum {
CPU_Exception_All = -1
/* Any other value corresponds to the exception number as
defined in the exception interface for the processor */
} cpu_exception_scope_t;
import simics
simics.CPU_Exception_All
cpu_instruction_cb_t — callback type used for instruction execution
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_instruction_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
instruction_handle_t *handle,
lang_void *user_data);
Instrumentation callback function registered through the cpu_instrumentation_subscribe or the cpu_cached_instruction interfaces to get a callback before or after an instruction has been executed.
obj is the connection or the user object that registered the callback (or NULL if there is no object).
cpu is the processor which executed the instruction.
handle is an opaque handle associated with the instruction being executed. It can be used together with the cpu_instruction_query interface to get more information about the instruction.
user_data is the user data for the callback.
cpu_instruction_decoder_cb_t — type of instruction decode callback function
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef int (*cpu_instruction_decoder_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
decoder_handle_t *decoder_handle,
instruction_handle_t *iq_handle,
lang_void *user_data);
Instrumentation callback function registered through the cpu_instrumentation_subscribe interface’s register_instruction_decoder_cb member function.
This callback will be called when an instruction is about to be cached in the processor model (this is not the same as being in the processor’s real hardware instruction cache). The cpu is the processor which executed an instruction. The decoder_handle is an opaque handle associated with the instruction being executed and used in the cpu_instruction_decoder interface. The iq_handle is used with the cpu_instruction_query interface to get more information on the instruction. The user_data is the user data associated with the callback.
If the instruction is accepted by the callback a positive integer number should be returned corresponding to the length of the instruction. In this case the register_emulation_cb method of the cpu_instruction_decoder interface should be called to set the actual (user) function that Simics will call each time the instruction is executed.
If the decoder requires more bytes (i.e., because the new instruction is longer), a negative integer value should be returned by the cb function, indicating the number of bytes needed. For example, if the available bytes are 3 but the decoder need at least 4 bytes, -4 should be returned. The callback will then be called again with more available bytes (this can be repeated if the new instruction requires even more bytes at this point). Note that requesting more data than actual needed can cause spurious page faults if the data crosses a page boundary.
If the cb callback should ignore the instruction the number 0 should be returned. This means that any other registered decoder will have a chance to decode the instruction. If no decoder accepts it, Simics’ default implementation will be used.
cpu_instruction_disassemble_cb_t — type of disassemble callback function
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef tuple_int_string_t (*cpu_instruction_disassemble_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
generic_address_t addr,
cpu_bytes_t bytes);
Instrumentation callback function registered through the cpu_instrumentation_subscribe interface’s register_instruction_decoder_cb member function.
The callback will be called when a replaced instruction is being disassembled.
obj is the object registering the callback and cpu is the processor disassembling the instruction. addr is the address of the instruction in a generic form. This means that it is typically a physical address or a logical address depending on the context of the disassembling. The address can be used for offset calculations, i.e., displaying an absolute address instead of a relative one, for example in a branch instruction. The bytes argument should be used to read instruction bytes.
The return value is of type tuple_int_string_t and should be filled with the instruction length and an allocated (e.g., malloc) string representing the disassembly of the instruction. The ownership of the string is transferred to the calling environment which will free it when it is no longer needed.
If too few bytes are passed for the instruction to be disassembled a negative value should be returned for the length indicating the needed bytes. The disass_cb is then called again with more bytes. If the instruction is rejected a length of 0 should be returned and the string should be set to NULL.
cpu_memory_cb_t — callback type used for memory access
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_memory_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
memory_handle_t *handle,
lang_void *user_data);
Instrumentation callback function registered through the cpu_instrumentation_subscribe or the cpu_cached_instruction interfaces to get a callback before or after an memory access is executed.
obj is the object that registered the callback
cpu is the processor doing the access.
handle is an opaque handle associated with the instruction being executed. It can be used with the cpu_memory_query interface to get more information about the access.
user_data is the userdata for the callback.
cpu_mode_change_cb_t — type of callback function for mode change
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef void (*cpu_mode_change_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
processor_mode_t old_mode, processor_mode_t new_mode,
lang_void *user_data);
The obj is the object registering the callback and cpu is the processor that changes mode. The old_mode is the mode before the change and new_mode is the mode after the change.
do_map_target_cb_t — callback type for map target instrumentation
#include <simics/model-iface/transaction-instrumentation.h> // in C
import "simics/model-iface/transaction-instrumentation.dml"; // in DML
typedef next_map_t (*do_map_target_cb_t)(const map_target_t *mt,
transaction_t *org_t,
uint64 addr, map_info_t *map,
lang_void *handle);
next_map_t — type used for chaining map_target_t’s
#include <simics/model-iface/transaction-instrumentation.h> // in C
import "simics/model-iface/transaction-instrumentation.dml"; // in DML
typedef struct {
const map_target_t *mt;
#ifndef PYWRAP
exception_type_t ex;
#else
unsigned ex;
#endif
uint64 addr;
} next_map_t;
import simics
class simics.next_map_t(mt=None, ex=0, addr=0)
This type is used to hold information about the next map target in a translation chain. It is exposed in the do_map_target_cb_t function callback used in the transaction_issue_cb_t callback in the transaction_subscribe interface. See transaction_issue_cb_t for more information.
pre_decoder_cb_t — callback function type used with pre_decoder interface
#include <simics/model-iface/cpu-instrumentation.h> // in C
import "simics/model-iface/cpu-instrumentation.dml"; // in DML
typedef bool (*pre_decoder_cb_t)(
conf_object_t *obj,
conf_object_t *cpu,
generic_address_t instruction_start_address,
physical_address_t position_physical_address,
uint8 *opcode_bytes,
unsigned valid_bytes,
unsigned instruction_position,
lang_void *user_data);
This callback is used by the pre_decoder interface to observe and modify the instruction byte stream.
The obj is the connection object which owns the callback, or NULL, if no connection is used. cpu is the cpu which decodes the instructions. instruction_start_address is the address of the first byte in the instruction that is being decoded. For x86 this is the linerar address. opcode_bytes is a pointer to the first opcode byte in the instruction. The valid_bytes tells how many bytes that can read from the first byte.
If the decoded instruction crosses a page boundary this callback is invoked twice, first with the bytes on the first page and then with additional bytes located on the next page. The instruction_position tells where in the instruction opcode the next bytes are added from the second page, and hence will be greater 0 if this occurs.
The position_physical_address reflects the physical address of the instruction_position.
The function should return true if the memory was modified, otherwise false.
ram_access_cb_t — instrumentation callback type for ram access
#include <simics/model-iface/ram-instrumentation.h> // in C
import "simics/model-iface/ram-instrumentation.dml"; // in DML
typedef void (*ram_access_cb_t)(conf_object_t *obj,
conf_object_t *ram,
uint64 ram_offset,
transaction_t *t,
lang_void *user_data);
Instrumentation callback function registered through the register_access_before_cb or register_access_after_cb methods in the ram_access_subscribe interface to get a callback when a ram/rom object is accessed. obj is the object that registered the callback, and the ram is the ram/rom object that is accessed. The ram_offset is the offset in the ram/rom object where the transaction hits. The t argument is a pointer to the transaction_t that is performed. See the access primitives of the transaction_t type to see how to examine and modify the transaction. Depending on if the register function is of before or after type, the transaction will be, or already has been completed, at the time of this callback. This places restrictions on what can be done with the transaction.
smm_switch_cb_t — callback type for smm switch
#include <simics/arch/x86-instrumentation.h> // in C
import "simics/arch/x86-instrumentation.dml"; // in DML
typedef void (*smm_switch_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
lang_void *user_data);
This callback type is used by the smm_instrumentation_subscribe to implement instrumentation.
The obj argument is the user object that registered the callback, or NULL if no such object exists.
The cpu argument is the processor that enters/leaves System Management Mode.
The user_data argument is the callback user data, passed to the register methods.
transaction_issue_cb_t — callback type for transaction instrumentation
#include <simics/model-iface/transaction-instrumentation.h> // in C
import "simics/model-iface/transaction-instrumentation.dml"; // in DML
typedef next_map_t (*transaction_issue_cb_t)(conf_object_t *obj,
const map_target_t *mt,
const char *map_target_type,
map_info_t *map,
transaction_t *t,
uint64 offset,
do_map_target_cb_t do_mt,
lang_void *handle,
lang_void *user_data);
Note: This callback is internal and may change without notice.
Instrumentation callback function registered through the register_issue_cb method in the transaction_subscribe interface. In this callback a user can snoop and/or replace a transaction passing through a map target object.
Argument obj is the object that registered the callback. The mt argument is the map target used to map the transaction, and the map_target_type is a string describing the map target. The map parameter is map information for the map target. addr is the address in the mapped object where the transaction hits. You can retrieve the object by calling SIM_map_target_object on the map_target. The t argument is a pointer to the transaction that is issued. See the access primitives of the transaction_t type to see how to examine and modify the transaction. The do_mt is the function to call that actually do the map target access, and it is the callback’s responsibility to call it. This allows the map target, the map, the address, and the transaction to be modified by then callback. Se the documentation of the do_map_target_cb_t for a description of how to call it.
The callback should return a next_map_t value that is the return value of the do_mt callback. This describes the next map target to be considered, if the map target translates to a new map target. In this case, the next target is stored in the mt field. If no new map target is used, the field will be NULL. The type also contains an ex field set to something else than Sim_PE_No_Exception, if an exception occurred. It also has a addr field which describes the new address for the next map target.
If the do_mt function is not called, this effectively cancels the transaction. The value map_next_t to return should then fill in the mt field with a NULL pointer.
vmx_mode_switch_cb_t — callback type for vmx mode switch
#include <simics/arch/x86-instrumentation.h> // in C
import "simics/arch/x86-instrumentation.dml"; // in DML
typedef void (*vmx_mode_switch_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
vmx_mode_t mode,
physical_address_t vmcs_address,
lang_void *user_data);
This callback type is used by the vmx_instrumentation_subscribe interface to implements VMX mode switch instrumentation.
The obj argument is the user object that registered the callback, or NULL if no such object exists.
The cpu argument is the processor that switches VMX mode.
The mode that will be left or entered is passed in the mode argument in the callback.
vmx_mode_t — enum for vmx modes
#include <simics/arch/x86-instrumentation.h> // in C
import "simics/arch/x86-instrumentation.dml"; // in DML
typedef enum {
Vmx_Off = 0,
Vmx_Root = 1,
Vmx_Non_Root = 2
} vmx_mode_t;
import simics
simics.Vmx_Root
simics.Vmx_Off
simics.Vmx_Non_Root
This enum is used to distinguish VMX modes. It is used by the vmx_mode_switch_cb_t.
x86_mode_switch_cb_t — x86 specific callback type for mode switch instrumentation
#include <simics/arch/x86-instrumentation.h> // in C
import "simics/arch/x86-instrumentation.dml"; // in DML
typedef void (*x86_mode_switch_cb_t)(
conf_object_t *obj, conf_object_t *cpu,
x86_detailed_exec_mode_t mode,
lang_void *user_data);
The obj is the connection object that registered the callback. new_mode argument contains the new mode. The possible modes available are captured in the x86_detailed_exec_mode_t type.
The user_data is the user data associated with the callback.