]> rtime.felk.cvut.cz Git - l4.git/blob - l4/pkg/bootstrap/server/src/loader_mbi.cc
update
[l4.git] / l4 / pkg / bootstrap / server / src / loader_mbi.cc
1 /*
2  * (c) 2008-2013 Adam Lackorzynski <adam@os.inf.tu-dresden.de>,
3  *               Alexander Warg <warg@os.inf.tu-dresden.de>
4  *     economic rights: Technische Universität Dresden (Germany)
5  *
6  * This file is part of TUD:OS and distributed under the terms of the
7  * GNU General Public License 2.
8  * Please see the COPYING-GPL-2 file for details.
9  */
10 /*
11  * Used when our boot loader does not supply a mbi structure.
12  */
13
14 #include <stdio.h>
15
16 #include "loader_mbi.h"
17
18 static l4util_mb_info_t my_loader_mbi;
19
20 l4util_mb_info_t *loader_mbi()
21 {
22   return &my_loader_mbi;
23 }
24
25 void loader_mbi_add_cmdline(const char *cmdline)
26 {
27   my_loader_mbi.cmdline = (l4_uint32_t)(unsigned long)cmdline;
28   my_loader_mbi.flags |= L4UTIL_MB_CMDLINE;
29 }
30
31 l4util_mb_info_t *init_loader_mbi_x86_realmode(void *realmode_pointer)
32 {
33   my_loader_mbi.flags     |= L4UTIL_MB_MEMORY;
34   my_loader_mbi.mem_lower  = 0x9f * 4;
35
36   unsigned long *cmd_line_ptr;
37
38   my_loader_mbi.mem_upper  = *(unsigned long *)((char *)realmode_pointer + 0x1e0);
39   printf("Detected memory size: %dKB\n", my_loader_mbi.mem_upper);
40
41   cmd_line_ptr = (unsigned long *)((char *)realmode_pointer + 0x228);
42   if (cmd_line_ptr && *cmd_line_ptr)
43     {
44       my_loader_mbi.flags |= L4UTIL_MB_CMDLINE;
45       my_loader_mbi.cmdline = *cmd_line_ptr;
46     }
47
48   return &my_loader_mbi;
49 }