Files
acrn-hypervisor/hypervisor/boot/include/reloc.h
Jian Jun Chen f904dbffbb hv: multi-arch: refine relocation related code
Move dynamic sections and relocation sections data structures to
elf.h and enclose function relocate with CONFIG_RELOC. The input
parameter struct Elf64_Dyn *dynamic is not used by x86-64 now because
x86-64 can use pc-relative addressing to get the acutaly load address
of _DYNAMIC in the C code.

Tracked-On: #8825
Signed-off-by: Jian Jun Chen <jian.jun.chen@intel.com>
Acked-by: Wang, Yu1 <yu1.wang@intel.com>
2025-10-22 10:15:01 +08:00

35 lines
669 B
C

/*
* Copyright (C) 2018-2022 Intel Corporation.
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef RELOCATE_H
#define RELOCATE_H
#include <elf.h>
#include <asm/boot/ld_sym.h>
uint64_t arch_get_hv_image_delta(void);
static inline uint64_t get_hv_image_delta(void)
{
return arch_get_hv_image_delta();
}
/* get the actual Hypervisor load address (HVA) */
static inline uint64_t get_hv_image_base(void)
{
return (get_hv_image_delta() + CONFIG_HV_RAM_START);
}
static inline uint64_t get_hv_image_size(void)
{
return (uint64_t)(&ld_ram_end - &ld_ram_start);
}
#ifdef CONFIG_RELOC
extern void relocate(struct Elf64_Dyn *dynamic);
#endif
#endif /* RELOCATE_H */