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