5 * (c) 2008-2009 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
6 * Alexander Warg <warg@os.inf.tu-dresden.de>
7 * economic rights: Technische Universität Dresden (Germany)
9 * This file is part of TUD:OS and distributed under the terms of the
10 * GNU General Public License 2.
11 * Please see the COPYING-GPL-2 file for details.
16 #include <l4/sys/kip.h>
17 #include <l4/util/l4_macros.h>
26 using L4::Kip::Mem_desc;
28 extern unsigned char _stack;
31 * setup Kernel Info Page
34 init_kip_v2(void *_l4i, boot_info_t *bi, l4util_mb_info_t *mbi,
35 Region_list *ram, Region_list *regions)
37 l4_kernel_info_t *l4i = (l4_kernel_info_t *)_l4i;
39 unsigned char l4_api = l4i->version >> 24;
41 if (l4_api != 0x87 /*VERSION_FIASCO*/)
42 panic("cannot load kernels other than Fiasco");
44 Mem_desc *md = Mem_desc::first(_l4i);
45 for (Region const* c = ram->begin(); c != ram->end(); ++c)
46 (md++)->set(c->begin(), c->end(), Mem_desc::Conventional);
48 for (Region const *c = regions->begin(); c != regions->end(); ++c)
50 Mem_desc::Mem_type type = Mem_desc::Reserved;
51 unsigned char sub_type = 0;
59 type = Mem_desc::Reserved;
62 type = Mem_desc::Dedicated;
65 type = Mem_desc::Bootloader;
68 type = Mem_desc::Arch;
69 sub_type = c->sub_type();
72 (md++)->set(c->begin(), c->end() - 1, type, sub_type);
75 l4i->user_ptr = (unsigned long)mbi;
77 /* set up sigma0 info */
78 l4i->sigma0_esp = bi->sigma0_stack;
79 l4i->sigma0_eip = bi->sigma0_start;
80 printf(" Sigma0 config ip:"l4_addr_fmt" sp:"l4_addr_fmt"\n",
81 l4i->sigma0_eip, l4i->sigma0_esp);
83 /* set up roottask info */
84 //l4i->root_esp = (l4_umword_t) &_stack;
85 l4i->root_eip = bi->roottask_start;
86 printf(" Roottask config ip:"l4_addr_fmt" sp:"l4_addr_fmt"\n",
87 l4i->root_eip, l4i->root_esp);
90 strncpy(l4i->platform_info.name, PLATFORM_TYPE,
91 sizeof(l4i->platform_info.name));
92 l4i->platform_info.name[sizeof(l4i->platform_info.name) - 1] = 0;