]>
Commit | Line | Data |
---|---|---|
1 | //\r | |
2 | // Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r | |
3 | //\r | |
4 | // SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
5 | //\r | |
6 | //\r | |
7 | \r | |
8 | #include <AsmMacroIoLibV8.h>\r | |
9 | \r | |
10 | ASM_FUNC(ArmCallSmc)\r | |
11 | // Push x0 on the stack - The stack must always be quad-word aligned\r | |
12 | str x0, [sp, #-16]!\r | |
13 | \r | |
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 | |
19 | \r | |
20 | smc #0\r | |
21 | \r | |
22 | // Pop the ARM_SMC_ARGS structure address from the stack into x9\r | |
23 | ldr x9, [sp], #16\r | |
24 | \r | |
25 | // Store the SMC returned values into the ARM_SMC_ARGS structure.\r | |
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 | |
32 | ret\r |