:: commit 058da70164d29c1828d9fd2c6357b33ac557bb85

mintsuki <mintsuki@protonmail.com> — 2021-03-07 03:31

parents: e56df5b3ab

Misc fixes

diff --git a/stage23/mm/pmm.s2.c b/stage23/mm/pmm.s2.c
index 25800b01..f4ce9d76 100644
--- a/stage23/mm/pmm.s2.c
+++ b/stage23/mm/pmm.s2.c
@@ -321,6 +321,10 @@ void init_memmap(void) {
             panic("AllocatePages %x", status);
     }
 
+    memmap_alloc_range(bump_allocator_base,
+                       bump_allocator_limit - bump_allocator_base,
+                       MEMMAP_RESERVED, true, true);
+
     print("pmm: Conventional mem allocator base:  %X\n", bump_allocator_base);
     print("pmm: Conventional mem allocator limit: %X\n", bump_allocator_limit);
 }
@@ -384,6 +388,7 @@ void *ext_mem_alloc_aligned_type(size_t count, size_t alignment, uint32_t type)
 bool memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type, bool free_only, bool do_panic) {
     uint64_t top = base + length;
 
+#if defined (bios)
     if (base < 0x100000) {
         if (do_panic) {
             // We don't do allocations below 1 MiB
@@ -393,6 +398,7 @@ bool memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type, bool free
             return false;
         }
     }
+#endif
 
     for (size_t i = 0; i < memmap_entries; i++) {
         if (free_only && memmap[i].type != 1)
diff --git a/stage23/protos/stivale.c b/stage23/protos/stivale.c
index e3134326..4b2a66d4 100644
--- a/stage23/protos/stivale.c
+++ b/stage23/protos/stivale.c
@@ -279,8 +279,6 @@ __attribute__((noreturn)) void stivale_spinup(
     pic_flush();
 
 #if defined (uefi)
-    gdt.ptr += (uintptr_t)ImageBase;
-
     asm volatile (
         "lgdt %0\n\t"
         :
diff --git a/stage23/protos/stivale2.c b/stage23/protos/stivale2.c
index 054995c6..bcfc0570 100644
--- a/stage23/protos/stivale2.c
+++ b/stage23/protos/stivale2.c
@@ -341,7 +341,6 @@ void stivale2_load(char *config, char *cmdline, bool pxe) {
     (void)pxe;
 #endif
 
-#if defined (bios)
     //////////////////////////////////////////////
     // Create memmap struct tag
     //////////////////////////////////////////////
@@ -361,7 +360,6 @@ void stivale2_load(char *config, char *cmdline, bool pxe) {
 
     append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
     }
-#endif
 
     //////////////////////////////////////////////
     // List tags
diff --git a/stage23/sys/smp_trampoline.real b/stage23/sys/smp_trampoline.real
index c0f31204..fcc24dc9 100644
--- a/stage23/sys/smp_trampoline.real
+++ b/stage23/sys/smp_trampoline.real
@@ -5,6 +5,7 @@ smp_trampoline:
     cli
     cld
 
+jmp $
     mov ebx, cs
     shl ebx, 4
 
diff --git a/test/limine.cfg b/test/limine.cfg
index 8235263c..6ed3684a 100644
--- a/test/limine.cfg
+++ b/test/limine.cfg
@@ -6,35 +6,22 @@ MENU_FONT=boot:///boot/font.bin
 THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa
 THEME_MARGIN=64
 
-BACKGROUND_PATH=boot:///boot/bg.bmp
 
 :+Legacy
 
 ::Stivale Test
 
-PROTOCOL=stivale
+PROTOCOL=stivale2
 KERNEL_PATH=boot:///boot/test.elf
 KERNEL_CMDLINE=Hi! This is an example!
 
-MODULE_PATH=boot:///boot/test.elf
-MODULE_STRING=yooooo
-
-MODULE_PATH=boot:///boot/bg.bmp
-MODULE_STRING=yooooo
 
 ::Stivale Test (KASLR)
 
 PROTOCOL=stivale
-KASLR=yes
 KERNEL_PATH=boot:///boot/test.elf
 KERNEL_CMDLINE=Hi! This is an example!
 
-MODULE_PATH=boot:///boot/test.elf
-MODULE_STRING=yooooo
-
-MODULE_PATH=boot:///boot/bg.bmp
-MODULE_STRING=yooooo
-
 :Stivale2 Test
 
 PROTOCOL=stivale2
tab: 248 wrap: offon