]>
Commit | Line | Data |
---|---|---|
25402f5d | 1 | //\r |
b4e53e38 | 2 | // Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r |
25402f5d HL |
3 | //\r |
4 | // This program and the accompanying materials\r | |
5 | // are licensed and made available under the terms and conditions of the BSD License\r | |
6 | // which accompanies this distribution. The full text of the license may be found at\r | |
7 | // http://opensource.org/licenses/bsd-license.php\r | |
8 | //\r | |
9 | // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r | |
10 | // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
11 | //\r | |
12 | //\r | |
13 | \r | |
86a4d91b | 14 | #include <AsmMacroIoLibV8.h>\r |
25402f5d | 15 | \r |
86a4d91b | 16 | ASM_FUNC(ArmCallSmc)\r |
fb7ea611 OM |
17 | // Push x0 on the stack - The stack must always be quad-word aligned\r |
18 | str x0, [sp, #-16]!\r | |
25402f5d | 19 | \r |
b4e53e38 OM |
20 | // Load the SMC arguments values into the appropriate registers\r |
21 | ldp x6, x7, [x0, #48]\r | |
22 | ldp x4, x5, [x0, #32]\r | |
23 | ldp x2, x3, [x0, #16]\r | |
24 | ldp x0, x1, [x0, #0]\r | |
25402f5d | 25 | \r |
25402f5d | 26 | smc #0\r |
25402f5d | 27 | \r |
b4e53e38 | 28 | // Pop the ARM_SMC_ARGS structure address from the stack into x9\r |
fb7ea611 | 29 | ldr x9, [sp], #16\r |
b4e53e38 | 30 | \r |
fb7ea611 | 31 | // Store the SMC returned values into the ARM_SMC_ARGS structure.\r |
b4e53e38 OM |
32 | // A SMC call can return up to 4 values - we do not need to store back x4-x7.\r |
33 | stp x2, x3, [x9, #16]\r | |
34 | stp x0, x1, [x9, #0]\r | |
35 | \r | |
36 | mov x0, x9\r | |
37 | \r | |
25402f5d | 38 | ret\r |