From: Oleksii Kurochko Date: Thu, 10 Oct 2024 08:55:24 +0000 (+0200) Subject: xen/riscv: register Xen's load address as a boot module X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=2b49ef4503e2c549c166f439cf0dd331d9a8874c;p=people%2Faperard%2Fxen-unstable.git xen/riscv: register Xen's load address as a boot module Avoid using BOOTMOD_XEN region for other purposes or boot modules which could result in memory corruption or undefined behaviour. Signed-off-by: Oleksii Kurochko Acked-by: Jan Beulich --- diff --git a/xen/arch/riscv/setup.c b/xen/arch/riscv/setup.c index 6d156c3a40..f531ca38ee 100644 --- a/xen/arch/riscv/setup.c +++ b/xen/arch/riscv/setup.c @@ -1,6 +1,7 @@ /* SPDX-License-Identifier: GPL-2.0-only */ #include +#include #include #include #include @@ -44,6 +45,11 @@ void __init noreturn start_xen(unsigned long bootcpu_id, "Please check your bootloader.\n", dtb_addr, BOOT_FDT_VIRT_SIZE); + /* Register Xen's load address as a boot module. */ + if ( !add_boot_module(BOOTMOD_XEN, virt_to_maddr(_start), + _end - _start, false) ) + panic("Failed to add BOOTMOD_XEN\n"); + printk("All set up\n"); machine_halt();