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