]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S
7c94db3451f014e743481dbe79f5deacf9a5f001
[mirror_edk2.git] / ArmPkg / Library / ArmSvcLib / AArch64 / ArmSvc.S
1 //
2 // Copyright (c) 2012 - 2017, ARM Limited. All rights reserved.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
5 //
6 //
7
8 .text
9 .align 3
10
11 GCC_ASM_EXPORT(ArmCallSvc)
12
13 ASM_PFX(ArmCallSvc):
14 // Push frame pointer and return address on the stack
15 stp x29, x30, [sp, #-32]!
16 mov x29, sp
17
18 // Push x0 on the stack - The stack must always be quad-word aligned
19 str x0, [sp, #16]
20
21 // Load the SVC arguments values into the appropriate registers
22 ldp x6, x7, [x0, #48]
23 ldp x4, x5, [x0, #32]
24 ldp x2, x3, [x0, #16]
25 ldp x0, x1, [x0, #0]
26
27 svc #0
28
29 // Pop the ARM_SVC_ARGS structure address from the stack into x9
30 ldr x9, [sp, #16]
31
32 // Store the SVC returned values into the ARM_SVC_ARGS structure.
33 // A SVC call can return up to 4 values - we do not need to store back x4-x7.
34 stp x0, x1, [x9, #0]
35 stp x2, x3, [x9, #16]
36
37 mov x0, x9
38
39 ldp x29, x30, [sp], #32
40 ret