blob: 1180f518e4628cabc13dff1da352074cfc3fd377 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
2 * Copyright (c) 2013-2017, Arm Limited. All rights reserved.
3 *
4 * SPDX-License-Identifier: BSD-3-Clause
5 */
6
7#include <asm_macros.S>
8
9 .globl asm_tftf_smc64
10
11 .section .text, "ax"
12
13
14/* ---------------------------------------------------------------------------
Sandrine Bailleux17795062018-12-13 16:02:41 +010015 * smc_ret_values asm_tftf_smc64(uint32_t fid,
Sandrine Bailleux13d99f92018-11-16 15:36:08 +010016 * u_register_t arg1,
17 * u_register_t arg2,
18 * u_register_t arg3,
19 * u_register_t arg4,
20 * u_register_t arg5,
21 * u_register_t arg6,
22 * u_register_t arg7);
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020023 * ---------------------------------------------------------------------------
24 */
25func asm_tftf_smc64
26 /*
27 * According to the AAPCS64, x8 is the indirect result location
28 * register. It contains the address of the memory block that the caller
29 * has reserved to hold the result, i.e. the smc_ret_values structure
30 * in our case.
31 * x8 might be clobbered across the SMC call so save it on the stack.
32 * Although x8 contains an 8 byte value, we are allocating 16bytes on the stack
33 * to respect 16byte stack-alignment.
34 */
35 str x8, [sp, #-16]!
36
37 /* SMC arguments are already stored in x0-x6 */
38 smc #0
39
40 /* Pop x8 into a caller-saved register */
41 ldr x9, [sp], #16
42
43 /*
44 * Return values are stored in x0-x3, put them in the 'smc_ret_values'
45 * return structure
46 */
47 stp x0, x1, [x9, #0]
48 stp x2, x3, [x9, #16]
49 ret
50endfunc asm_tftf_smc64