diff options
| author | TheSoeren <imhofabian@gmail.com> | 2024-09-29 08:52:28 +0000 |
|---|---|---|
| committer | TheSoeren <imhofabian@gmail.com> | 2024-09-29 08:52:28 +0000 |
| commit | eeee7967c17704fee443a3b5b02d53a580f18b73 (patch) | |
| tree | e4555b596add2a7f4514643095eda5ce5b7a21f7 | |
| parent | 4e991f05b8beb7538cee6939777f36610f8b7bc9 (diff) | |
| download | teachos-eeee7967c17704fee443a3b5b02d53a580f18b73.tar.xz teachos-eeee7967c17704fee443a3b5b02d53a580f18b73.zip | |
use multiboot_information_pointer public variable
| -rw-r--r-- | arch/x86_64/include/arch/boot/multiboot.hpp | 14 | ||||
| -rw-r--r-- | arch/x86_64/include/arch/boot/pointers.hpp | 2 | ||||
| -rw-r--r-- | arch/x86_64/include/arch/kernel/main.hpp | 2 | ||||
| -rw-r--r-- | arch/x86_64/src/boot/boot.s | 2 | ||||
| -rw-r--r-- | arch/x86_64/src/kernel/main.cpp | 16 | ||||
| -rw-r--r-- | src/kernel/main.cpp | 5 |
6 files changed, 28 insertions, 13 deletions
diff --git a/arch/x86_64/include/arch/boot/multiboot.hpp b/arch/x86_64/include/arch/boot/multiboot.hpp new file mode 100644 index 0000000..c6fed55 --- /dev/null +++ b/arch/x86_64/include/arch/boot/multiboot.hpp @@ -0,0 +1,14 @@ +#include <cstdint> + +struct multiboot_tag +{ + uint32_t type; + uint32_t size; +}; + +struct multiboot_info +{ + uint32_t total_size; + uint32_t reserved; + struct multiboot_tag tags[1]; // TODO: Size 0 +};
\ No newline at end of file diff --git a/arch/x86_64/include/arch/boot/pointers.hpp b/arch/x86_64/include/arch/boot/pointers.hpp index dcd14fe..c7424e2 100644 --- a/arch/x86_64/include/arch/boot/pointers.hpp +++ b/arch/x86_64/include/arch/boot/pointers.hpp @@ -5,7 +5,7 @@ namespace teachos::arch::boot { - extern "C" std::byte const multiboot_information_pointer; + extern "C" size_t const multiboot_information_pointer; } // namespace teachos::arch::boot #endif
\ No newline at end of file diff --git a/arch/x86_64/include/arch/kernel/main.hpp b/arch/x86_64/include/arch/kernel/main.hpp index 57b9b58..6961594 100644 --- a/arch/x86_64/include/arch/kernel/main.hpp +++ b/arch/x86_64/include/arch/kernel/main.hpp @@ -5,7 +5,7 @@ namespace teachos::arch::kernel { - auto main(size_t multiboot_information_address) -> void; + auto main() -> void; } #endif
\ No newline at end of file diff --git a/arch/x86_64/src/boot/boot.s b/arch/x86_64/src/boot/boot.s index d41981a..7b4e193 100644 --- a/arch/x86_64/src/boot/boot.s +++ b/arch/x86_64/src/boot/boot.s @@ -366,7 +366,5 @@ _transition_to_long_mode: call _init - mov multiboot_information_pointer, %ebx - mov %ebx, %edi call kernel_main hlt diff --git a/arch/x86_64/src/kernel/main.cpp b/arch/x86_64/src/kernel/main.cpp index cb5092c..e77818e 100644 --- a/arch/x86_64/src/kernel/main.cpp +++ b/arch/x86_64/src/kernel/main.cpp @@ -1,19 +1,25 @@ #include "arch/kernel/main.hpp" +#include "arch/boot/multiboot.hpp" +#include "arch/boot/pointers.hpp" #include "arch/video/vga/text.hpp" namespace teachos::arch::kernel { - auto main(size_t multiboot_information_address) -> void + auto main() -> void { using namespace video::vga; + auto t = arch::boot::multiboot_information_pointer; + // auto multiboot_tag = (struct multiboot_tag *) ((uint8_t) t + 8); + // for (auto tag = multiboot_tag; tag->type != ) + + if (t == 300) + { + } + text::clear(); text::cursor(false); text::write("TeachOS is starting up...", text::common_attributes::green_on_black); - if (multiboot_information_address > 5) - { - return; - } } } // namespace teachos::arch::kernel diff --git a/src/kernel/main.cpp b/src/kernel/main.cpp index a1ef159..4799b29 100644 --- a/src/kernel/main.cpp +++ b/src/kernel/main.cpp @@ -1,6 +1,3 @@ #include "arch/kernel/main.hpp" -extern "C" auto kernel_main(size_t multiboot_information_address) -> void -{ - teachos::arch::kernel::main(multiboot_information_address); -} +extern "C" auto kernel_main() -> void { teachos::arch::kernel::main(); } |
