misc: Misc bug fixes

This commit is contained in:
mintsuki 2021-05-07 00:27:49 +02:00
parent 8a904b3669
commit 1a83dfcf78
3 changed files with 4 additions and 6 deletions

View File

@ -26,6 +26,7 @@ void stage3_common(void);
EFI_STATUS EFIAPI efi_main(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
// Invalid return address of 0 to end stacktraces here
asm volatile (
"push 0\n\t"
"push 0\n\t"
"xor eax, eax\n\t"
"jmp uefi_entry\n\t"
@ -73,9 +74,6 @@ void uefi_entry(EFI_HANDLE ImageHandle, EFI_SYSTEM_TABLE *SystemTable) {
if (boot_volume != NULL)
stage3_common();
if (loaded_image->ParentHandle == 0)
panic("Can't determine boot disk");
current_handle = loaded_image->ParentHandle;
}
}

View File

@ -115,7 +115,7 @@ void chainload(char *config) {
if (!uri_open(image, image_path))
panic("chainload: Could not open image");
void *ptr = freadall(image, MEMMAP_RESERVED);
void *ptr = freadall(image, MEMMAP_EFI_LOADER);
term_deinit();

View File

@ -542,6 +542,8 @@ void linux_load(char *config, char *cmdline) {
boot_params->efi_info.efi_memdesc_size = efi_desc_size;
boot_params->efi_info.efi_memdesc_version = efi_desc_ver;
pmm_release_uefi_mem();
efi_exit_boot_services();
#endif
@ -563,8 +565,6 @@ void linux_load(char *config, char *cmdline) {
switch (e820_table[i].type) {
case MEMMAP_BOOTLOADER_RECLAIMABLE:
case MEMMAP_EFI_RECLAIMABLE:
case MEMMAP_EFI_LOADER:
e820_table[i].type = MEMMAP_USABLE;
break;
}