From: Andrew Cooper Date: Mon, 10 May 2021 17:03:09 +0000 (+0100) Subject: common: Make a weak default for arch_crash_hard() X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=bf240ea00b3631f8839ccdb3d5a18cb4d4bf3693;p=xtf.git common: Make a weak default for arch_crash_hard() arch_crash_hard() is used from common code, and in the most basic case can just be an infinite loop. Both x86 PV and HVM keep their more specific implementations. Move the declaration from arch/traps.h to framework.h Signed-off-by: Andrew Cooper --- diff --git a/arch/x86/include/arch/traps.h b/arch/x86/include/arch/traps.h index 60fc3a4..3e1d52d 100644 --- a/arch/x86/include/arch/traps.h +++ b/arch/x86/include/arch/traps.h @@ -14,12 +14,6 @@ */ void arch_init_traps(void); -/* - * Arch-specific function to quiesce the domain, in the event that a - * shutdown(crash) hypercall has not succeeded. - */ -void __noreturn arch_crash_hard(void); - /* * Return the correct %ss/%esp from an exception. In 32bit if no stack switch * occurs, an exception frame doesn't contain this information. diff --git a/common/lib.c b/common/lib.c index acf4da1..58f4965 100644 --- a/common/lib.c +++ b/common/lib.c @@ -1,3 +1,4 @@ +#include #include #include #include diff --git a/common/weak-defaults.c b/common/weak-defaults.c index 74cefeb..5aa5468 100644 --- a/common/weak-defaults.c +++ b/common/weak-defaults.c @@ -16,6 +16,14 @@ void __weak test_setup(void) { } +void __weak __noreturn arch_crash_hard(void) +{ + /* panic() has failed. Sit in a tight loop. */ + for ( ;; ) + ; + unreachable(); +} + /* * Local variables: * mode: C diff --git a/include/xtf/framework.h b/include/xtf/framework.h index 4c6527e..1146a6a 100644 --- a/include/xtf/framework.h +++ b/include/xtf/framework.h @@ -16,6 +16,12 @@ void arch_setup(void); /* Set up test-specific configuration. */ void test_setup(void); +/* + * In the case that normal shutdown actions have failed, contain execution as + * best as possible. + */ +void __noreturn arch_crash_hard(void); + /* Single line summary of execution environment. */ extern const char environment_description[];