feat(tftf): add tests to access invalid memory
Add test framework to access memory addresses which are not accessible
to tftf. The test only introduced for "aarch64" as there is no sync
exception handler for "aarch32".
The test framework will catch the error and do graceful exit.
For now only test introduced is to access memory owned by EL3, which can
be easily extended to add more tests to access realm/secure(in RME
enabled systems).
Platform needs to provide test address, if not then test will
be skipped.
Test steps:
1. Register a custom sync exception handler(try & catch)
2. Access a protected memory, should give data abort.
3. Exception handler should check if data abort then continue.
4. Unregister custom exception handler.
Signed-off-by: Manish Pandey <manish.pandey2@arm.com>
Change-Id: Ib8b199acb9b96548c889539610ff1b58777d3d1d
diff --git a/include/common/test_helpers.h b/include/common/test_helpers.h
index 05ecbb8..8e142e3 100644
--- a/include/common/test_helpers.h
+++ b/include/common/test_helpers.h
@@ -281,6 +281,15 @@
} \
} while (false)
+#define SKIP_TEST_IF_INVALID_ADDRESS(address) \
+ do { \
+ if (address == U(0xFFFFFFFF)) { \
+ tftf_testcase_printf("Platform has not provided " \
+ "valid address to access EL3\n"); \
+ return TEST_RESULT_SKIPPED; \
+ } \
+ } while (false)
+
/* Helper macro to verify if system suspend API is supported */
#define is_psci_sys_susp_supported() \
(tftf_get_psci_feature_info(SMC_PSCI_SYSTEM_SUSPEND) \