#include "boot_cpu.h"
#include "boot_paging.h"
#include "boot_console.h"
+#include "kernel_console.h"
#include "checksum.h"
#include "config.h"
#include "globalconfig.h"
#include "kmem_alloc.h"
#include "mem_layout.h"
#include "mem_region.h"
-#include "multiboot.h"
#include "panic.h"
#include "processor.h"
#include "reset.h"
+#include "mem_unit.h"
struct check_sum
{
Proc::pause();
}
+void assert_fail(char const *expr, char const *file, unsigned int line)
+{
+ panic("Assertion failed at %s:%u: %s\n", file, line, expr);
+}
+
// test if [start1..end1-1] overlaps [start2..end2-1]
static
void
start1, end1, str, start2, end2);
}
-typedef void (*Start)(Multiboot_info *, unsigned, unsigned) FIASCO_FASTCALL;
+typedef void (*Start)(unsigned) FIASCO_FASTCALL;
extern "C" FIASCO_FASTCALL
void
-bootstrap (Multiboot_info *mbi, unsigned int flag)
+bootstrap()
{
extern Kip my_kernel_info_page;
Start start;
- assert(flag == Multiboot_header::Valid);
-
- // setup stuff for base_paging_init()
+ // setup stuff for base_paging_init()
base_cpu_setup();
// now do base_paging_init(): sets up paging with one-to-one mapping
base_paging_init();
asm volatile ("" ::: "memory");
Kip::init_global_kip(&my_kernel_info_page);
+ Kconsole::init();
Boot_console::init();
printf("Boot: KIP @ %p\n", Kip::k());
base_map_physical_memory_for_kernel();
+ Mem_unit::tlb_flush();
+
start = (Start)_start;
- Address phys_start = (Address)_start - Mem_layout::Kernel_image;
- Address phys_end = (Address)_end - Mem_layout::Kernel_image;
+ Address phys_start = (Address)_start - Mem_layout::Kernel_image + Mem_layout::Kernel_image_phys;
+ Address phys_end = (Address)_end - Mem_layout::Kernel_image + Mem_layout::Kernel_image_phys;
check_overlap ("VGA/IO", phys_start, phys_end, 0xa0000, 0x100000);
if (Checksum::get_checksum_ro() != check_sum.checksum_ro)
if (Checksum::get_checksum_rw() != check_sum.checksum_rw)
panic("Read-write (data) checksum does not match.");
- start (mbi, flag, check_sum.checksum_ro);
+ start(check_sum.checksum_ro);
}