The concurrency_mode
interface allows a model to
support a concurrency mode other than the default
Sim_Concurrency_Mode_Serialized
.
The supported_modes method returns a bitmask with all the supported modes.
The current_mode method returns the currently active mode. Note that the model should normally checkpoint this setting.
The switch_mode method is invoked by Simics to notify a model that a different concurrency mode has been selected by the user. This typically happens when the user switches threading mode using the set-threading-mode command. The object will typically be placed in a different thread domain shortly after the call to this method.
A model will be placed in the cell thread domain if it uses
the Sim_Concurrency_Mode_Serialized
mode and
in a separate thread domain otherwise. The concurrency_group
interface can be used to ensure that multiple objects are placed in the
same thread domain.
Refer to the chapter about threading in the API Reference Manual for details about thread domains, the Standard Device Model and the Threaded Device Model.
typedef enum { /* Model uses the Standard Device Model */ Sim_Concurrency_Mode_Serialized = 1, /* Model uses the Threaded Device Model. Direct memory pages are protected against concurrency. */ Sim_Concurrency_Mode_Serialized_Memory = 2, /* Model uses the Threaded Device Model. Concurrency can be observed on direct memory pages */ Sim_Concurrency_Mode_Full = 4, } concurrency_mode_t;
SIM_INTERFACE(concurrency_mode) { concurrency_mode_t (*supported_modes)(conf_object_t *NOTNULL obj); concurrency_mode_t (*current_mode)(conf_object_t *NOTNULL obj); void (*switch_mode)(conf_object_t *NOTNULL obj, concurrency_mode_t mode); }; #define CONCURRENCY_MODE_INTERFACE "concurrency_mode"