diff options
| author | Emu <89668582+EmulatedSeasons@users.noreply.github.com> | 2024-05-31 23:38:46 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-05-31 23:38:46 -0400 |
| commit | 27a44e0d79d1c6e01cd832feb8ad958d5999b5e3 (patch) | |
| tree | 3759eb02fcad7a609a064080d81b7c6f9dbec4c8 /kernel/arch/x86/multiboot.cpp | |
| parent | 639240bbf498195912d8ceb6cb396b89391a5b1b (diff) | |
| parent | fd5a1699592ce0afafc42ebf22401596abcdfc28 (diff) | |
Merge pull request #1 from EmulatedSeasons/limineswitch
Limineswitch
Diffstat (limited to 'kernel/arch/x86/multiboot.cpp')
| -rw-r--r-- | kernel/arch/x86/multiboot.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/kernel/arch/x86/multiboot.cpp b/kernel/arch/x86/multiboot.cpp new file mode 100644 index 0000000..9f3eedb --- /dev/null +++ b/kernel/arch/x86/multiboot.cpp @@ -0,0 +1,30 @@ +#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include "multiboot.h"
+#include <arch/i386/tmtty.h>
+
+// gets the memory map and stuff
+extern "C" void multiboot_main(multiboot_info_t* mbd, uint32_t magic) {
+ terminal_initialize();
+ //printf("multiboot struc addr: %x\n", mbd);
+ if (magic != MULTIBOOT_BOOTLOADER_MAGIC) {
+ printf("Invalid multiboot magic number\n");
+ abort();
+ }
+
+ // checks bit 6 to see if there's a valid memory map
+ if (!(mbd->flags >> 6 & 0x1)) {
+ printf("Invalid GRUB memory map\n");
+ abort();
+ }
+
+ // loop through memory map and display the values
+ for (int i = 0; i < mbd->mmap_length; i += sizeof(multiboot_memory_map_t)) {
+ multiboot_memory_map_t* mmmt = (multiboot_memory_map_t*)(mbd->mmap_addr + i);
+
+ printf("Start Addr: 0x%lx | Length: 0x%lx | Size: 0x%x | Type: %d\n",
+ mmmt->addr, mmmt->len, mmmt->size, mmmt->type);
+ //printf("%lx,%x,%x,%d\n", mmmt->size, mmmt->size, mmmt->size, mmmt->size);
+ }
+}
\ No newline at end of file |
