]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmHvcLib/Arm/ArmHvc.S
ArmPkg: copy/paste fixes in ARM ArmHvcLib/ArmSmcLib
[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
de656e66 3// Copyright (c) 2014-2016, Linaro Limited. All rights reserved.\r
58e92b39
AB
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
d63ed30b 15#include <AsmMacroIoLib.h>\r
58e92b39 16\r
de656e66 17.arch_extension virt\r
58e92b39 18\r
de656e66 19ASM_FUNC(ArmCallHvc)\r
58e92b39
AB
20 push {r4-r8}\r
21 // r0 will be popped just after the HVC call\r
22 push {r0}\r
23\r
24 // Load the HVC arguments values into the appropriate registers\r
25 ldr r7, [r0, #28]\r
26 ldr r6, [r0, #24]\r
27 ldr r5, [r0, #20]\r
28 ldr r4, [r0, #16]\r
29 ldr r3, [r0, #12]\r
30 ldr r2, [r0, #8]\r
31 ldr r1, [r0, #4]\r
32 ldr r0, [r0, #0]\r
33\r
34 hvc #0\r
35\r
36 // Pop the ARM_HVC_ARGS structure address from the stack into r8\r
37 pop {r8}\r
38\r
39 // Load the HVC returned values into the appropriate registers\r
40 // A HVC call can return up to 4 values - we do not need to store back r4-r7.\r
41 str r3, [r8, #12]\r
42 str r2, [r8, #8]\r
43 str r1, [r8, #4]\r
44 str r0, [r8, #0]\r
45\r
46 mov r0, r8\r
47\r
48 // Restore the registers r4-r8\r
49 pop {r4-r8}\r
50\r
51 bx lr\r