diff options
author | Wang Yao <wangyao@lemote.com> | 2023-12-06 01:24:27 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2023-12-11 11:18:26 +0100 |
commit | 271f2a4a9576b87ed1f8584909d6d270039e52ea (patch) | |
tree | 6b39c0351d1ed435de6ec5fba4a048bb738d7997 /drivers/firmware/efi/libstub/loongarch-stub.c | |
parent | efi/unaccepted: Fix off-by-one when checking for overlapping ranges (diff) | |
download | linux-271f2a4a9576b87ed1f8584909d6d270039e52ea.tar.xz linux-271f2a4a9576b87ed1f8584909d6d270039e52ea.zip |
efi/loongarch: Use load address to calculate kernel entry address
The efi_relocate_kernel() may load the PIE kernel to anywhere, the
loaded address may not be equal to link address or
EFI_KIMG_PREFERRED_ADDRESS.
Acked-by: Huacai Chen <chenhuacai@loongson.cn>
Signed-off-by: Wang Yao <wangyao@lemote.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/loongarch-stub.c')
-rw-r--r-- | drivers/firmware/efi/libstub/loongarch-stub.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/firmware/efi/libstub/loongarch-stub.c b/drivers/firmware/efi/libstub/loongarch-stub.c index 72c71ae201f0..d6ec5d4b8dbe 100644 --- a/drivers/firmware/efi/libstub/loongarch-stub.c +++ b/drivers/firmware/efi/libstub/loongarch-stub.c @@ -35,9 +35,9 @@ efi_status_t handle_kernel_image(unsigned long *image_addr, return status; } -unsigned long kernel_entry_address(void) +unsigned long kernel_entry_address(unsigned long kernel_addr) { unsigned long base = (unsigned long)&kernel_offset - kernel_offset; - return (unsigned long)&kernel_entry - base + VMLINUX_LOAD_ADDRESS; + return (unsigned long)&kernel_entry - base + kernel_addr; } |