]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.asm
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmHvcLib / Arm / ArmHvc.asm
1 //
2 // Copyright (c) 2012-2014, ARM Limited. All rights reserved.
3 // Copyright (c) 2014, Linaro Limited. All rights reserved.
4 //
5 // SPDX-License-Identifier: BSD-2-Clause-Patent
6 //
7 //
8
9
10 INCLUDE AsmMacroExport.inc
11
12 RVCT_ASM_EXPORT ArmCallHvc
13 push {r4-r8}
14 // r0 will be popped just after the HVC call
15 push {r0}
16
17 // Load the HVC arguments values into the appropriate registers
18 ldr r7, [r0, #28]
19 ldr r6, [r0, #24]
20 ldr r5, [r0, #20]
21 ldr r4, [r0, #16]
22 ldr r3, [r0, #12]
23 ldr r2, [r0, #8]
24 ldr r1, [r0, #4]
25 ldr r0, [r0, #0]
26
27 hvc #0
28
29 // Pop the ARM_HVC_ARGS structure address from the stack into r8
30 pop {r8}
31
32 // Load the HVC returned values into the appropriate registers
33 // A HVC call can return up to 4 values - we do not need to store back r4-r7.
34 str r3, [r8, #12]
35 str r2, [r8, #8]
36 str r1, [r8, #4]
37 str r0, [r8, #0]
38
39 mov r0, r8
40
41 // Restore the registers r4-r8
42 pop {r4-r8}
43
44 bx lr
45
46 END