]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/mem_layout.cpp
update
[l4.git] / kernel / fiasco / src / kern / mem_layout.cpp
1 INTERFACE:
2
3 #include "l4_types.h"
4
5 class Mem_layout
6 {
7 public:
8   /// reflect symbols in linker script
9   static const char load            asm ("_load");
10   static const char image_start     asm ("_kernel_image_start");
11   static const char start           asm ("_start");
12   static const char end             asm ("_end");
13   static const char ecode           asm ("_ecode");
14   static const char etext           asm ("_etext");
15   static const char data_start      asm ("_kernel_data_start");
16   static const char edata           asm ("_edata");
17   static const char initcall_start  asm ("_initcall_start");
18   static const char initcall_end    asm ("_initcall_end");
19
20   static Mword in_tcbs (Address a); // FIXME
21   static Mword in_kernel (Address a); // XXX: not right for UX
22 };
23
24 IMPLEMENTATION:
25
26 #include "config.h"
27
28 PUBLIC static inline
29 bool
30 Mem_layout::is_caps_area(Address a)
31 { return (a >= Caps_start) && (a < Caps_end); }
32
33 PUBLIC static inline
34 User<Utcb>::Ptr &
35 Mem_layout::user_utcb_ptr(unsigned cpu)
36 { return reinterpret_cast<User<Utcb>::Ptr*>(Utcb_ptr_page)[cpu]; }
37
38 IMPLEMENT inline
39 Mword
40 Mem_layout::in_kernel (Address a)
41 {
42   return a >= User_max;
43 }
44
45 PUBLIC static inline
46 Mword
47 Mem_layout::in_kernel_code (Address a)
48 {
49   return a >= (Address)&start && a < (Address)&ecode;
50 }
51