]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/arm/tb_entry-arm.cpp
3edea57365264bbcc8b14286c4020d93eb76f28d
[l4.git] / kernel / fiasco / src / kern / arm / tb_entry-arm.cpp
1 INTERFACE [arm]:
2
3 EXTENSION class Tb_entry
4 {
5 public:
6   enum
7   {
8     Tb_entry_size = 64,
9   };
10   static Mword (*read_cycle_counter)();
11 };
12
13 /** logged trap. */
14 class Tb_entry_trap : public Tb_entry
15 {
16 private:
17   Unsigned32    _error;
18   Mword         _cpsr, _sp;
19 public:
20   unsigned print(int max, char *buf) const;
21 };
22
23 // --------------------------------------------------------------------
24 IMPLEMENTATION [arm]:
25
26 PROTECTED static Mword Tb_entry::dummy_read_cycle_counter() { return 0; }
27
28 Mword (*Tb_entry::read_cycle_counter)() = dummy_read_cycle_counter;
29
30 PUBLIC static
31 void
32 Tb_entry::set_cycle_read_func(Mword (*f)())
33 { read_cycle_counter = f; }
34
35 PUBLIC inline
36 void
37 Tb_entry::rdtsc()
38 { _tsc = read_cycle_counter(); }
39
40 // ------------------
41 PUBLIC inline
42 Unsigned16
43 Tb_entry_trap::cs() const
44 { return 0; }
45
46 PUBLIC inline
47 Unsigned8
48 Tb_entry_trap::trapno() const
49 { return 0; }
50
51 PUBLIC inline
52 Unsigned32
53 Tb_entry_trap::error() const
54 { return _error; }
55
56 PUBLIC inline
57 Mword
58 Tb_entry_trap::sp() const
59 { return _sp; }
60
61 PUBLIC inline
62 Mword
63 Tb_entry_trap::cr2() const
64 { return 0; }
65
66 PUBLIC inline
67 Mword
68 Tb_entry_trap::eax() const
69 { return 0; }
70
71 PUBLIC inline NEEDS ["trap_state.h"]
72 void
73 Tb_entry_trap::set(Mword ip, Trap_state *ts)
74 {
75     _ip    = ip;
76     _error = ts->error_code;
77     _cpsr  = ts->psr;
78     _sp    = ts->sp();
79 }
80
81 PUBLIC inline NEEDS ["trap_state.h"]
82 void
83 Tb_entry_trap::set(Mword pc, Mword )
84 {
85     _ip    = pc;
86 }