Misc fixes

This commit is contained in:
mintsuki 2021-03-07 04:31:06 +01:00
parent e56df5b3ab
commit 058da70164
5 changed files with 8 additions and 18 deletions

View File

@ -321,6 +321,10 @@ void init_memmap(void) {
panic("AllocatePages %x", status); 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 base: %X\n", bump_allocator_base);
print("pmm: Conventional mem allocator limit: %X\n", bump_allocator_limit); 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) { bool memmap_alloc_range(uint64_t base, uint64_t length, uint32_t type, bool free_only, bool do_panic) {
uint64_t top = base + length; uint64_t top = base + length;
#if defined (bios)
if (base < 0x100000) { if (base < 0x100000) {
if (do_panic) { if (do_panic) {
// We don't do allocations below 1 MiB // 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; return false;
} }
} }
#endif
for (size_t i = 0; i < memmap_entries; i++) { for (size_t i = 0; i < memmap_entries; i++) {
if (free_only && memmap[i].type != 1) if (free_only && memmap[i].type != 1)

View File

@ -279,8 +279,6 @@ __attribute__((noreturn)) void stivale_spinup(
pic_flush(); pic_flush();
#if defined (uefi) #if defined (uefi)
gdt.ptr += (uintptr_t)ImageBase;
asm volatile ( asm volatile (
"lgdt %0\n\t" "lgdt %0\n\t"
: :

View File

@ -341,7 +341,6 @@ void stivale2_load(char *config, char *cmdline, bool pxe) {
(void)pxe; (void)pxe;
#endif #endif
#if defined (bios)
////////////////////////////////////////////// //////////////////////////////////////////////
// Create memmap struct tag // 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); append_tag(&stivale2_struct, (struct stivale2_tag *)tag);
} }
#endif
////////////////////////////////////////////// //////////////////////////////////////////////
// List tags // List tags

View File

@ -5,6 +5,7 @@ smp_trampoline:
cli cli
cld cld
jmp $
mov ebx, cs mov ebx, cs
shl ebx, 4 shl ebx, 4

View File

@ -6,35 +6,22 @@ MENU_FONT=boot:///boot/font.bin
THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa THEME_COLOURS=60000000;aa0000;00aaff;aa5500;0000aa;aa00aa;9076de;aaaaaa
THEME_MARGIN=64 THEME_MARGIN=64
BACKGROUND_PATH=boot:///boot/bg.bmp
:+Legacy :+Legacy
::Stivale Test ::Stivale Test
PROTOCOL=stivale PROTOCOL=stivale2
KERNEL_PATH=boot:///boot/test.elf KERNEL_PATH=boot:///boot/test.elf
KERNEL_CMDLINE=Hi! This is an example! 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) ::Stivale Test (KASLR)
PROTOCOL=stivale PROTOCOL=stivale
KASLR=yes
KERNEL_PATH=boot:///boot/test.elf KERNEL_PATH=boot:///boot/test.elf
KERNEL_CMDLINE=Hi! This is an example! 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 :Stivale2 Test
PROTOCOL=stivale2 PROTOCOL=stivale2