From c93691019982a5c9c6ca978991b12d5cc6616d99 Mon Sep 17 00:00:00 2001 From: kamkow1 Date: Fri, 15 Aug 2025 22:09:00 +0200 Subject: [PATCH] Limine modules request, run with 1GB pages support for x86_64 --- Makefile | 23 ++++++++++++----------- kernel/bootinfo/bootinfo.c | 7 +++++++ kernel/bootinfo/bootinfo.h | 1 + run/qemu-x86_64.sh | 4 +++- 4 files changed, 23 insertions(+), 12 deletions(-) diff --git a/Makefile b/Makefile index fa34022..8ce5218 100644 --- a/Makefile +++ b/Makefile @@ -23,25 +23,26 @@ clean: rm -f mop2.iso base.img base: - dd if=/dev/zero of=base.img bs=1M count=32 + dd if=/dev/zero of=base.img bs=1M count=10 mformat -F -i base.img :: mcopy -i base.img Makefile :: mdir -i base.img :: iso: - rm -rf iso_root - mkdir -p iso_root/boot - cp -v kernel/mop2 iso_root/boot - mkdir -p iso_root/boot/limine - cp -v limine.conf limine/limine-bios.sys limine/limine-bios-cd.bin \ + @rm -rf iso_root + @mkdir -p iso_root/boot + @cp -v kernel/mop2 iso_root/boot + @cp -v base.img iso_root + @mkdir -p iso_root/boot/limine + @cp -v limine.conf limine/limine-bios.sys limine/limine-bios-cd.bin \ limine/limine-uefi-cd.bin iso_root/boot/limine - mkdir -p iso_root/EFI/BOOT - cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT - cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT - xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \ + @mkdir -p iso_root/EFI/BOOT + @cp -v limine/BOOTX64.EFI iso_root/EFI/BOOT + @cp -v limine/BOOTIA32.EFI iso_root/EFI/BOOT + @xorriso -as mkisofs -R -r -J -b boot/limine/limine-bios-cd.bin \ -no-emul-boot -boot-load-size 4 -boot-info-table -hfsplus \ -apm-block-size 2048 --efi-boot boot/limine/limine-uefi-cd.bin \ -efi-boot-part --efi-boot-image --protective-msdos-label \ iso_root -o mop2.iso - ./limine/limine bios-install mop2.iso + @./limine/limine bios-install mop2.iso diff --git a/kernel/bootinfo/bootinfo.c b/kernel/bootinfo/bootinfo.c index b030b72..e1162cf 100644 --- a/kernel/bootinfo/bootinfo.c +++ b/kernel/bootinfo/bootinfo.c @@ -40,12 +40,19 @@ static volatile struct limine_framebuffer_request FB_REQ = { .id = LIMINE_FRAMEBUFFER_REQUEST, .revision = 0, }; +static volatile struct limine_module_request MODULE_REQ = { + .id = LIMINE_MODULE_REQUEST, .revision = 0, +}; + void bootinfo_init(void) { if (FB_REQ.response == NULL || FB_REQ.response->framebuffer_count < 1) { hal_hang(); } BOOT_INFO.fb = FB_REQ.response->framebuffers[0]; + struct limine_module_response *modulesres= MODULE_REQ.response; + BOOT_INFO.modules = modulesres; + struct limine_paging_mode_response *pagingres = PAGING_REQ.response; #if defined(__x86_64__) if (pagingres->mode != LIMINE_PAGING_MODE_X86_64_4LVL) { diff --git a/kernel/bootinfo/bootinfo.h b/kernel/bootinfo/bootinfo.h index adea53e..280dab7 100644 --- a/kernel/bootinfo/bootinfo.h +++ b/kernel/bootinfo/bootinfo.h @@ -22,6 +22,7 @@ typedef struct { LIMINE_PTR(struct limine_smp_response *) smp; uint64_t smp_bspindex; LIMINE_PTR(struct limine_framebuffer *) fb; + LIMINE_PTR(struct limine_module_response *) modules; } BootInfo; extern BootInfo BOOT_INFO; diff --git a/run/qemu-x86_64.sh b/run/qemu-x86_64.sh index 06732c6..84a6b0e 100755 --- a/run/qemu-x86_64.sh +++ b/run/qemu-x86_64.sh @@ -1,3 +1,5 @@ #!/bin/sh -qemu-system-x86_64 -m 4g -cdrom mop2.iso -boot d -serial stdio $@ +set -x + +qemu-system-x86_64 -cpu qemu64,+pdpe1gb -m 4G -cdrom mop2.iso -boot d -serial stdio $@