]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/ia32/32/tb_entry-ia32-32.cpp
update
[l4.git] / kernel / fiasco / src / kern / ia32 / 32 / tb_entry-ia32-32.cpp
1 INTERFACE [ia32,ux]:
2
3 EXTENSION class Tb_entry
4 {
5 public:
6   enum
7   {
8     Tb_entry_size = 64,
9   };
10 };
11
12 /** logged trap. */
13 class Tb_entry_trap : public Tb_entry
14 {
15 private:
16   Unsigned8     _trapno;
17   Unsigned16    _error;
18   Mword _ebp, _cr2, _eax, _eflags, _esp;
19   Unsigned16    _cs,  _ds;
20 public:
21   unsigned print(int max, char *buf) const;
22 } __attribute__((packed));
23
24 IMPLEMENTATION [ia32,ux]:
25
26 #include "cpu.h"
27
28 PUBLIC inline NEEDS ["cpu.h"]
29 void
30 Tb_entry::rdtsc()
31 { _tsc = Cpu::rdtsc(); }
32
33 PUBLIC inline NEEDS ["trap_state.h"]
34 void
35 Tb_entry_trap::set(Mword eip, Trap_state *ts)
36 {
37   _ip     = eip;
38   _trapno = ts->_trapno;
39   _error  = ts->_err;
40   _cr2    = ts->_cr2;
41   _eax    = ts->_ax;
42   _cs     = (Unsigned16)ts->cs();
43   _ds     = (Unsigned16)ts->_ds;
44   _esp    = ts->sp();
45   _eflags = ts->flags();
46 }
47
48 PUBLIC inline
49 void
50 Tb_entry_trap::set(Mword eip, Mword trapno)
51 {
52   _ip     = eip;
53   _trapno = trapno;
54   _cs     = 0;
55 }
56
57 PUBLIC inline
58 Unsigned8
59 Tb_entry_trap::trapno() const
60 { return _trapno; }
61
62 PUBLIC inline
63 Unsigned16
64 Tb_entry_trap::error() const
65 { return _error; }
66
67 PUBLIC inline
68 Mword
69 Tb_entry_trap::eax() const
70 { return _eax; }
71
72 PUBLIC inline
73 Mword
74 Tb_entry_trap::cr2() const
75 { return _cr2; }
76
77 PUBLIC inline
78 Mword
79 Tb_entry_trap::ebp() const
80 { return _ebp; }
81
82 PUBLIC inline
83 Unsigned16
84 Tb_entry_trap::cs() const
85 { return _cs; }
86
87 PUBLIC inline
88 Unsigned16
89 Tb_entry_trap::ds() const
90 { return _ds; }
91
92 PUBLIC inline
93 Mword
94 Tb_entry_trap::sp() const
95 { return _esp; }
96
97 PUBLIC inline
98 Mword
99 Tb_entry_trap::flags() const
100 { return _eflags; }