Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uefi boot #2

Merged
merged 6 commits into from
Dec 14, 2023
Merged

Uefi boot #2

merged 6 commits into from
Dec 14, 2023

Conversation

Amjad50
Copy link
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