SPM: Introduce SPRT C client library

Change-Id: I2f110b4d06d2821d8bdf818ab7523a5c0a6b9ab9
Signed-off-by: Antonio Nino Diaz <antonio.ninodiaz@arm.com>
diff --git a/lib/sprt/aarch64/sprt_client_helpers.S b/lib/sprt/aarch64/sprt_client_helpers.S
new file mode 100644
index 0000000..4606854
--- /dev/null
+++ b/lib/sprt/aarch64/sprt_client_helpers.S
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2018, Arm Limited. All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <asm_macros.S>
+
+	.globl	sprt_client_svc
+
+func sprt_client_svc
+	/*
+	 * Save the address of the svc_args structure on the stack.
+	 *
+	 * Although x0 contains an 8-byte value, we are allocating 16 bytes
+	 * on the stack to respect the 16-byte stack-alignment.
+	 */
+	str	x0, [sp, #-16]!
+
+	/* Load the SVC arguments values into the appropriate registers. */
+	ldp	x6, x7, [x0, #48]
+	ldp	x4, x5, [x0, #32]
+	ldp	x2, x3, [x0, #16]
+	ldp	x0, x1, [x0, #0]
+
+	svc	#0
+
+	/*
+	 * Pop the svc_args structure address from the stack into a caller-saved
+	 * register.
+	 */
+	ldr	x9, [sp], #16
+
+	/*
+	 * The return values are stored in x0-x3, put them in the svc_args
+	 * return structure.
+	 */
+	stp	x0, x1, [x9, #0]
+	stp	x2, x3, [x9, #16]
+	ret
+endfunc sprt_client_svc