Kernel: Add better support for bootloaders loading the kernel

Before I assumed that bootloaders loaded the kernel at physical address
0, but this patch kinda allows loading to different addresses. This
still doesn't fully work as kernel bootstrap paging relies on kernel
being loaded at 0
This commit is contained in:
2024-08-22 14:20:51 +03:00
parent abc788c756
commit fb35f06cf5
10 changed files with 40 additions and 12 deletions

View File

@@ -33,4 +33,5 @@ struct BananBootloaderInfo
uint32_t command_line_addr;
uint32_t framebuffer_addr;
uint32_t memory_map_addr;
uint32_t kernel_paddr;
} __attribute__((packed));

View File

@@ -37,6 +37,7 @@ namespace Kernel
BAN::String command_line;
FramebufferInfo framebuffer {};
RSDP rsdp {};
paddr_t kernel_paddr {};
BAN::Vector<MemoryMapEntry> memory_map_entries;
};

View File

@@ -10,9 +10,6 @@
#error
#endif
#define V2P(vaddr) (((vaddr_t)(vaddr)) - KERNEL_OFFSET)
#define P2V(paddr) (((paddr_t)(paddr)) + KERNEL_OFFSET)
#define PAGE_SIZE ((uintptr_t)4096)
#define PAGE_SIZE_SHIFT 12
#define PAGE_ADDR_MASK (~(uintptr_t)0xFFF)