]>
Commit | Line | Data |
---|---|---|
f8f0e454 SV |
1 | //\r |
2 | // Copyright (c) 2012 - 2017, ARM Limited. All rights reserved.\r | |
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 | |
14 | .text\r | |
15 | .align 3\r | |
16 | \r | |
17 | GCC_ASM_EXPORT(ArmCallSvc)\r | |
18 | \r | |
19 | ASM_PFX(ArmCallSvc):\r | |
20 | // Push frame pointer and return address on the stack\r | |
21 | stp x29, x30, [sp, #-32]!\r | |
22 | mov x29, sp\r | |
23 | \r | |
24 | // Push x0 on the stack - The stack must always be quad-word aligned\r | |
25 | str x0, [sp, #16]\r | |
26 | \r | |
27 | // Load the SVC arguments values into the appropriate registers\r | |
28 | ldp x6, x7, [x0, #48]\r | |
29 | ldp x4, x5, [x0, #32]\r | |
30 | ldp x2, x3, [x0, #16]\r | |
31 | ldp x0, x1, [x0, #0]\r | |
32 | \r | |
33 | svc #0\r | |
34 | \r | |
35 | // Pop the ARM_SVC_ARGS structure address from the stack into x9\r | |
36 | ldr x9, [sp, #16]\r | |
37 | \r | |
38 | // Store the SVC returned values into the ARM_SVC_ARGS structure.\r | |
39 | // A SVC call can return up to 4 values - we do not need to store back x4-x7.\r | |
40 | stp x0, x1, [x9, #0]\r | |
41 | stp x2, x3, [x9, #16]\r | |
42 | \r | |
43 | mov x0, x9\r | |
44 | \r | |
45 | ldp x29, x30, [sp], #32\r | |
46 | ret\r |