]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/arm/entry_frame-arm.cpp
update
[l4.git] / kernel / fiasco / src / kern / arm / entry_frame-arm.cpp
1 /*
2  * Fiasco Kernel-Entry Frame-Layout Code for ARM
3  */
4 INTERFACE [arm]:
5
6 #include "types.h"
7
8 EXTENSION class Syscall_frame
9 {
10 public:
11   //protected:
12   Mword r[13];
13   void dump();
14 };
15
16 EXTENSION class Return_frame
17 {
18 public:
19   //protected:
20   Mword usp;
21   Mword ulr;
22   Mword km_lr;
23   Mword pc;
24   Mword psr;
25 };
26
27 //---------------------------------------------------------------------------
28 IMPLEMENTATION [arm]:
29
30 #include <cstdio>
31 #include "processor.h"
32
33 IMPLEMENT
34 void Syscall_frame::dump()
35 {
36   printf(" R0: %08lx  R1: %08lx  R2: %08lx  R3: %08lx\n",
37          r[0], r[1], r[2], r[3]);
38   printf(" R4: %08lx  R5: %08lx  R6: %08lx  R7: %08lx\n",
39          r[4], r[5], r[6], r[7]);
40   printf(" R8: %08lx  R9: %08lx R10: %08lx R11: %08lx\n",
41          r[8], r[9], r[10], r[11]);
42   printf("R12: %08lx\n", r[12]);
43 }
44
45 PUBLIC inline NEEDS["processor.h"]
46 void
47 Return_frame::psr_set_mode(unsigned char m)
48 {
49   psr = (psr & ~Proc::Status_mode_mask) | m;
50 }
51
52 IMPLEMENT inline
53 Mword
54 Return_frame::ip() const
55 { return Return_frame::pc; }
56
57 IMPLEMENT inline
58 Mword
59 Return_frame::ip_syscall_page_user() const
60 { return Return_frame::pc; }
61
62 IMPLEMENT inline
63 void
64 Return_frame::ip(Mword _pc)
65 { Return_frame::pc = _pc; }
66
67 IMPLEMENT inline
68 Mword
69 Return_frame::sp() const
70 { return Return_frame::usp; }
71
72 IMPLEMENT inline
73 void
74 Return_frame::sp(Mword sp)
75 { Return_frame::usp = sp; }
76
77 //---------------------------------------------------------------------------
78 IMPLEMENT inline
79 Mword Syscall_frame::next_period() const
80 { return false; }
81
82 IMPLEMENT inline
83 void Syscall_frame::from(Mword id)
84 { r[4] = id; }
85
86 IMPLEMENT inline
87 Mword Syscall_frame::from_spec() const
88 { return r[4]; }
89
90
91 IMPLEMENT inline
92 L4_obj_ref Syscall_frame::ref() const
93 { return L4_obj_ref::from_raw(r[2]); }
94
95 IMPLEMENT inline
96 void Syscall_frame::ref(L4_obj_ref const &ref)
97 { r[2] = ref.raw(); }
98
99 IMPLEMENT inline
100 L4_timeout_pair Syscall_frame::timeout() const
101 { return L4_timeout_pair(r[3]); }
102
103 IMPLEMENT inline 
104 void Syscall_frame::timeout(L4_timeout_pair const &to)
105 { r[3] = to.raw(); }
106
107 IMPLEMENT inline Utcb *Syscall_frame::utcb() const
108 { return reinterpret_cast<Utcb*>(r[1]); }
109
110 IMPLEMENT inline L4_msg_tag Syscall_frame::tag() const
111 { return L4_msg_tag(r[0]); }
112
113 IMPLEMENT inline
114 void Syscall_frame::tag(L4_msg_tag const &tag)
115 { r[0] = tag.raw(); }
116
117
118 //------------------------------------------------------------------
119 IMPLEMENTATION [arm && !hyp]:
120
121 PUBLIC inline
122 bool
123 Return_frame::check_valid_user_psr() const
124 { return (psr & Proc::Status_mode_mask) == Proc::PSR_m_usr; }
125
126 //------------------------------------------------------------------
127 IMPLEMENTATION [arm && hyp]:
128
129 PUBLIC inline
130 bool
131 Return_frame::check_valid_user_psr() const
132 { return (psr & Proc::Status_mode_mask) != Proc::PSR_m_hyp; }
133