Software interrupt, Synchronous interrupt
Handle programming error or anomalous hardware conditions
Generated by the CPU while executing instruction
- Programming errors
- Segmentation fault
- division by 0
- Anomalous conditions that must be handled by kernel
- page fault
- floating-point error
- Debugger
- Save the contents of most registers in the Kernel Mode stack
- Handle the exception
- Exit from the handler from
ret_from_exception()
Exception Notion

Why I Prefer Exceptions to Error Values
Exceptions are often a better way to handle errors than returning them as values. We argue that traditional exceptions provide better user and developer experience, and show that they even result in faster execution.
https://cedardb.com/blog/exceptions_vs_errors/

Seonglae Cho