Previous - Up - Next


SIM_instruction_handle_interrupt — handle interrupt

SIM_instruction_handle_interrupt(conf_object_t *cpu,
                                 exception_type_t vector);

Interrupts are caught in the Micro Architectural Interface by installing an callback handler on the Core_Asynchronous_Trap hap. This callback will be called when an interrupt or an asynchronous trap occurs. The callback gets the interrupted CPU and the trap vector number associated with the interrupt as arguments (see the hap documentation for details).

To handle the interrupt SIM_instruction_handle_interrupt should be called with the CPU and the trap vector as arguments. The effect of this call is to set the program counter to the first instruction in the corresponding trap handler and to update other architectural state that are affected when an interrupt occurs.

Currently the instruction tree needs to be empty when an interrupt is handled. This is achieved either by squashing all instructions or letting all of them commit before SIM_instruction_handle_interrupt is called.

Interrupts may be disabled (by software or hardware) after the hap triggers but before SIM_instruction_handle_interrupt is called, if this is the case Sim_IE_Interrupts_Disabled will be returned. The interrupts should then be handled as soon as the interrupts are enabled again.

Sim_IE_OK on success,
Sim_IE_No_Exception if vector is No_Exception,
Sim_IE_Interrupts_Disabled if interrupts are disabled,
Sim_IE_Illegal_Interrupt_Point if trying to handle an interrupt when the instruction queue is not empty.

Previous - Up - Next