There are many different types of traps listed in processor datasheets, e.g. BusFault, MemManage Fault, Usage Fault and Address Error.
What is their purpose? How can they be utilized in fault handling?
(slang, informal, pejorative) A person with male genitalia who can be mistaken for a female; a convincing transvestite or transwoman. noun. 1.
Trap is a subgenre of hip hop music that originated in the Southern United States during the early 2000s. The genre gets its name from the Atlanta slang word "trap", a house used exclusively to sell drugs.
trap 1. / (træp) / noun. a mechanical device or enclosed place or pit in which something, esp an animal, is caught or penned. any device or plan for tricking a person or thing into being caught unawares.
The trapezius muscle is mainly postural but is also used for active movements such as side bending and turning the head, elevating and depressing the shoulders, and internally rotating the arm. The trapezius elevates, depresses, and retracts the scapula.
Traps are essentially subroutine calls that are forced by the processor when it detects something unusual in your stream of instructions. (Some processors make them into interrupts, but that's mostly just pushing more context onto the stack; this gets more interesting if the trap includes a switch between user and system address spaces).
This is useful for handling conditions that occur rarely but need to be addressed, such as division by zero. Normally, it is useless overhead to have an extra pair of instructions to test the divisor for zero before executing a divide instruction, since the divisor is never expected to be zero. So the architects have the processor do this check in parallel with the actual divide as part of the divide instruction, and cause the processor to trap to a divide-by-zero routine if the divisor is zero. Another interesting case is illegal-memory-address; clearly, you don't want to have to code a test to check each address before you use it.
Often there are a variety of fault conditions of potential interest and the processor by design will pass control to a different trap routine (often set up as a vector) for each different type of fault.
Once the processor has a trap facility, the CPU architects find lots of uses. A common use is debugger breakpoints, and trap-to-OS for the purposes of executing a operating system call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With