Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame^] | 1 | /* |
| 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 | /* --------------------------------------------------------------------------- |
| 15 | * smc_ret_values asm_tftf_smc64(uint64_t arg0, |
| 16 | * uint64_t arg1, |
| 17 | * uint64_t arg2, |
| 18 | * uint64_t arg3, |
| 19 | * uint64_t arg4, |
| 20 | * uint64_t arg5, |
| 21 | * uint64_t arg6, |
| 22 | * uint64_t arg7); |
| 23 | * --------------------------------------------------------------------------- |
| 24 | */ |
| 25 | func 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 |
| 50 | endfunc asm_tftf_smc64 |