]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/sparc/trap_state.cpp
update
[l4.git] / kernel / fiasco / src / kern / sparc / trap_state.cpp
1
2 INTERFACE:
3
4 #include "l4_types.h"
5 #include "entry_frame.h"
6
7 class Trap_state_regs
8 {
9 public:
10   Mword pf_address;
11   Mword error_code;
12 };
13
14
15 class Trap_state : public Trap_state_regs, public Syscall_frame,
16                    public Return_frame
17 {
18 public:
19   typedef int (*Handler)(Trap_state*, unsigned cpu);
20 };
21
22
23 IMPLEMENTATION:
24
25 #include <cstdio>
26
27 PUBLIC inline
28 void
29 Trap_state::sanitize_user_state()
30 {
31   // implement me
32 }
33
34 PUBLIC inline
35 unsigned long
36 Trap_state::ip() const
37 { return srr0; }
38
39 PUBLIC inline
40 unsigned long
41 Trap_state::trapno() const
42 { return error_code; }
43
44 PUBLIC inline
45 Mword
46 Trap_state::error() const
47 { return 0; }
48
49 PUBLIC inline
50 void
51 Trap_state::set_ipc_upcall()
52 {
53   error_code = 0x10000000; // see Msr
54 }
55
56 PUBLIC inline
57 void
58 Trap_state::set_pagefault(Mword pfa, Mword error)
59 {
60   pf_address = pfa;
61   error_code = error;
62 }
63
64 PUBLIC inline
65 bool
66 Trap_state::is_debug_exception() const
67 { return false; }
68
69 PUBLIC
70 void
71 Trap_state::dump()
72 {
73   char const *excpts[] = 
74     {"reset","machine check"};
75   
76   printf("EXCEPTION: pfa=%08lx, error=%08lx\n",
77          //excpts[((error_code & ~0xff) >> 8) - 1]
78           pf_address, error_code);
79
80   printf("SP: %08lx LR: %08lx SRR0: %08lx SRR1 %08lx\n\n"
81          "R[0]  %08lx\n"
82          "R[3]: %08lx %08lx %08lx %08lx %08lx\n"
83          "R[8]: %08lx %08lx %08lx %08lx %08lx\n",
84          usp, ulr, srr0, srr1,
85          r[0], r[1], r[2], r[3], r[4], r[5], r[6], r[7],
86          r[8], r11, r12);
87 }
88