Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 1 | /* |
Olivier Deprez | 3e1a295 | 2020-03-12 15:44:17 +0100 | [diff] [blame^] | 2 | * Copyright (c) 2013-2020, Arm Limited. All rights reserved. |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: BSD-3-Clause |
| 5 | */ |
| 6 | |
| 7 | #include <asm_macros.S> |
| 8 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 9 | .section .text, "ax" |
| 10 | |
Olivier Deprez | 3e1a295 | 2020-03-12 15:44:17 +0100 | [diff] [blame^] | 11 | .macro smccc_conduit _conduit |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 12 | |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 13 | /* |
| 14 | * According to the AAPCS64, x8 is the indirect result location |
| 15 | * register. It contains the address of the memory block that the caller |
| 16 | * has reserved to hold the result, i.e. the smc_ret_values structure |
| 17 | * in our case. |
| 18 | * x8 might be clobbered across the SMC call so save it on the stack. |
| 19 | * Although x8 contains an 8 byte value, we are allocating 16bytes on the stack |
| 20 | * to respect 16byte stack-alignment. |
| 21 | */ |
| 22 | str x8, [sp, #-16]! |
| 23 | |
Olivier Deprez | 3e1a295 | 2020-03-12 15:44:17 +0100 | [diff] [blame^] | 24 | /* "Conduit" arguments are already stored in x0-x7 */ |
| 25 | \_conduit #0 |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 26 | |
| 27 | /* Pop x8 into a caller-saved register */ |
| 28 | ldr x9, [sp], #16 |
| 29 | |
| 30 | /* |
Madhukar Pappireddy | c783c0b | 2019-11-14 23:52:37 -0600 | [diff] [blame] | 31 | * Return values are stored in x0-x7, put them in the 'smc_ret_values' |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 32 | * return structure |
| 33 | */ |
| 34 | stp x0, x1, [x9, #0] |
| 35 | stp x2, x3, [x9, #16] |
Madhukar Pappireddy | c783c0b | 2019-11-14 23:52:37 -0600 | [diff] [blame] | 36 | stp x4, x5, [x9, #32] |
| 37 | stp x6, x7, [x9, #48] |
Olivier Deprez | 3e1a295 | 2020-03-12 15:44:17 +0100 | [diff] [blame^] | 38 | |
| 39 | .endm |
| 40 | |
| 41 | /* --------------------------------------------------------------------------- |
| 42 | * smc_ret_values asm_tftf_smc64(uint32_t fid, |
| 43 | * u_register_t arg1, |
| 44 | * u_register_t arg2, |
| 45 | * u_register_t arg3, |
| 46 | * u_register_t arg4, |
| 47 | * u_register_t arg5, |
| 48 | * u_register_t arg6, |
| 49 | * u_register_t arg7); |
| 50 | * --------------------------------------------------------------------------- |
| 51 | */ |
| 52 | .globl asm_tftf_smc64 |
| 53 | |
| 54 | func asm_tftf_smc64 |
| 55 | smccc_conduit smc |
Sandrine Bailleux | 3cd87d7 | 2018-10-09 11:12:55 +0200 | [diff] [blame] | 56 | ret |
| 57 | endfunc asm_tftf_smc64 |
Olivier Deprez | 3e1a295 | 2020-03-12 15:44:17 +0100 | [diff] [blame^] | 58 | |
| 59 | /* --------------------------------------------------------------------------- |
| 60 | * hvc_ret_values asm_tftf_hvcc64(uint32_t fid, |
| 61 | * u_register_t arg1, |
| 62 | * u_register_t arg2, |
| 63 | * u_register_t arg3, |
| 64 | * u_register_t arg4, |
| 65 | * u_register_t arg5, |
| 66 | * u_register_t arg6, |
| 67 | * u_register_t arg7); |
| 68 | * --------------------------------------------------------------------------- |
| 69 | */ |
| 70 | .globl asm_tftf_hvc64 |
| 71 | |
| 72 | func asm_tftf_hvc64 |
| 73 | smccc_conduit hvc |
| 74 | ret |
| 75 | endfunc asm_tftf_hvc64 |