Skip to content

Uefi boot#2

Merged
Amjad50 merged 6 commits intomasterfrom
uefi_boot
Dec 14, 2023
Merged

Uefi boot#2
Amjad50 merged 6 commits intomasterfrom
uefi_boot

Conversation

@Amjad50
Copy link
Copy Markdown
Owner

@Amjad50 Amjad50 commented Dec 14, 2023

Fixed #1

Added:

  • Dynamic physical page allocator (we don't need 128MB now, we can boot even with 5MB only in BIOS and 80MB~ in UEFI for some reason)
    • For now, it doesn't exceed 128MB, but it would be very easy to add that support, its just that I'm planning to have the first 128MB virtually mapped, and then we can use a linked list structure or heap allocated structure that store metadata about the rest of the memory.
  • Improved the starter virtual address pages in boot.S, we shouldn't just use address 0x1000 and such, so allocated a specific space in the ELF file.
  • switched to multiboot2, it has more features and support EFI easily.

…s memory

This will help us be more dynamic, and we don't have to be strict on the rules of at least 128MB.

Also having the bios memory not mapped, we can use that space for something else.
For now its not being used, but maybe in the future.

This will bring us one step closter to using UEFI
Just using 0x1000 arbitrarily is dangerous as it could be used by
something else. And looks like its used for Multiboot2 info in EFI mode.

So its better to have a specific space in memory allocated for us only.
Switching to multiboot2 gives us a lot of benefits, such as:
- able to boot UEFI devices.
- better way to get RSDP table directly from boot instead of finding it
  in memory, which doesn't work in UEFI.
- More configuration control (more options/tags we can specify to the
  bootloader)
…ey are reserved

So, looks like this won't trigger an exception (#UD) unless the `CR4.DE` bit is set, which looks like its set by default in BIOS boot, but UEFI (at least the firmware I use), makes it not set which triggered an issue.
@Amjad50 Amjad50 merged commit 84d974c into master Dec 14, 2023
@Amjad50 Amjad50 deleted the uefi_boot branch December 14, 2023 01:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Boot in UEFI

1 participant