hos/kernel/boot/k_bootstrap.c
josh 2faa2cc8d6 added mm_bootstrap() skeleton function
git-svn-id: svn://anubis/hos/trunk@31 5b3e749e-e535-0410-8002-a9bb6afbdfca
2009-07-01 17:34:52 +00:00

52 lines
1.5 KiB
C

#include "hos_types.h"
#include "hos_defines.h"
#include "multiboot.h"
#include "k_early_panic.h"
#include "mm/mm.h"
#define DEBUG_LETTER(col,chr) *(u16_t *)(CONSOLE_MEMORY + 160 * 8 + (col) * 2) \
= 0x0700 | (chr)
u8_t bootstrap_stack[4096];
/**************************************************************************
* This function is invoked before paging is enabled. Segmentation is *
* utilized to map virtual address 0xE000_0000 to physical address 0x0. *
*************************************************************************/
u32_t k_bootstrap(mb_info_t * mb_info, u32_t mb_magic)
{
DEBUG_LETTER(2, 'c');
if (mb_magic != MB_BOOTLOADER_MAGIC)
{
k_early_panic("Bad multiboot magic identifier!");
}
if ( ! (mb_info->flags & MB_BOOTLOADER_MMAP) )
{
k_early_panic("No memory map provided by bootloader!");
}
mb_mmap_t * mmap = (mb_mmap_t *) (mb_info->mmap_addr + HOS_KERNEL_OFFSET - 4);
{
int sz;
for (sz = 0; sz < mb_info->mmap_length; sz += mmap->size + 4)
{
mm_record_mmap_entry(mmap);
mmap = (mb_mmap_t *) (((u32_t)mmap) + mmap->size + 4);
}
}
DEBUG_LETTER(3, 'd');
/*
* These functions could destroy the multiboot information block and
* associated structures, so we must be finished reading those structures
* before calling them.
*/
mm_bootstrap();
return 0;
}