added mm_early_vpage_alloc(); kernel still crashing...

git-svn-id: svn://anubis/hos/trunk@98 5b3e749e-e535-0410-8002-a9bb6afbdfca
This commit is contained in:
josh 2010-01-28 04:22:02 +00:00
parent 5ac343a2e8
commit d41ffbbedc
3 changed files with 22 additions and 3 deletions

View File

@ -49,8 +49,11 @@ void isr(u8_t int_num, int_stack_t * istack)
void interrupts_bootstrap()
{
u32_t idt_base = mm_page_alloc();
u64_t * idt = (u64_t *) (idt_base + KERNEL_OFFSET);
u32_t idt_phys = mm_page_alloc();
u32_t idt_virt = mm_early_vpage_alloc();
mm_map(idt_virt, idt_phys, 0, 1);
u64_t * idt = (u64_t *) idt_virt;
idt[0] = MAKE_IDT_DESCRIPTOR(KERNEL_CODE_SEGMENT, isr_0, 0);
idt[1] = MAKE_IDT_DESCRIPTOR(KERNEL_CODE_SEGMENT, isr_1, 0);
idt[2] = MAKE_IDT_DESCRIPTOR(KERNEL_CODE_SEGMENT, isr_2, 0);
@ -101,7 +104,7 @@ void interrupts_bootstrap()
idt[47] = MAKE_IDT_DESCRIPTOR(KERNEL_CODE_SEGMENT, isr_47, 0);
idt[48] = MAKE_IDT_DESCRIPTOR(KERNEL_CODE_SEGMENT, isr_48, 0);
idt[49] = MAKE_IDT_DESCRIPTOR(KERNEL_CODE_SEGMENT, isr_49, 0);
idtr.base = idt_base;
idtr.base = idt_phys;
idtr.limit = 49 * sizeof(idt[0]) - 1;
__asm__ __volatile__ ("lidt (idtr)");
}

View File

@ -131,6 +131,8 @@ void mm_bootstrap()
/* move the heap back to after the page allocation pages */
mm_heap_base = (u32_t) &page_alloc_pages[last_page_alloc_page + 1];
/* ok, now mm_early_vpage_alloc() should be functional */
/* allocate the page directory */
u32_t page_directory_phys = mm_early_page_alloc();
early_page_directory_ptr = (pagedirectory_t *)
@ -359,6 +361,19 @@ u32_t mm_page_alloc()
return page_address;
}
/**************************************************************************
* This function allocates a virtual page. It should only be called *
* during the bootstrap process, before the kernel begins its normal *
* operation. It adjusts the heap pointer to push it back beyond any *
* bootstrap pages allocated. *
*************************************************************************/
u32_t mm_early_vpage_alloc()
{
u32_t vaddress = mm_heap_base;
mm_heap_base += PAGE_SIZE;
return vaddress;
}
void mm_print_memory_map()
{
kprintf("Bootloader provided memory map:\n");

View File

@ -56,6 +56,7 @@ int mm_map(u32_t virtual_address, u32_t physical_address,
u32_t mm_early_page_alloc();
u32_t mm_page_alloc();
u32_t mm_early_vpage_alloc();
void mm_print_memory_map();