]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.asm
ArmPkg/ArmSmcLib: fix stack handling in .asm version of SMC wrapper
[mirror_edk2.git] / ArmPkg / Library / ArmSmcLib / Arm / ArmSmc.asm
CommitLineData
eac42a51 1//\r
b4e53e38 2// Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r
eac42a51 3//\r
4// This program and the accompanying materials\r
5// are licensed and made available under the terms and conditions of the BSD License\r
6// which accompanies this distribution. The full text of the license may be found at\r
7// http://opensource.org/licenses/bsd-license.php\r
8//\r
9// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
10// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
11//\r
12//\r
13\r
14 EXPORT ArmCallSmc\r
eac42a51 15\r
16 AREA ArmSmc, CODE, READONLY\r
17\r
18ArmCallSmc\r
b4e53e38
OM
19 push {r4-r8}\r
20 // r0 will be popped just after the SMC call\r
432dc3c1 21 push {r0}\r
eac42a51 22\r
b4e53e38
OM
23 // Load the SMC arguments values into the appropriate registers\r
24 ldr r7, [r0, #28]\r
25 ldr r6, [r0, #24]\r
26 ldr r5, [r0, #20]\r
27 ldr r4, [r0, #16]\r
28 ldr r3, [r0, #12]\r
29 ldr r2, [r0, #8]\r
30 ldr r1, [r0, #4]\r
31 ldr r0, [r0, #0]\r
eac42a51 32\r
eac42a51 33 smc #0\r
eac42a51 34\r
b4e53e38
OM
35 // Pop the ARM_SMC_ARGS structure address from the stack into r8\r
36 pop {r8}\r
37\r
38 // Load the SMC returned values into the appropriate registers\r
39 // A SMC call can return up to 4 values - we do not need to store back r4-r7.\r
40 str r3, [r8, #12]\r
41 str r2, [r8, #8]\r
42 str r1, [r8, #4]\r
43 str r0, [r8, #0]\r
44\r
45 mov r0, r8\r
46\r
47 // Restore the registers r4-r8\r
48 pop {r4-r8}\r
49\r
166c01fb 50 bx lr\r
eac42a51 51\r
52 END\r