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