More refactoring.
parent
d0200d140f
commit
153b2db4c5
|
@ -96,7 +96,7 @@ void paging_temp_page_set_physical(u64 Physical);
|
|||
// paging functions. This should be only used by major parts of the kernel, for
|
||||
// example to map some data structures to physical memory, or if physmem_read
|
||||
// calls would be too slow.
|
||||
void paging_minivmm_setup(u64 Start, u64 End);
|
||||
void paging_minivmm_setup(void);
|
||||
u64 paging_minivmm_allocate(void);
|
||||
|
||||
// A simple page map call. This does no checks! Triple faults ahoy.
|
||||
|
|
|
@ -20,9 +20,6 @@
|
|||
#include "Tier0/panic.h"
|
||||
//#include "Tier0/prng.h"
|
||||
|
||||
extern u64 _start;
|
||||
extern u64 _end;
|
||||
|
||||
void kmain_newstack(void);
|
||||
|
||||
// Real kernel entry point, called from loader
|
||||
|
@ -61,12 +58,15 @@ void kmain(u32 LoadContextAddress)
|
|||
system_parse_load_context(LoadContext);
|
||||
kprintf("[i] Booting via %s.\n", LoadContext->LoaderName);
|
||||
kprintf("[i] Memory available: %uk.\n", system_get_memory_upper());
|
||||
kprintf("[i] Kernel physical: %x-%x.\n", LoadContext->KernelPhysicalStart, LoadContext->KernelPhysicalEnd);
|
||||
kprintf("[i] Kernel physical: %x-%x.\n", system_get_kernel_physical_start(),
|
||||
system_get_kernel_physical_start() + system_get_kernel_size());
|
||||
kprintf("[i] Loader physical: %x-%x.\n", LoadContext->LoaderPhysicalStart, LoadContext->LoaderPhysicalEnd);
|
||||
kprintf("[i] Kernel virtual: %x-%x.\n", &_start, &_end);
|
||||
kprintf("[i] Kernel virtual: %x-%x.\n", system_get_kernel_virtual_start(),
|
||||
system_get_kernel_virtual_start() + system_get_kernel_size());
|
||||
|
||||
paging_temp_page_setup();
|
||||
paging_minivmm_setup((u64)&_end, SYSTEM_KERNEL_VIRTUAL + 511 * 0x1000);
|
||||
//paging_minivmm_setup((u64)&_end, SYSTEM_KERNEL_VIRTUAL + 511 * 0x1000);
|
||||
paging_minivmm_setup();
|
||||
// Let's create a new kernel stack
|
||||
u64 StackVirtual = paging_minivmm_allocate();
|
||||
kprintf("[i] New kernel stack 0x%x\n", StackVirtual);
|
||||
|
|
|
@ -100,12 +100,12 @@ void paging_set_ml4(u64 ML4Physical)
|
|||
__asm volatile ( "mov %%rax, %%cr3\n" :: "a" (ML4Physical));
|
||||
}
|
||||
|
||||
void paging_minivmm_setup(u64 Start, u64 End)
|
||||
void paging_minivmm_setup(void)
|
||||
{
|
||||
g_MiniVMM.Start = Start;
|
||||
g_MiniVMM.End = End;
|
||||
g_MiniVMM.Top = Start;
|
||||
kprintf("[i] MiniVMM: %x - %x.\n", Start, End);
|
||||
g_MiniVMM.Start = system_get_kernel_virtual_start() + system_get_kernel_size();
|
||||
g_MiniVMM.End = system_get_kernel_virtual_start() + 511 * 0x1000;
|
||||
g_MiniVMM.Top = g_MiniVMM.Start;
|
||||
kprintf("[i] MiniVMM: %x - %x.\n", g_MiniVMM.Start, g_MiniVMM.End);
|
||||
}
|
||||
|
||||
u64 paging_minivmm_allocate(void)
|
||||
|
|
|
@ -56,6 +56,8 @@ void system_parse_load_context(T_LOAD_CONTEXT *LoadContext)
|
|||
g_SystemInfo.KernelPhysicalStart = LoadContext->KernelPhysicalStart;
|
||||
g_SystemInfo.KernelSize = LoadContext->KernelPhysicalEnd - LoadContext->KernelPhysicalStart;
|
||||
g_SystemInfo.KernelVirtualStart = SYSTEM_KERNEL_VIRTUAL;
|
||||
ASSERT(SYSTEM_KERNEL_VIRTUAL == (u64)&_start);
|
||||
ASSERT((SYSTEM_KERNEL_VIRTUAL + g_SystemInfo.KernelSize) == (u64)&_end);
|
||||
|
||||
// Bootloader name from Multiboot header
|
||||
if ((Flags >> 9) & 1)
|
||||
|
|
Loading…
Reference in New Issue