]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmHvcLib / Arm / 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 <AsmMacroIoLib.h>
10
11 .arch_extension virt
12
13 ASM_FUNC(ArmCallHvc)
14 push {r4-r8}
15 // r0 will be popped just after the HVC call
16 push {r0}
17
18 // Load the HVC arguments values into the appropriate registers
19 ldr r7, [r0, #28]
20 ldr r6, [r0, #24]
21 ldr r5, [r0, #20]
22 ldr r4, [r0, #16]
23 ldr r3, [r0, #12]
24 ldr r2, [r0, #8]
25 ldr r1, [r0, #4]
26 ldr r0, [r0, #0]
27
28 hvc #0
29
30 // Pop the ARM_HVC_ARGS structure address from the stack into r8
31 pop {r8}
32
33 // Load the HVC returned values into the appropriate registers
34 // A HVC call can return up to 4 values - we do not need to store back r4-r7.
35 str r3, [r8, #12]
36 str r2, [r8, #8]
37 str r1, [r8, #4]
38 str r0, [r8, #0]
39
40 mov r0, r8
41
42 // Restore the registers r4-r8
43 pop {r4-r8}
44
45 bx lr