]>
Commit | Line | Data |
---|---|---|
25402f5d | 1 | //\r |
b4e53e38 | 2 | // Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r |
25402f5d | 3 | //\r |
4059386c | 4 | // SPDX-License-Identifier: BSD-2-Clause-Patent\r |
25402f5d HL |
5 | //\r |
6 | //\r | |
7 | \r | |
86a4d91b | 8 | #include <AsmMacroIoLibV8.h>\r |
25402f5d | 9 | \r |
86a4d91b | 10 | ASM_FUNC(ArmCallSmc)\r |
fb7ea611 OM |
11 | // Push x0 on the stack - The stack must always be quad-word aligned\r |
12 | str x0, [sp, #-16]!\r | |
25402f5d | 13 | \r |
b4e53e38 OM |
14 | // Load the SMC arguments values into the appropriate registers\r |
15 | ldp x6, x7, [x0, #48]\r | |
16 | ldp x4, x5, [x0, #32]\r | |
17 | ldp x2, x3, [x0, #16]\r | |
18 | ldp x0, x1, [x0, #0]\r | |
25402f5d | 19 | \r |
25402f5d | 20 | smc #0\r |
25402f5d | 21 | \r |
b4e53e38 | 22 | // Pop the ARM_SMC_ARGS structure address from the stack into x9\r |
fb7ea611 | 23 | ldr x9, [sp], #16\r |
b4e53e38 | 24 | \r |
fb7ea611 | 25 | // Store the SMC returned values into the ARM_SMC_ARGS structure.\r |
b4e53e38 OM |
26 | // A SMC call can return up to 4 values - we do not need to store back x4-x7.\r |
27 | stp x2, x3, [x9, #16]\r | |
28 | stp x0, x1, [x9, #0]\r | |
29 | \r | |
30 | mov x0, x9\r | |
31 | \r | |
25402f5d | 32 | ret\r |