}
}
+os::paging::page one_past_end_page_for_page_allocator;
+os::paging::page_allocator page_allocator(os::phys_ptr<os::paging::page>(reinterpret_cast<uintptr_t>(&one_past_end_page_for_page_allocator) - 0xFFFFFFFF80000000));
+
+
extern "C" void kmain(unsigned long magic, os::phys_ptr<const multiboot2::info_start> info) {
os::assert(magic == 0x36D76289, "Incorrect magic number: wasn't booted with multiboot2.");
os::halt();
}
- os::paging::page_allocator page_allocator{([]() {
- os::phys_ptr<os::paging::page> ram_ptr = nullptr;
- asm("mov $page_list_one_past_end - 0xFFFFFFFF80000000,%0" : "=ri"(ram_ptr));
- return ram_ptr;
- })()};
const os::phys_ptr<os::paging::page> kernel_start = ([]() {
os::phys_ptr<os::paging::page> ptr = nullptr;
asm("mov $_kernel_phys_start,%0" : "=ri"(ptr));
if (s < e) {
remove_some_mem(
s, e, kernel_start, kernel_end,
- [&page_allocator, info_start, info_end] (auto s, auto e) {
+ [info_start, info_end] (auto s, auto e) {
remove_some_mem(
s, e, info_start, info_end,
- [&page_allocator] (auto s, auto e) {
+ [] (auto s, auto e) {
page_allocator.deallocate({.ptr = s, .size = (e.get_phys_addr() - s.get_phys_addr()) / 0x1000});
}
);