Remove grub_efi_allocate_pages.
grub_efi_allocate_pages Essentially does 2 unrelated things: * Allocate at fixed address. * Allocate at any address. To switch between 2 different functions it uses address == 0 as magic value which is wrong as 0 is a perfectly valid fixed adress to allocate at.
This commit is contained in:
parent
22619f1593
commit
6825a1d3f1
8 changed files with 30 additions and 34 deletions
|
@ -50,7 +50,7 @@ grub_fdt_load (grub_size_t additional_size)
|
|||
size += additional_size;
|
||||
|
||||
grub_dprintf ("linux", "allocating %ld bytes for fdt\n", size);
|
||||
fdt = grub_efi_allocate_pages (0, GRUB_EFI_BYTES_TO_PAGES (size));
|
||||
fdt = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (size));
|
||||
if (!fdt)
|
||||
return NULL;
|
||||
|
||||
|
|
|
@ -150,8 +150,7 @@ grub_arm64_uefi_boot_image (grub_addr_t addr, grub_size_t size, char *args)
|
|||
loaded_image->load_options_size = len =
|
||||
(grub_strlen (args) + 1) * sizeof (grub_efi_char16_t);
|
||||
loaded_image->load_options =
|
||||
grub_efi_allocate_pages (0,
|
||||
GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
|
||||
grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (loaded_image->load_options_size));
|
||||
if (!loaded_image->load_options)
|
||||
return grub_errno;
|
||||
|
||||
|
@ -225,7 +224,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_dprintf ("linux", "Loading initrd\n");
|
||||
|
||||
initrd_pages = (GRUB_EFI_BYTES_TO_PAGES (initrd_size));
|
||||
initrd_mem = grub_efi_allocate_pages (0, initrd_pages);
|
||||
initrd_mem = grub_efi_allocate_any_pages (initrd_pages);
|
||||
if (!initrd_mem)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
|
@ -279,7 +278,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_loader_unset();
|
||||
|
||||
grub_dprintf ("linux", "kernel file size: %lld\n", (long long) kernel_size);
|
||||
kernel_addr = grub_efi_allocate_pages (0, GRUB_EFI_BYTES_TO_PAGES (kernel_size));
|
||||
kernel_addr = grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES (kernel_size));
|
||||
grub_dprintf ("linux", "kernel numpages: %lld\n",
|
||||
(long long) GRUB_EFI_BYTES_TO_PAGES (kernel_size));
|
||||
if (!kernel_addr)
|
||||
|
|
|
@ -324,10 +324,9 @@ xen_boot_binary_load (struct xen_boot_binary *binary, grub_file_t file,
|
|||
grub_dprintf ("xen_loader", "Xen_boot file size: 0x%lx\n", binary->size);
|
||||
|
||||
binary->start
|
||||
= (grub_addr_t) grub_efi_allocate_pages (0,
|
||||
GRUB_EFI_BYTES_TO_PAGES
|
||||
(binary->size +
|
||||
binary->align));
|
||||
= (grub_addr_t) grub_efi_allocate_any_pages (GRUB_EFI_BYTES_TO_PAGES
|
||||
(binary->size +
|
||||
binary->align));
|
||||
if (!binary->start)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("out of memory"));
|
||||
|
|
|
@ -252,7 +252,7 @@ allocate_pages (grub_uint64_t align, grub_uint64_t size_pages,
|
|||
aligned_start += align;
|
||||
if (aligned_start + size > end)
|
||||
continue;
|
||||
mem = grub_efi_allocate_pages (aligned_start, size_pages);
|
||||
mem = grub_efi_allocate_fixed (aligned_start, size_pages);
|
||||
if (! mem)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate memory");
|
||||
|
@ -326,7 +326,7 @@ grub_linux_boot (void)
|
|||
mmap_size = find_mmap_size ();
|
||||
if (! mmap_size)
|
||||
return grub_errno;
|
||||
mmap_buf = grub_efi_allocate_pages (0, page_align (mmap_size) >> 12);
|
||||
mmap_buf = grub_efi_allocate_any_pages (page_align (mmap_size) >> 12);
|
||||
if (! mmap_buf)
|
||||
return grub_error (GRUB_ERR_IO, "cannot allocate memory map");
|
||||
err = grub_efi_finish_boot_services (&mmap_size, mmap_buf, &map_key,
|
||||
|
@ -422,7 +422,7 @@ grub_load_elf64 (grub_file_t file, void *buffer, const char *filename)
|
|||
relocate = grub_env_get ("linux_relocate");
|
||||
if (!relocate || grub_strcmp (relocate, "force") != 0)
|
||||
{
|
||||
kernel_mem = grub_efi_allocate_pages (low_addr, kernel_pages);
|
||||
kernel_mem = grub_efi_allocate_fixed (low_addr, kernel_pages);
|
||||
reloc_offset = 0;
|
||||
}
|
||||
/* Try to relocate. */
|
||||
|
@ -524,7 +524,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
len += grub_strlen (argv[i]) + 1;
|
||||
len += sizeof (struct ia64_boot_param) + 512; /* Room for extensions. */
|
||||
boot_param_pages = page_align (len) >> 12;
|
||||
boot_param = grub_efi_allocate_pages (0, boot_param_pages);
|
||||
boot_param = grub_efi_allocate_any_pages (boot_param_pages);
|
||||
if (boot_param == 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
|
@ -589,7 +589,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_dprintf ("linux", "Loading initrd\n");
|
||||
|
||||
initrd_pages = (page_align (initrd_size) >> 12);
|
||||
initrd_mem = grub_efi_allocate_pages (0, initrd_pages);
|
||||
initrd_mem = grub_efi_allocate_any_pages (initrd_pages);
|
||||
if (! initrd_mem)
|
||||
{
|
||||
grub_error (GRUB_ERR_OUT_OF_MEMORY, "cannot allocate pages");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue