misc: Misc bug fixes
diff --git a/stage23/entry.s3.c b/stage23/entry.s3.c
index 2f3889da..4b39c0d3 100644
--- a/stage23/entry.s3.c
+++ b/stage23/entry.s3.c
@@ -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;
}
}
diff --git a/stage23/protos/chainload.c b/stage23/protos/chainload.c
index 5744ef87..6c69073a 100644
--- a/stage23/protos/chainload.c
+++ b/stage23/protos/chainload.c
@@ -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();
diff --git a/stage23/protos/linux.c b/stage23/protos/linux.c
index 983bd6ec..190c1891 100644
--- a/stage23/protos/linux.c
+++ b/stage23/protos/linux.c
@@ -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;
}
