]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S
ArmPkg/ArmGicV3: switch to ASM_FUNC() asm macro
[mirror_edk2.git] / ArmPkg / Library / ArmHvcLib / Arm / ArmHvc.S
CommitLineData
58e92b39
AB
1//\r
2// Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r
3// Copyright (c) 2014, Linaro Limited. All rights reserved.\r
4//\r
5// This program and the accompanying materials\r
6// are licensed and made available under the terms and conditions of the BSD License\r
7// which accompanies this distribution. The full text of the license may be found at\r
8// http://opensource.org/licenses/bsd-license.php\r
9//\r
10// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12//\r
13//\r
14\r
15.text\r
16.align 3\r
17.arch_extension virt\r
18\r
19GCC_ASM_EXPORT(ArmCallHvc)\r
20\r
21ASM_PFX(ArmCallHvc):\r
22 push {r4-r8}\r
23 // r0 will be popped just after the HVC call\r
24 push {r0}\r
25\r
26 // Load the HVC arguments values into the appropriate registers\r
27 ldr r7, [r0, #28]\r
28 ldr r6, [r0, #24]\r
29 ldr r5, [r0, #20]\r
30 ldr r4, [r0, #16]\r
31 ldr r3, [r0, #12]\r
32 ldr r2, [r0, #8]\r
33 ldr r1, [r0, #4]\r
34 ldr r0, [r0, #0]\r
35\r
36 hvc #0\r
37\r
38 // Pop the ARM_HVC_ARGS structure address from the stack into r8\r
39 pop {r8}\r
40\r
41 // Load the HVC returned values into the appropriate registers\r
42 // A HVC call can return up to 4 values - we do not need to store back r4-r7.\r
43 str r3, [r8, #12]\r
44 str r2, [r8, #8]\r
45 str r1, [r8, #4]\r
46 str r0, [r8, #0]\r
47\r
48 mov r0, r8\r
49\r
50 // Restore the registers r4-r8\r
51 pop {r4-r8}\r
52\r
53 bx lr\r