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