5 #include "entry_frame.h"
10 // static int (*base_handler)(Trap_state *) asm ("BASE_TRAP_HANDLER");
19 class Trap_state : public Trap_state_regs, public Return_frame
22 typedef int (*Handler)(Trap_state*, unsigned cpu);
29 #include "processor.h"
31 PUBLIC inline NEEDS["processor.h"]
33 Trap_state::sanitize_user_state()
35 psr &= ~(Proc::Status_mode_mask | Proc::Status_interrupts_mask);
36 psr |= Proc::Status_mode_user;
41 Trap_state::set_ipc_upcall()
43 error_code = 0x00600000;
48 Trap_state::set_pagefault(Mword pfa, Mword error)
56 Trap_state::ip() const
61 Trap_state::trapno() const
62 { return error_code >> 16; }
66 Trap_state::error() const
67 { return error_code; }
71 Trap_state::exception_is_undef_insn() const
72 { return (error_code & 0x00f00000) == 0x00100000; }
76 Trap_state::is_debug_exception() const
83 char const *excpts[] =
84 { "reset", "undefined insn", "swi", "prefetch abort",
85 "data abort", "trigexc", "%&#", "%&#" };
87 printf("EXCEPTION: %s pfa=%08lx, error=%08lx\n",
88 excpts[(error_code & 0x00700000) >> 20], pf_address, error_code);
90 printf("R[0]: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n"
91 "R[8]: %08lx %08lx %08lx %08lx %08lx %08lx %08lx %08lx\n",
92 r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7],
93 r[8], r[9], r[10], r[11], r[12], usp, ulr, pc);