]> rtime.felk.cvut.cz Git - l4.git/blob - kernel/fiasco/src/kern/arm/kip_init.cpp
update
[l4.git] / kernel / fiasco / src / kern / arm / kip_init.cpp
1 INTERFACE [arm]:
2
3 #include "kip.h"
4
5 class Kip_init
6 {
7 public:
8   static void init();
9 };
10
11
12 //---------------------------------------------------------------------------
13 IMPLEMENTATION [arm]:
14
15 #include <cstring>
16
17 #include "config.h"
18 #include "panic.h"
19 #include "boot_info.h"
20 #include "kmem.h"
21
22
23 // Make the stuff below apearing only in this compilation unit.
24 // Trick Preprocess to let the struct reside in the cc file rather
25 // than putting it into the _i.h file which is perfectly wrong in 
26 // this case.
27 namespace KIP_namespace
28 {
29   enum
30   {
31     Num_mem_descs = 20,
32     Max_len_version = 512,
33
34     Size_mem_descs = sizeof(Mword) * 2 * Num_mem_descs,
35   };
36
37   struct KIP
38   {
39     Kip kip;
40     char mem_descs[Size_mem_descs];
41   };
42
43   KIP my_kernel_info_page asm("my_kernel_info_page") __attribute__((section(".kernel_info_page"))) =
44     {
45       {
46         /* 00 */ L4_KERNEL_INFO_MAGIC,
47                  Config::kernel_version_id,
48                  (Size_mem_descs + sizeof(Kip)) >> 4,
49                  0,
50         /* 10 */ {},
51         /* 20 */ 0, 0, {},
52         /* 30 */ 0, 0, {},
53         /* 40 */ 0, 0, {},
54         /* 50 */ 0, (sizeof(Kip) << (sizeof(Mword)*4)) | Num_mem_descs, 0, 0,
55         /* 60 */ 0, 0, {},
56         /* A0 */ 0, {},
57         /* B0 */ 0, 0, {},
58         /* C0 */ {},
59         /* E0 */ 0, 0, {},
60         /* F0 */ { },
61       },
62       "",
63     };
64
65 };
66
67 IMPLEMENT
68 void Kip_init::init()
69 {
70   Kip *kinfo = reinterpret_cast<Kip*>(&KIP_namespace::my_kernel_info_page);
71   Kip::init_global_kip(kinfo);
72   kinfo->add_mem_region(Mem_desc(0, Mem_layout::User_max - 1, 
73                           Mem_desc::Conventional, true));
74 }