]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Library/ArmSmcLib/AArch64/ArmSmc.S
ArmPkg: Added Aarch64 support
[mirror_edk2.git] / ArmPkg / Library / ArmSmcLib / AArch64 / ArmSmc.S
1 //
2 // Copyright (c) 2012-2013, 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
17 GCC_ASM_EXPORT(ArmCallSmc)
18 GCC_ASM_EXPORT(ArmCallSmcArg1)
19 GCC_ASM_EXPORT(ArmCallSmcArg2)
20 GCC_ASM_EXPORT(ArmCallSmcArg3)
21
22 ASM_PFX(ArmCallSmc):
23 str x1, [sp, #-0x10]!
24 mov x1, x0
25 ldr x0,[x1]
26 smc #0
27 str x0,[x1]
28 ldr x1, [sp], #0x10
29 ret
30
31 ASM_PFX(ArmCallSmcArg1):
32 stp x2, x3, [sp, #-0x10]!
33 mov x2, x0
34 mov x3, x1
35 ldr x0,[x2]
36 ldr x1,[x3]
37 smc #0
38 str x0,[x2]
39 str x1,[x3]
40 ldp x2, x3, [sp], #0x10
41 ret
42
43 ASM_PFX(ArmCallSmcArg2):
44 stp x3, x4, [sp, #-0x10]!
45 str x5, [sp, #-8]!
46 mov x3, x0
47 mov x4, x1
48 mov x5, x2
49 ldr x0,[x3]
50 ldr x1,[x4]
51 ldr x2,[x5]
52 smc #0
53 str x0,[x3]
54 str x1,[x4]
55 str x2,[x5]
56 ldr x5, [sp], #8
57 ldp x3, x4, [sp], #0x10
58 ret
59
60 ASM_PFX(ArmCallSmcArg3):
61 stp x4, x5, [sp, #-0x10]!
62 stp x6, x7, [sp, #-0x10]!
63 mov x4, x0
64 mov x5, x1
65 mov x6, x2
66 mov x7, x3
67 ldr x0,[x4]
68 ldr x1,[x5]
69 ldr x2,[x6]
70 ldr x3,[x7]
71 smc #0
72 str x0,[x4]
73 str x1,[x5]
74 str x2,[x6]
75 str x3,[x7]
76 ldp x4, x5, [sp], #0x10
77 ldp x6, x7, [sp], #0x10
78 ret