Commit 075c1504 authored by PhoeniX's avatar PhoeniX

Multiboot payload class wrapper

parent 6fb959be
......@@ -63,4 +63,9 @@ struct MULTIBOOT_MMAP_ENT {
uint32_t type;
} PACKED;
extern MULTIBOOT_PAYLOAD *multiboot;
class Multiboot {
private:
static MULTIBOOT_PAYLOAD *payload;
public:
static MULTIBOOT_PAYLOAD *getPayload();
};
......@@ -16,4 +16,7 @@
#include "multiboot_info.hpp"
MULTIBOOT_PAYLOAD *multiboot;
MULTIBOOT_PAYLOAD *Multiboot::payload = 0;
MULTIBOOT_PAYLOAD *Multiboot::getPayload() {
return payload;
}
......@@ -66,7 +66,8 @@ multiboot_entry:
jge 1f
add %edi, %ebx
1:
mov %ebx, multiboot-_start(%ebp)
# Multiboot::payload
mov %ebx, _ZN9Multiboot7payloadE-_start(%ebp)
# Moving first 512K to BSS
xor %esi, %esi
......
......@@ -40,8 +40,7 @@ void Pagetable::init() {
char *modules_start, *modules_top;
char *bss_start, *bss_top;
MULTIBOOT_PAYLOAD *multiboot;
asm("mov multiboot(%%rip), %q0":"=r"(multiboot));
MULTIBOOT_PAYLOAD *multiboot = Multiboot::getPayload();
asm("mov %%cr3, %q0":"=r"(pagetable));
asm("lea __stack_start__(%%rip), %q0":"=r"(stack_start));
......
......@@ -97,8 +97,7 @@ void ModuleManager::parseInternal() {
}
}
void ModuleManager::parseInitRD() {
MULTIBOOT_PAYLOAD *multiboot;
asm("mov multiboot(%%rip), %q0":"=r"(multiboot));
MULTIBOOT_PAYLOAD *multiboot = Multiboot::getPayload();
if (!multiboot || (multiboot->flags & MB_FLAG_MODS) == 0) return;
const MULTIBOOT_MODULE *mods =
reinterpret_cast<const MULTIBOOT_MODULE*>(multiboot->pmods_addr);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment