fix(realm_test): host_call structure should be per rec
There is a chance of corruption in host_call data
structure leading to crash.
The structure needs to be allocated per rec.
Change-Id: I6483168df4637392f80fcb83eae279317d4cafa7
Signed-off-by: Shruti Gupta <shruti.gupta@arm.com>
diff --git a/realm/realm_rsi.c b/realm/realm_rsi.c
index d82aa6f..ba60ba8 100644
--- a/realm/realm_rsi.c
+++ b/realm/realm_rsi.c
@@ -11,8 +11,6 @@
#include <realm_rsi.h>
#include <smccc.h>
-static struct rsi_host_call host_cal __aligned(sizeof(struct rsi_host_call));
-
/* This function return RSI_ABI_VERSION */
u_register_t rsi_get_version(u_register_t req_ver)
{
@@ -32,6 +30,7 @@
u_register_t rsi_get_ns_buffer(void)
{
smc_ret_values res = {};
+ struct rsi_host_call host_cal __aligned(sizeof(struct rsi_host_call));
host_cal.imm = HOST_CALL_GET_SHARED_BUFF_CMD;
res = tftf_smc(&(smc_args) {RSI_HOST_CALL, (u_register_t)&host_cal,
@@ -45,6 +44,8 @@
/* This function call Host and request to exit Realm with proper exit code */
void rsi_exit_to_host(enum host_call_cmd exit_code)
{
+ struct rsi_host_call host_cal __aligned(sizeof(struct rsi_host_call));
+
host_cal.imm = exit_code;
host_cal.gprs[0] = read_mpidr_el1() & MPID_MASK;
tftf_smc(&(smc_args) {RSI_HOST_CALL, (u_register_t)&host_cal,