/* * Define a pair of symbols sharing the same name but one defined in * VHE and the other in nVHE hyp implementations.
*/ #define DECLARE_KVM_HYP_SYM(sym) \
DECLARE_KVM_VHE_SYM(sym); \
DECLARE_KVM_NVHE_SYM(sym)
/* * Compute pointer to a symbol defined in nVHE percpu region. * Returns NULL if percpu memory has not been allocated yet.
*/ #define this_cpu_ptr_nvhe_sym(sym) per_cpu_ptr_nvhe_sym(sym, smp_processor_id()) #define per_cpu_ptr_nvhe_sym(sym, cpu) \
({ \ unsignedlong base, off; \
base = kvm_nvhe_sym(kvm_arm_hyp_percpu_base)[cpu]; \
off = (unsignedlong)&CHOOSE_NVHE_SYM(sym) - \
(unsignedlong)&CHOOSE_NVHE_SYM(__per_cpu_start); \
base ? (typeof(CHOOSE_NVHE_SYM(sym))*)(base + off) : NULL; \
})
/* The VHE hypervisor shouldn't even try to access nVHE symbols */ externvoid *__vhe_undefined_symbol; #define CHOOSE_NVHE_SYM(sym) __vhe_undefined_symbol #define this_cpu_ptr_hyp_sym(sym) (&__vhe_undefined_symbol) #define per_cpu_ptr_hyp_sym(sym, cpu) (&__vhe_undefined_symbol)
#else
/* * BIG FAT WARNINGS: * * - Don't be tempted to change the following is_kernel_in_hyp_mode() * to has_vhe(). has_vhe() is implemented as a *final* capability, * while this is used early at boot time, when the capabilities are * not final yet.... * * - Don't let the nVHE hypervisor have access to this, as it will * pick the *wrong* symbol (yes, it runs at EL2...).
*/ #define CHOOSE_HYP_SYM(sym) (is_kernel_in_hyp_mode() \
? CHOOSE_VHE_SYM(sym) \
: CHOOSE_NVHE_SYM(sym))
/* * Used by the host in EL1 to dump the nVHE hypervisor backtrace on * hyp_panic() in non-protected mode. * * @stack_base: hyp VA of the hyp_stack base. * @overflow_stack_base: hyp VA of the hyp_overflow_stack base. * @fp: hyp FP where the backtrace begins. * @pc: hyp PC where the backtrace begins.
*/ struct kvm_nvhe_stacktrace_info { unsignedlong stack_base; unsignedlong overflow_stack_base; unsignedlong fp; unsignedlong pc;
};
/* Translate a kernel address @ptr into its equivalent linear mapping */ #define kvm_ksym_ref(ptr) \
({ \ void *val = (ptr); \ if (!is_kernel_in_hyp_mode()) \
val = lm_alias((ptr)); \
val; \
}) #define kvm_ksym_ref_nvhe(sym) kvm_ksym_ref(kvm_nvhe_sym(sym))
/* * KVM extable for unexpected exceptions. * Create a struct kvm_exception_table_entry output to a section that can be * mapped by EL2. The table is not sorted. * * The caller must ensure: * x18 has the hypervisor value to allow any Shadow-Call-Stack instrumented * code to write to it, and that SPSR_EL2 and ELR_EL2 are restored by the fixup.
*/
.macro _kvm_extable, from, to
.pushsection __kvm_ex_table, "a"
.align 3
.long (\from - .), (\to - .)
.popsection
.endm
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.20Bemerkung:
(vorverarbeitet am 2026-06-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.