]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSmcLib/AArch64/ArmSmc.S
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmSmcLib / AArch64 / ArmSmc.S
1 //
2 // Copyright (c) 2012-2014, ARM Limited. All rights reserved.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
5 //
6 //
7
8 #include <AsmMacroIoLibV8.h>
9
10 ASM_FUNC(ArmCallSmc)
11 // Push x0 on the stack - The stack must always be quad-word aligned
12 str x0, [sp, #-16]!
13
14 // Load the SMC arguments values into the appropriate registers
15 ldp x6, x7, [x0, #48]
16 ldp x4, x5, [x0, #32]
17 ldp x2, x3, [x0, #16]
18 ldp x0, x1, [x0, #0]
19
20 smc #0
21
22 // Pop the ARM_SMC_ARGS structure address from the stack into x9
23 ldr x9, [sp], #16
24
25 // Store the SMC returned values into the ARM_SMC_ARGS structure.
26 // A SMC call can return up to 4 values - we do not need to store back x4-x7.
27 stp x2, x3, [x9, #16]
28 stp x0, x1, [x9, #0]
29
30 mov x0, x9
31
32 ret