Previous - Up - Next


SIM_instruction_handle_exception — handle exception

SIM_instruction_handle_exception(instruction_id_t ii);

When SIM_instruction_proceed or one of its shortcuts returns Sim_IE_Exception an exception has occurred. The exception should be handled by an explicit call to SIM_instruction_handle_exception with the faulting instruction's id as input.

The CPU needs to be synchronized to handle an exception. This is achieved by draining the instruction tree so that all instructions before the faulting one are committed and all later instructions are discarded. Exceptions can also be handled if the instruction is not inserted in the tree and the tree is empty. This can happens if an instruction gets an exception in the fetch or decode phase and the instruction is not inserted in the tree.

Speculative instructions that cause exceptions cannot be handled. If this is what the user wants SIM_instruction_force_correct can be used to remove the speculative status before the exception is handled. This is strongly discouraged since it may lead to incorrect execution.

The effect of calling SIM_instruction_handle_exception is to set the program counter to the first instruction in the corresponding exception handler and to update other architectural state that are affected when an exception occurs.

The exception is automatically "committed" so there is no need to call SIM_instruction_proceed or SIM_instruction_commit.

Index Thrown if ii is illegal.
Sim_IE_OK on success,
Sim_IE_Code_Breakpoint if the instruction had a code breakpoint,
Sim_IE_Step_Breakpoint if a step breakpoint was encountered,
Sim_IE_Hap_Breakpoint if the exception caused an hap breakpoint,
Sim_IE_No_Exception if trying to handle an the exception on a non-faulting instruction,
Sim_IE_Speculative if trying to handle an exception from a speculative instruction,
Sim_IE_Illegal_Exception_Point if the tree contains other instructions.

Previous - Up - Next