feat: Started om paging
This commit is contained in:
parent
2bbc7dd70f
commit
fc4de346a3
9 changed files with 275 additions and 9 deletions
|
@ -10,6 +10,7 @@
|
|||
#include <arch/idt.h>
|
||||
#include <sys/kpanic.h>
|
||||
#include <mm/pmm.h>
|
||||
#include <arch/paging.h>
|
||||
|
||||
__attribute__((used, section(".limine_requests"))) static volatile LIMINE_BASE_REVISION(3);
|
||||
__attribute__((used, section(".limine_requests"))) static volatile struct limine_memmap_request memmap_request = {
|
||||
|
@ -18,14 +19,21 @@ __attribute__((used, section(".limine_requests"))) static volatile struct limine
|
|||
__attribute__((used, section(".limine_requests"))) static volatile struct limine_hhdm_request hhdm_request = {
|
||||
.id = LIMINE_HHDM_REQUEST,
|
||||
.revision = 0};
|
||||
__attribute__((used, section(".limine_requests"))) volatile struct limine_executable_address_request kernel_address_request = {
|
||||
.id = LIMINE_EXECUTABLE_ADDRESS_REQUEST,
|
||||
.response = 0};
|
||||
__attribute__((used, section(".limine_requests_start"))) static volatile LIMINE_REQUESTS_START_MARKER;
|
||||
__attribute__((used, section(".limine_requests_end"))) static volatile LIMINE_REQUESTS_END_MARKER;
|
||||
|
||||
uint64_t hhdm_offset = 0;
|
||||
struct limine_memmap_response *memmap = NULL;
|
||||
uint64_t kvirt = 0;
|
||||
uint64_t kphys = 0;
|
||||
uint64_t kstack_top = 0;
|
||||
|
||||
void emk_entry(void)
|
||||
{
|
||||
__asm__ volatile("movq %%rsp, %0" : "=r"(kstack_top));
|
||||
if (serial_init(COM1) != 0)
|
||||
{
|
||||
/* Just halt and say nothing */
|
||||
|
@ -62,13 +70,15 @@ void emk_entry(void)
|
|||
log_early("Initialized PMM");
|
||||
|
||||
/* Test allocate a single physical page */
|
||||
char *a = pmm_request_pages(1, true);
|
||||
char *a = palloc(1, true);
|
||||
if (!a)
|
||||
kpanic(NULL, "Failed to allocate single physical page");
|
||||
|
||||
*a = 32;
|
||||
log_early("Allocated 1 physical page: %llx", (uint64_t)a);
|
||||
pmm_release_pages(a, 1);
|
||||
pfree(a, 1);
|
||||
|
||||
paging_init();
|
||||
|
||||
hlt();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue