diff options
-rw-r--r-- | include/efi.h | 4 | ||||
-rw-r--r-- | lib/efi_loader/efi_memory.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/efi.h b/include/efi.h index 3c9d20f..5f415a9 100644 --- a/include/efi.h +++ b/include/efi.h @@ -168,6 +168,10 @@ enum efi_mem_type { * part of the processor. */ EFI_PAL_CODE, + /* + * Non-volatile memory. + */ + EFI_PERSISTENT_MEMORY_TYPE, EFI_MAX_MEMORY_TYPE, EFI_TABLE_END, /* For efi_build_mem_table() */ diff --git a/lib/efi_loader/efi_memory.c b/lib/efi_loader/efi_memory.c index 46681dc..987cc6d 100644 --- a/lib/efi_loader/efi_memory.c +++ b/lib/efi_loader/efi_memory.c @@ -376,6 +376,10 @@ efi_status_t efi_allocate_pages(int type, int memory_type, efi_status_t r = EFI_SUCCESS; uint64_t addr; + /* Check import parameters */ + if (memory_type >= EFI_PERSISTENT_MEMORY_TYPE && + memory_type <= 0x6FFFFFFF) + return EFI_INVALID_PARAMETER; if (!memory) return EFI_INVALID_PARAMETER; |