]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSmcLib/Arm/ArmSmc.S
ArmPkg: Move ArmSmcLib from ArmPlatformLib to ArmPkg
[mirror_edk2.git] / ArmPkg / Library / ArmSmcLib / Arm / ArmSmc.S
1 //
2 // Copyright (c) 2012, ARM Limited. All rights reserved.
3 //
4 // This program and the accompanying materials
5 // are licensed and made available under the terms and conditions of the BSD License
6 // which accompanies this distribution. The full text of the license may be found at
7 // http://opensource.org/licenses/bsd-license.php
8 //
9 // THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11 //
12 //
13
14 .text
15 .align 3
16 .arch_extension sec
17
18 GCC_ASM_EXPORT(ArmCallSmc)
19 GCC_ASM_EXPORT(ArmCallSmcArg1)
20 GCC_ASM_EXPORT(ArmCallSmcArg2)
21 GCC_ASM_EXPORT(ArmCallSmcArg3)
22
23 ASM_PFX(ArmCallSmc):
24 push {r1}
25 mov r1, r0
26 ldr r0,[r1]
27 smc #0
28 str r0,[r1]
29 pop {r1}
30 bx lr
31
32 ASM_PFX(ArmCallSmcArg1):
33 push {r2-r3}
34 mov r2, r0
35 mov r3, r1
36 ldr r0,[r2]
37 ldr r1,[r3]
38 smc #0
39 str r0,[r2]
40 str r1,[r3]
41 pop {r2-r3}
42 bx lr
43
44 ASM_PFX(ArmCallSmcArg2):
45 push {r3-r5}
46 mov r3, r0
47 mov r4, r1
48 mov r5, r2
49 ldr r0,[r3]
50 ldr r1,[r4]
51 ldr r2,[r5]
52 smc #0
53 str r0,[r3]
54 str r1,[r4]
55 str r2,[r5]
56 pop {r3-r5}
57 bx lr
58
59 ASM_PFX(ArmCallSmcArg3):
60 push {r4-r7}
61 mov r4, r0
62 mov r5, r1
63 mov r6, r2
64 mov r7, r3
65 ldr r0,[r4]
66 ldr r1,[r5]
67 ldr r2,[r6]
68 ldr r3,[r7]
69 smc #0
70 str r0,[r4]
71 str r1,[r5]
72 str r2,[r6]
73 str r3,[r7]
74 pop {r4-r7}
75 bx lr