From: Andrew Cooper Date: Tue, 17 Aug 2021 18:10:24 +0000 (+0100) Subject: common: Introduce weak defaults for interfaces used by common code X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=ac7242921e0ec439bc7f86d620f33bdc97e2c8b8;p=people%2Fandrewcoop%2Fxen-test-framework.git common: Introduce weak defaults for interfaces used by common code This avoids each architecture needing to implement stubs for possibly optional functionality. Signed-off-by: Andrew Cooper --- diff --git a/build/files.mk b/build/files.mk index dfa27e4..5c1cc8d 100644 --- a/build/files.mk +++ b/build/files.mk @@ -16,6 +16,7 @@ obj-perarch += $(ROOT)/common/libc/vsnprintf.o obj-perarch += $(ROOT)/common/report.o obj-perarch += $(ROOT)/common/setup.o obj-perarch += $(ROOT)/common/xenbus.o +obj-perarch += $(ROOT)/common/weak-defaults.o obj-perenv += $(ROOT)/arch/x86/decode.o obj-perenv += $(ROOT)/arch/x86/desc.o diff --git a/common/weak-defaults.c b/common/weak-defaults.c new file mode 100644 index 0000000..74cefeb --- /dev/null +++ b/common/weak-defaults.c @@ -0,0 +1,27 @@ +/* + * @file common/weak-defaults.c + * + * Default implementations of functions called by common code, which may need + * arch or environment specific implementations. + */ +#include + +const char __weak environment_description[] = "Unknown"; + +void __weak arch_setup(void) +{ +} + +void __weak test_setup(void) +{ +} + +/* + * Local variables: + * mode: C + * c-file-style: "BSD" + * c-basic-offset: 4 + * tab-width: 4 + * indent-tabs-mode: nil + * End: + */ diff --git a/include/xtf/framework.h b/include/xtf/framework.h index a71bf39..4c6527e 100644 --- a/include/xtf/framework.h +++ b/include/xtf/framework.h @@ -1,8 +1,19 @@ +/** + * @file include/xtf/framework.h + * + * Interfaces used by common code, needing to be implemented by + * arch/environment specific code. Default stubs are provided in + * common/weak-defaults.c + */ #ifndef XTF_FRAMEWORK_H #define XTF_FRAMEWORK_H -/* To be implemented by each arch */ +#include + +/* Set up exception handling, consoles, etc. */ void arch_setup(void); + +/* Set up test-specific configuration. */ void test_setup(void); /* Single line summary of execution environment. */