Skip to content

Commit

Permalink
Merge pull request #439 from ziyao233/trunk
Browse files Browse the repository at this point in the history
protos/linux_risc: add LoongArch support
  • Loading branch information
qookei authored Dec 22, 2024
2 parents f168f1b + 240ecc2 commit 5a3699e
Show file tree
Hide file tree
Showing 4 changed files with 300 additions and 150 deletions.
9 changes: 4 additions & 5 deletions common/lib/misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ EFI_BOOT_SERVICES *gBS;
EFI_RUNTIME_SERVICES *gRT;
EFI_HANDLE efi_image_handle;
EFI_MEMORY_DESCRIPTOR *efi_mmap = NULL;
UINTN efi_mmap_size = 0, efi_desc_size = 0;
UINTN efi_mmap_size = 0, efi_desc_size = 0, efi_mmap_key = 0;
UINT32 efi_desc_ver = 0;
#endif

Expand Down Expand Up @@ -205,9 +205,8 @@ bool efi_exit_boot_services(void) {

EFI_MEMORY_DESCRIPTOR tmp_mmap[1];
efi_mmap_size = sizeof(tmp_mmap);
UINTN mmap_key = 0;

gBS->GetMemoryMap(&efi_mmap_size, tmp_mmap, &mmap_key, &efi_desc_size, &efi_desc_ver);
gBS->GetMemoryMap(&efi_mmap_size, tmp_mmap, &efi_mmap_key, &efi_desc_size, &efi_desc_ver);

efi_mmap_size += 4096;

Expand All @@ -232,13 +231,13 @@ bool efi_exit_boot_services(void) {
size_t retries = 0;

retry:
status = gBS->GetMemoryMap(&efi_mmap_size, efi_mmap, &mmap_key, &efi_desc_size, &efi_desc_ver);
status = gBS->GetMemoryMap(&efi_mmap_size, efi_mmap, &efi_mmap_key, &efi_desc_size, &efi_desc_ver);
if (retries == 0 && status) {
goto fail;
}

// Be gone, UEFI!
status = gBS->ExitBootServices(efi_image_handle, mmap_key);
status = gBS->ExitBootServices(efi_image_handle, efi_mmap_key);
if (status) {
if (retries == 128) {
goto fail;
Expand Down
2 changes: 1 addition & 1 deletion common/lib/misc.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ extern EFI_BOOT_SERVICES *gBS;
extern EFI_RUNTIME_SERVICES *gRT;
extern EFI_HANDLE efi_image_handle;
extern EFI_MEMORY_DESCRIPTOR *efi_mmap;
extern UINTN efi_mmap_size, efi_desc_size;
extern UINTN efi_mmap_size, efi_desc_size, efi_mmap_key;
extern UINT32 efi_desc_ver;

extern bool efi_boot_services_exited;
Expand Down
5 changes: 0 additions & 5 deletions common/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -1190,12 +1190,7 @@ noreturn void boot(char *config) {
if (!strcmp(proto, "limine")) {
limine_load(config, cmdline);
} else if (!strcmp(proto, "linux")) {
#if defined (__loongarch64)
quiet = false;
print("TODO: Linux is not available on LoongArch64.\n\n");
#else
linux_load(config, cmdline);
#endif
} else if (!strcmp(proto, "multiboot1") || !strcmp(proto, "multiboot")) {
#if defined (__x86_64__) || defined (__i386__)
multiboot1_load(config, cmdline);
Expand Down
Loading

0 comments on commit 5a3699e

Please sign in to comment.