refactor: cactus to handle expect exception

In the test 'rl_memory_cannot_be_accessed_in_s', tftf
shares memory to the SP that it changed to realm PAS.

The access from the SP should result in an exception.
Cactus receives an indication it should expect an
exception on memory access via the arguments of the
'cactus_mem_send_cmd' request. This is used to avoid
the reads to check memory, which could return in an error
response, which would make the test falsely fail.

Signed-off-by: J-Alves <joao.alves@arm.com>
Change-Id: Ie220d4bab04c052a73e8b04c8667c9973b95a9e0
diff --git a/include/runtime_services/cactus_test_cmds.h b/include/runtime_services/cactus_test_cmds.h
index 25a5a6a..3938c2f 100644
--- a/include/runtime_services/cactus_test_cmds.h
+++ b/include/runtime_services/cactus_test_cmds.h
@@ -201,10 +201,13 @@
 static inline struct ffa_value cactus_mem_send_cmd(
 	ffa_id_t source, ffa_id_t dest, uint32_t mem_func,
 	ffa_memory_handle_t handle, ffa_memory_region_flags_t retrieve_flags,
-	uint16_t word_to_write)
+	uint16_t word_to_write, bool expect_exception)
 {
+	uint64_t _expect_exception = expect_exception ? (1ULL << 32) : 0;
+	uint64_t packed = (uint64_t)word_to_write | _expect_exception;
+
 	return cactus_send_cmd(source, dest, CACTUS_MEM_SEND_CMD, mem_func,
-			       handle, retrieve_flags, word_to_write);
+			       handle, retrieve_flags, packed);
 }
 
 static inline ffa_memory_handle_t cactus_mem_send_get_handle(
@@ -221,7 +224,12 @@
 
 static inline uint16_t cactus_mem_send_words_to_write(struct ffa_value ret)
 {
-	return (uint16_t)ret.arg7;
+	return (uint16_t)ret.arg7 & 0xFFFFU;
+}
+
+static inline bool cactus_mem_send_expect_exception(struct ffa_value ret)
+{
+	return (bool)(ret.arg7 >> 32);
 }
 
 /**