blob: c3044a42faa5c55a41a62279d22d68e4b5211d30 [file] [log] [blame]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02001/*
Madhukar Pappireddyc783c0b2019-11-14 23:52:37 -06002 * Copyright (c) 2013-2019, Arm Limited. All rights reserved.
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +02003 *
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
Madhukar Pappireddyc783c0b2019-11-14 23:52:37 -060037 /* SMC arguments are already stored in x0-x7 */
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020038 smc #0
39
40 /* Pop x8 into a caller-saved register */
41 ldr x9, [sp], #16
42
43 /*
Madhukar Pappireddyc783c0b2019-11-14 23:52:37 -060044 * Return values are stored in x0-x7, put them in the 'smc_ret_values'
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020045 * return structure
46 */
47 stp x0, x1, [x9, #0]
48 stp x2, x3, [x9, #16]
Madhukar Pappireddyc783c0b2019-11-14 23:52:37 -060049 stp x4, x5, [x9, #32]
50 stp x6, x7, [x9, #48]
Sandrine Bailleux3cd87d72018-10-09 11:12:55 +020051 ret
52endfunc asm_tftf_smc64