SPM: Restructure memory operation functions

SPM calls spm_memcpy/spm_memset, and SP just calls memset, memcpy,
memmove and memcmp. SPM has its own header files for
spm_memcpy/spm_memset prototypes, while SP relies on toolchain headers
string.h for prototypes.
As -fno-builtin is applied, our memcpy would replace the same function
in toolchain library.

Change-Id: Iab240c96e06d55144daa0125b2d17574b648f9e1
Signed-off-by: Summer Qin <summer.qin@arm.com>
diff --git a/secure_fw/spm/cmsis_psa/spm_ipc.c b/secure_fw/spm/cmsis_psa/spm_ipc.c
index dcb2980..6537c88 100644
--- a/secure_fw/spm/cmsis_psa/spm_ipc.c
+++ b/secure_fw/spm/cmsis_psa/spm_ipc.c
@@ -562,7 +562,7 @@
     TFM_CORE_ASSERT(in_len + out_len <= PSA_MAX_IOVEC);
 
     /* Clear message buffer before using it */
-    tfm_core_util_memset(msg, 0, sizeof(struct tfm_msg_body_t));
+    spm_memset(msg, 0, sizeof(struct tfm_msg_body_t));
 
     tfm_event_init(&msg->ack_evnt);
     msg->magic = TFM_MSG_MAGIC;
@@ -892,9 +892,7 @@
         tfm_core_panic();
     }
 
-    tfm_core_util_memcpy(&ctrl_param,
-                         (const void *)args[1],
-                         sizeof(ctrl_param));
+    spm_memcpy(&ctrl_param, (const void *)args[1], sizeof(ctrl_param));
 
     type = ctrl_param.type;
     in_num = ctrl_param.in_len;
@@ -1053,7 +1051,7 @@
                            struct tfm_conn_handle_t,
                            internal_msg))->status = TFM_HANDLE_STATUS_ACTIVE;
 
-    tfm_core_util_memcpy(msg, &tmp_msg->msg, sizeof(psa_msg_t));
+    spm_memcpy(msg, &tmp_msg->msg, sizeof(psa_msg_t));
 
     /*
      * There may be multiple messages for this RoT Service signal, do not clear
@@ -1150,7 +1148,7 @@
     bytes = num_bytes > msg->msg.in_size[invec_idx] ?
                         msg->msg.in_size[invec_idx] : num_bytes;
 
-    tfm_core_util_memcpy(buffer, msg->invec[invec_idx].base, bytes);
+    spm_memcpy(buffer, msg->invec[invec_idx].base, bytes);
 
     /* There maybe some remaining data */
     msg->invec[invec_idx].base = (char *)msg->invec[invec_idx].base + bytes;
@@ -1274,8 +1272,8 @@
         tfm_core_panic();
     }
 
-    tfm_core_util_memcpy((char *)msg->outvec[outvec_idx].base +
-                         msg->outvec[outvec_idx].len, buffer, num_bytes);
+    spm_memcpy((char *)msg->outvec[outvec_idx].base +
+               msg->outvec[outvec_idx].len, buffer, num_bytes);
 
     /* Update the write number */
     msg->outvec[outvec_idx].len += num_bytes;