World's most popular travel blog for travel bloggers.

[Solved]: What do CPUs do when a program aborts with an error?

, , No Comments
Problem Detail: 

If a very severe interrupt occurs, say a divide by zero, this will quit the program. How is this done, is there a special instruction in the processor or is it a software routine? And after quitting the program, where will the CPU jump to?

Asked By : model world

Answered By : Benjoyo

There are traps, faults and aborts. Divide-by-zero is a fault which means that it is potentially fixable.

On x86, the CPU will save some registers on the stack (CS, EIP, EFLAGS, SS, ESP) and maybe an error code and then start the fitting Interrupt Service Routine. The adress of the ISR is found in the Interrupt Vector Table which is located in the first kilobyte of RAM and is setup by the OS. From here on the OS takes over. After the handling is done, the OS may make the CPU return to the program that caused the error.

Best Answer from StackOverflow

Question Source :

3.2K people like this

 Download Related Notes/Documents


Post a Comment

Let us know your responses and feedback