Next: , Previous: , Up: Defining Instruction Class Sets   [Contents][Index]


4.2.3.3 Registering the Function

Use the following macro to register the event handler function of an instruction class set.

Macro: QSMM_REG_INSTR_CLASS_SET_PARAM (model, instr_class_set_name, paramp)

This macro registers an instruction class set instr_class_set_name for a multinode model. The event handler function of this instruction class set will be receiving the parameter paramp in the argument qsmm_param_p on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE. The macro QSMM_INSTR_CLASS_SET should previously define the instruction class set.

The macro QSMM_REG_INSTR_CLASS_SET_PARAM expands to:

qsmm_reg_instr_class_set((model), #instr_class_set_name,
                         &instr_class_set_name, (paramp))

Below there is the description of a function called by the macro QSMM_REG_INSTR_CLASS_SET_PARAM.

Function: int qsmm_reg_instr_class_set (qsmm_t model, const char *instr_class_set_name, qsmm_instr_class_set_func_t instr_class_set_func, void *paramp)

This function registers an instruction class set instr_class_set_name for a multinode model. The function instr_class_set_func is the event handler of this instruction class set. That event handler will be receiving the parameter paramp in the argument qsmm_param_p on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE.

After registering the instruction class set, the function sends an event QSMM_EVT_ENT_INIT to the event handler, and it can perform the initialization of that instruction class set.

The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.

QSMM_ERR_EXIST

A program has already registered an instruction class set or instruction meta-class named instr_class_set_name in the multinode model.

QSMM_ERR_UNTIMELY

The model instance already exists—cannot change model structure.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.

Use the following function to get a pointer to the event handler of an instruction class set and a user parameter passed to that event handler in certain cases.

Function: int qsmm_get_instr_class_set_handler (qsmm_t model, const char *instr_class_set_name, qsmm_instr_class_set_func_t *instr_class_set_func_p, void **param_pp)

This function retrieves the parameters of the event handler of an instruction class set instr_class_set_name registered for a multinode model. If instr_class_set_func_p is not NULL, the function sets *instr_class_set_func_p to a pointer to that event handler. If param_pp is not NULL, the function sets *param_pp to the value of qsmm_param_p argument of that event handler passed on events QSMM_EVT_ENT_INIT, QSMM_EVT_ENT_DONE, QSMM_EVT_ENGINE_INIT, and QSMM_EVT_ENGINE_DONE.

The function returns a non-negative value on success or a negative error code on failure. Currently, the function can return the following error codes.

QSMM_ERR_NOTFOUND

The instruction class set instr_class_set_name not found.

QSMM_ERR_TYPE

An entity named instr_class_set_name is not an instruction class set. The entity is an instruction meta-class.

QSMM_ERR_NOMEM

There was not enough memory to perform the operation.


Next: , Previous: , Up: Defining Instruction Class Sets   [Contents][Index]