/* * This is the trap exception handler for Nios2. */ /* * Provide a label which can be used to pull this file in. */ .section .exceptions.start .globl alt_exception_trap alt_exception_trap: /* * Pull in the entry/exit code. */ .globl alt_exception .section .exceptions.soft, "xa" .Ltrap_handler: /* * Did a trap instruction cause the exception? * * The instruction which the exception occurred on has been loaded * into r2 by code in alt_exception_entry.S * */ movhi r3,0x003b /* upper half of trap opcode */ ori r3,r3,0x683a /* lower half of trap opcode */ bne r2,r3,.Lnot_trap /* * There is no trap handler defined here, and so executing a trap * instruction causes a software break. If you provide a trap handler, * then you must replace the break instruction below with your handler. * Your handler must preserve ea and the usual callee saved registers. */ movi r3,1234 break 11 /*break*/ br .Lexception_exit .Lnot_trap: .section .exceptions.exit.label .Lexception_exit: