]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSvcLib/AArch64/ArmSvc.S
7b8e4a965b96c3ff0907868b7a19d0c3d4b0a75e
[mirror_edk2.git] / ArmPkg / Library / ArmSvcLib / AArch64 / ArmSvc.S
1 //
2 // Copyright (c) 2012 - 2017, ARM Limited. All rights reserved.
3 //
4 // This program and the accompanying materials
5 // are licensed and made available under the terms and conditions of the BSD License
6 // which accompanies this distribution. The full text of the license may be found at
7 // http://opensource.org/licenses/bsd-license.php
8 //
9 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 //
12 //
13
14 .text
15 .align 3
16
17 GCC_ASM_EXPORT(ArmCallSvc)
18
19 ASM_PFX(ArmCallSvc):
20 // Push frame pointer and return address on the stack
21 stp x29, x30, [sp, #-32]!
22 mov x29, sp
23
24 // Push x0 on the stack - The stack must always be quad-word aligned
25 str x0, [sp, #16]
26
27 // Load the SVC arguments values into the appropriate registers
28 ldp x6, x7, [x0, #48]
29 ldp x4, x5, [x0, #32]
30 ldp x2, x3, [x0, #16]
31 ldp x0, x1, [x0, #0]
32
33 svc #0
34
35 // Pop the ARM_SVC_ARGS structure address from the stack into x9
36 ldr x9, [sp, #16]
37
38 // Store the SVC returned values into the ARM_SVC_ARGS structure.
39 // A SVC call can return up to 4 values - we do not need to store back x4-x7.
40 stp x0, x1, [x9, #0]
41 stp x2, x3, [x9, #16]
42
43 mov x0, x9
44
45 ldp x29, x30, [sp], #32
46 ret