From 80a7c9dccffa476160f2eeccd83c02b442cb2d70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felix=20Quei=C3=9Fner?= Date: Wed, 4 May 2016 11:51:23 +0200 Subject: [PATCH] Passes multiboot structure to the system. --- prototypes/base/entrypoint.S | 1 + prototypes/base/include/multiboot.hpp | 7 +++++++ prototypes/base/init.cpp | 7 ++++++- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/prototypes/base/entrypoint.S b/prototypes/base/entrypoint.S index b25bc1e..ba94dae 100644 --- a/prototypes/base/entrypoint.S +++ b/prototypes/base/entrypoint.S @@ -8,6 +8,7 @@ _start: mov $kernel_stack, %esp + push %ebx call compat_call_ctors call init call compat_call_dtors diff --git a/prototypes/base/include/multiboot.hpp b/prototypes/base/include/multiboot.hpp index d8e370b..10121f4 100644 --- a/prototypes/base/include/multiboot.hpp +++ b/prototypes/base/include/multiboot.hpp @@ -33,6 +33,13 @@ namespace multiboot T const & operator [](size_t idx) { return this->data[idx]; } + + const T *begin() const { + return &data[0]; + } + const T *end() const { + return &data[length]; + } } __attribute__((packed)); // Make sure the size is not dependend on the template parameter diff --git a/prototypes/base/init.cpp b/prototypes/base/init.cpp index 77f0441..3aca0a6 100644 --- a/prototypes/base/init.cpp +++ b/prototypes/base/init.cpp @@ -9,7 +9,7 @@ using namespace multiboot; -extern "C" void init(Structure *data) +extern "C" void init(Structure const * data) { Console::main << "Hello World!\n" @@ -23,6 +23,11 @@ extern "C" void init(Structure *data) << "command line: " << data->commandline << "\n" << "count of modules: " << data->modules.length << "\n"; + for(const Module &module : data->modules) { + Console::main + << "Module " << module.name << "\n"; + } + /* PMM::markOccupied(physical_t(0x1500)); for(int i = 0; i < 10; i++) {