]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSvcLib/Arm/ArmSvc.S
fc2886b6b53e0dd75b1ecec44d66e53f746a1613
[mirror_edk2.git] / ArmPkg / Library / ArmSvcLib / Arm / ArmSvc.S
1 //
2 // Copyright (c) 2016 - 2017, ARM Limited. All rights reserved.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
5 //
6 //
7
8 .text
9 .align 3
10
11 GCC_ASM_EXPORT(ArmCallSvc)
12
13 ASM_PFX(ArmCallSvc):
14 // r0 will be popped just after the SVC call
15 push {r0, r4-r8}
16
17 // Load the SVC arguments values into the appropriate registers
18 ldm r0, {r0-r7}
19
20 svc #0
21
22 // Load the ARM_SVC_ARGS structure address from the stack into r8
23 ldr r8, [sp]
24
25 // Load the SVC returned values into the appropriate registers
26 // A SVC call can return up to 4 values - we do not need to store back r4-r7.
27 stm r8, {r0-r3}
28
29 mov r0, r8
30
31 // Restore the registers r4-r8
32 pop {r1, r4-r8}
33 bx lr