+//\r
+// Copyright (c) 2012, ARM Limited. All rights reserved.\r
+//\r
+// This program and the accompanying materials\r
+// are licensed and made available under the terms and conditions of the BSD License\r
+// which accompanies this distribution. The full text of the license may be found at\r
+// http://opensource.org/licenses/bsd-license.php\r
+//\r
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+//\r
+//\r
+\r
+.text\r
+.align 3\r
+.arch_extension sec\r
+\r
+GCC_ASM_EXPORT(ArmCallSmc)\r
+GCC_ASM_EXPORT(ArmCallSmcArg1)\r
+GCC_ASM_EXPORT(ArmCallSmcArg2)\r
+GCC_ASM_EXPORT(ArmCallSmcArg3)\r
+\r
+ASM_PFX(ArmCallSmc):\r
+ push {r1}\r
+ mov r1, r0\r
+ ldr r0,[r1]\r
+ smc #0\r
+ str r0,[r1]\r
+ pop {r1}\r
+ blx lr\r
+\r
+// Arg1 in R1\r
+ASM_PFX(ArmCallSmcArg1):\r
+ push {r2-r3}\r
+ mov r2, r0\r
+ mov r3, r1\r
+ ldr r0,[r2]\r
+ ldr r1,[r3]\r
+ smc #0\r
+ str r0,[r2]\r
+ str r1,[r3]\r
+ pop {r2-r3}\r
+ blx lr\r
+\r
+ASM_PFX(ArmCallSmcArg2):\r
+ push {r3-r5}\r
+ mov r3, r0\r
+ mov r4, r1\r
+ mov r5, r2\r
+ ldr r0,[r3]\r
+ ldr r1,[r4]\r
+ ldr r2,[r5]\r
+ smc #0\r
+ str r0,[r3]\r
+ str r1,[r4]\r
+ str r2,[r5]\r
+ pop {r3-r5}\r
+ blx lr\r
+\r
+ASM_PFX(ArmCallSmcArg3):\r
+ push {r4-r7}\r
+ mov r4, r0\r
+ mov r5, r1\r
+ mov r6, r2\r
+ mov r7, r3\r
+ ldr r0,[r4]\r
+ ldr r1,[r5]\r
+ ldr r2,[r6]\r
+ ldr r3,[r7]\r
+ smc #0\r
+ str r0,[r4]\r
+ str r1,[r5]\r
+ str r2,[r6]\r
+ str r3,[r7]\r
+ pop {r4-r7}\r
+ blx lr\r