2 #include "kernel/kernel.h"
3 #include "arch/common/elf_boot.h"
4 #include "libopenbios/sys_info.h"
9 #ifdef CONFIG_DEBUG_BOOT
15 unsigned int qemu_mem_size;
17 void collect_multiboot_info(struct sys_info *);
19 void collect_sys_info(struct sys_info *info)
22 unsigned long long total = 0;
23 struct memrange *mmap;
25 /* Pick up paramters given by bootloader to us */
26 //info->boot_type = boot_ctx->eax;
27 //info->boot_data = boot_ctx->ebx;
28 info->boot_arg = boot_ctx->param[0];
29 //debug("boot eax = %#lx\n", info->boot_type);
30 //debug("boot ebx = %#lx\n", info->boot_data);
31 info->boot_type = ELF_BHDR_MAGIC;
32 info->boot_data = virt_to_phys(&elf_image_notes);
33 debug("boot arg = %#lx\n", info->boot_arg);
35 collect_elfboot_info(info);
36 #ifdef CONFIG_LINUXBIOS
37 collect_linuxbios_info(info);
39 #ifdef CONFIG_IMAGE_ELF_MULTIBOOT
40 collect_multiboot_info(info);
43 if (!info->memrange) {
44 info->n_memranges = 1;
45 info->memrange = malloc(1 * sizeof(struct memrange));
46 info->memrange[0].base = 0;
47 info->memrange[0].size = qemu_mem_size;
52 for (i = 0; i < info->n_memranges; i++) {
53 debug("%08lx-", (long)mmap[i].base);
54 debug("%08lx\n", (long)mmap[i].base + (long)mmap[i].size);
55 total += mmap[i].size;
57 debug("RAM %ld MB\n", (long)total >> 20);