]>
Commit | Line | Data |
---|---|---|
f8f0e454 | 1 | //\r |
8035edbe | 2 | // Copyright (c) 2012 - 2020, ARM Limited. All rights reserved.\r |
f8f0e454 | 3 | //\r |
4059386c | 4 | // SPDX-License-Identifier: BSD-2-Clause-Patent\r |
f8f0e454 SV |
5 | //\r |
6 | //\r | |
7 | \r | |
8 | .text\r | |
9 | .align 3\r | |
10 | \r | |
11 | GCC_ASM_EXPORT(ArmCallSvc)\r | |
12 | \r | |
13 | ASM_PFX(ArmCallSvc):\r | |
14 | // Push frame pointer and return address on the stack\r | |
15 | stp x29, x30, [sp, #-32]!\r | |
16 | mov x29, sp\r | |
17 | \r | |
18 | // Push x0 on the stack - The stack must always be quad-word aligned\r | |
19 | str x0, [sp, #16]\r | |
20 | \r | |
21 | // Load the SVC arguments values into the appropriate registers\r | |
22 | ldp x6, x7, [x0, #48]\r | |
23 | ldp x4, x5, [x0, #32]\r | |
24 | ldp x2, x3, [x0, #16]\r | |
25 | ldp x0, x1, [x0, #0]\r | |
26 | \r | |
27 | svc #0\r | |
8035edbe VS |
28 | // Prevent speculative execution beyond svc instruction\r |
29 | dsb nsh\r | |
30 | isb\r | |
f8f0e454 SV |
31 | \r |
32 | // Pop the ARM_SVC_ARGS structure address from the stack into x9\r | |
33 | ldr x9, [sp, #16]\r | |
34 | \r | |
35 | // Store the SVC returned values into the ARM_SVC_ARGS structure.\r | |
36 | // A SVC call can return up to 4 values - we do not need to store back x4-x7.\r | |
37 | stp x0, x1, [x9, #0]\r | |
38 | stp x2, x3, [x9, #16]\r | |
39 | \r | |
40 | mov x0, x9\r | |
41 | \r | |
42 | ldp x29, x30, [sp], #32\r | |
43 | ret\r |