]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.S
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmSmcLib / Arm / ArmSmc.S
1 //
2 // Copyright (c) 2012-2014, ARM Limited. All rights reserved.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
5 //
6 //
7
8 #include <AsmMacroIoLib.h>
9
10 .arch_extension sec
11
12 ASM_FUNC(ArmCallSmc)
13 push {r4-r8}
14 // r0 will be popped just after the SMC call
15 push {r0}
16
17 // Load the SMC 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 smc #0
28
29 // Pop the ARM_SMC_ARGS structure address from the stack into r8
30 pop {r8}
31
32 // Load the SMC returned values into the appropriate registers
33 // A SMC 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