diff options
author | Maxim Sobolev <sobomax@FreeBSD.org> | 2020-11-25 23:19:01 +0000 |
---|---|---|
committer | Maxim Sobolev <sobomax@FreeBSD.org> | 2020-11-25 23:19:01 +0000 |
commit | fd2ef8ef5a054d9f26b6b36ea56a5414c7683e39 (patch) | |
tree | 5841a3c40ef762c7c24d1f8259bf64abfb3b035b /stand | |
parent | d1e0552937e18bef661fb9ace710bcaa1b5d5a80 (diff) | |
download | src-fd2ef8ef5a054d9f26b6b36ea56a5414c7683e39.tar.gz src-fd2ef8ef5a054d9f26b6b36ea56a5414c7683e39.zip |
Unobfuscate "KERNLOAD" parameter on amd64. This change lines-up amd64 with the
i386 and the rest of supported architectures by defining KERNLOAD in the
vmparam.h and getting rid of magic constant in the linker script, which albeit
documented via comment but isn't programmatically accessible at a compile time.
Use KERNLOAD to eliminate another (matching) magic constant 100 lines down
inside unremarkable TU "copy.c" 3 levels deep in the EFI loader tree.
Reviewed by: markj
Approved by: markj
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D27355
Notes
Notes:
svn path=/head/; revision=368041
Diffstat (limited to 'stand')
-rw-r--r-- | stand/efi/loader/copy.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/stand/efi/loader/copy.c b/stand/efi/loader/copy.c index 1185c94740d6..17a4c57f8656 100644 --- a/stand/efi/loader/copy.c +++ b/stand/efi/loader/copy.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #if defined(__i386__) || defined(__amd64__) #include <machine/cpufunc.h> #include <machine/specialreg.h> +#include <machine/vmparam.h> /* * The code is excerpted from sys/x86/x86/identcpu.c: identify_cpu(), @@ -89,8 +90,6 @@ running_on_hyperv(void) return (1); } -#define KERNEL_PHYSICAL_BASE (2*1024*1024) - static void efi_verify_staging_size(unsigned long *nr_pages) { @@ -134,12 +133,11 @@ efi_verify_staging_size(unsigned long *nr_pages) start = p->PhysicalStart; end = start + p->NumberOfPages * EFI_PAGE_SIZE; - if (KERNEL_PHYSICAL_BASE < start || - KERNEL_PHYSICAL_BASE >= end) + if (KERNLOAD < start || KERNLOAD >= end) continue; available_pages = p->NumberOfPages - - ((KERNEL_PHYSICAL_BASE - start) >> EFI_PAGE_SHIFT); + ((KERNLOAD - start) >> EFI_PAGE_SHIFT); break; } |