diff options
author | Mitchell Horne <mhorne@FreeBSD.org> | 2020-07-06 18:19:42 +0000 |
---|---|---|
committer | Mitchell Horne <mhorne@FreeBSD.org> | 2020-07-06 18:19:42 +0000 |
commit | 2192efc03bc41024a4f81217411e91fea3cd2815 (patch) | |
tree | 872aee6744b0815666d03ac69d53e2401d769874 /stand/efi/loader/copy.c | |
parent | 10aabc8b83b0d8d97ee5e60d013dcfe2e525d7df (diff) | |
download | src-2192efc03bc41024a4f81217411e91fea3cd2815.tar.gz src-2192efc03bc41024a4f81217411e91fea3cd2815.zip |
Notes
Diffstat (limited to 'stand/efi/loader/copy.c')
-rw-r--r-- | stand/efi/loader/copy.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index 6499a44b9bbe..f4887df11e5c 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -227,7 +227,7 @@ efi_copy_init(void) staging_base = staging; staging_end = staging + nr_pages * EFI_PAGE_SIZE; -#if defined(__aarch64__) || defined(__arm__) +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) /* * Round the kernel load address to a 2MiB value. This is needed * because the kernel builds a page table based on where it has @@ -277,7 +277,7 @@ before_staging: return (false); } addr = staging - nr_pages * EFI_PAGE_SIZE; -#if defined(__aarch64__) || defined(__arm__) +#if defined(__aarch64__) || defined(__arm__) || defined(__riscv) /* See efi_copy_init for why this is needed */ addr = rounddown2(addr, 2 * 1024 * 1024); #endif @@ -344,6 +344,11 @@ ssize_t efi_readin(readin_handle_t fd, vm_offset_t dest, const size_t len) { + if (!stage_offset_set) { + stage_offset = (vm_offset_t)staging - dest; + stage_offset_set = 1; + } + if (!efi_check_space(dest + stage_offset + len)) { errno = ENOMEM; return (-1); |