]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm
ArmPkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / ArmPkg / Library / ArmSmcLib / Arm / ArmSmc.asm
1 //
2 // Copyright (c) 2012-2014, ARM Limited. All rights reserved.
3 //
4 // SPDX-License-Identifier: BSD-2-Clause-Patent
5 //
6 //
7
8
9 INCLUDE AsmMacroExport.inc
10
11 RVCT_ASM_EXPORT ArmCallSmc
12 push {r4-r8}
13 // r0 will be popped just after the SMC call
14 push {r0}
15
16 // Load the SMC arguments values into the appropriate registers
17 ldr r7, [r0, #28]
18 ldr r6, [r0, #24]
19 ldr r5, [r0, #20]
20 ldr r4, [r0, #16]
21 ldr r3, [r0, #12]
22 ldr r2, [r0, #8]
23 ldr r1, [r0, #4]
24 ldr r0, [r0, #0]
25
26 smc #0
27
28 // Pop the ARM_SMC_ARGS structure address from the stack into r8
29 pop {r8}
30
31 // Load the SMC returned values into the appropriate registers
32 // A SMC call can return up to 4 values - we do not need to store back r4-r7.
33 str r3, [r8, #12]
34 str r2, [r8, #8]
35 str r1, [r8, #4]
36 str r0, [r8, #0]
37
38 mov r0, r8
39
40 // Restore the registers r4-r8
41 pop {r4-r8}
42
43 bx lr
44
45 END