9.8 Assembly Language ‘trap’

From “low.s” it appears that traps and interrupts are handled separately by the software. However closer examination reveals that “call” and “trap” are different entry points to a single code sequence in the file “m40.s” (see lines 0755, 0776). This sequence is examined in detail in the next chapter.

During the execution of this sequence, a call is made on a “C” language procedure to carry out further specific processing. In the case of an interrupt, the “C” procedure is the interrupt handler specific to the particular device controller.

In the case of a trap, the “C” procedure is another procedure called “trap” (yes, the word “trap” is definitely overworked!), which in the case process of a system error will most likely call priority “panic” and in the case of a “system call”, will invoke (indirectly via “trapl”(2841)) the appropriate system call procedure.