GCC:*_*_ARM_PLATFORM_FLAGS == -march=armv7-a -mfpu=neon\r
GCC:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG\r
\r
- RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A8\r
+ # We use A15 to get the Secure and Virtualization extensions\r
+ RVCT:*_*_ARM_PLATFORM_FLAGS == --cpu Cortex-A15\r
RVCT:RELEASE_*_*_CC_FLAGS = -DMDEPKG_NDEBUG\r
\r
[LibraryClasses.common]\r
\r
ArmPkg/Library/ArmSmcLib/ArmSmcLib.inf\r
ArmPkg/Library/ArmSmcLibNull/ArmSmcLibNull.inf\r
+ ArmPkg/Library/ArmHvcLib/ArmHvcLib.inf\r
\r
ArmPkg/Filesystem/SemihostFs/SemihostFs.inf\r
\r
--- /dev/null
+/** @file\r
+*\r
+* Copyright (c) 2012-2014, 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
+#ifndef __ARM_HVC_LIB__\r
+#define __ARM_HVC_LIB__\r
+\r
+/**\r
+ * The size of the HVC arguments are different between AArch64 and AArch32.\r
+ * The native size is used for the arguments.\r
+ */\r
+typedef struct {\r
+ UINTN Arg0;\r
+ UINTN Arg1;\r
+ UINTN Arg2;\r
+ UINTN Arg3;\r
+ UINTN Arg4;\r
+ UINTN Arg5;\r
+ UINTN Arg6;\r
+ UINTN Arg7;\r
+} ARM_HVC_ARGS;\r
+\r
+/**\r
+ Trigger an HVC call\r
+\r
+ HVC calls can take up to 8 arguments and return up to 4 return values.\r
+ Therefore, the 4 first fields in the ARM_HVC_ARGS structure are used\r
+ for both input and output values.\r
+\r
+**/\r
+VOID\r
+ArmCallHvc (\r
+ IN OUT ARM_HVC_ARGS *Args\r
+ );\r
+\r
+#endif\r
--- /dev/null
+//\r
+// Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r
+// Copyright (c) 2014, Linaro 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
+\r
+GCC_ASM_EXPORT(ArmCallHvc)\r
+\r
+ASM_PFX(ArmCallHvc):\r
+ // Push x0 on the stack\r
+ str x0, [sp, #-8]!\r
+\r
+ // Load the HVC arguments values into the appropriate registers\r
+ ldp x6, x7, [x0, #48]\r
+ ldp x4, x5, [x0, #32]\r
+ ldp x2, x3, [x0, #16]\r
+ ldp x0, x1, [x0, #0]\r
+\r
+ hvc #0\r
+\r
+ // Pop the ARM_HVC_ARGS structure address from the stack into x9\r
+ ldr x9, [sp], #8\r
+\r
+ // Store the HVC returned values into the appropriate registers\r
+ // A HVC call can return up to 4 values\r
+ stp x2, x3, [x9, #16]\r
+ stp x0, x1, [x9, #0]\r
+\r
+ mov x0, x9\r
+\r
+ ret\r
--- /dev/null
+//\r
+// Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r
+// Copyright (c) 2014, Linaro 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 virt\r
+\r
+GCC_ASM_EXPORT(ArmCallHvc)\r
+\r
+ASM_PFX(ArmCallHvc):\r
+ push {r4-r8}\r
+ // r0 will be popped just after the HVC call\r
+ push {r0}\r
+\r
+ // Load the HVC arguments values into the appropriate registers\r
+ ldr r7, [r0, #28]\r
+ ldr r6, [r0, #24]\r
+ ldr r5, [r0, #20]\r
+ ldr r4, [r0, #16]\r
+ ldr r3, [r0, #12]\r
+ ldr r2, [r0, #8]\r
+ ldr r1, [r0, #4]\r
+ ldr r0, [r0, #0]\r
+\r
+ hvc #0\r
+\r
+ // Pop the ARM_HVC_ARGS structure address from the stack into r8\r
+ pop {r8}\r
+\r
+ // Load the HVC returned values into the appropriate registers\r
+ // A HVC call can return up to 4 values - we do not need to store back r4-r7.\r
+ str r3, [r8, #12]\r
+ str r2, [r8, #8]\r
+ str r1, [r8, #4]\r
+ str r0, [r8, #0]\r
+\r
+ mov r0, r8\r
+\r
+ // Restore the registers r4-r8\r
+ pop {r4-r8}\r
+\r
+ bx lr\r
--- /dev/null
+//\r
+// Copyright (c) 2012-2014, ARM Limited. All rights reserved.\r
+// Copyright (c) 2014, Linaro 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
+ EXPORT ArmCallHvc\r
+\r
+ AREA ArmHvc, CODE, READONLY\r
+\r
+ArmCallHvc\r
+ push {r4-r8}\r
+ // r0 will be popped just after the HVC call\r
+ push {r0}\r
+\r
+ // Load the HVC arguments values into the appropriate registers\r
+ ldr r7, [r0, #28]\r
+ ldr r6, [r0, #24]\r
+ ldr r5, [r0, #20]\r
+ ldr r4, [r0, #16]\r
+ ldr r3, [r0, #12]\r
+ ldr r2, [r0, #8]\r
+ ldr r1, [r0, #4]\r
+ ldr r0, [r0, #0]\r
+\r
+ hvc #0\r
+\r
+ // Pop the ARM_HVC_ARGS structure address from the stack into r8\r
+ pop {r8}\r
+\r
+ // Load the HVC returned values into the appropriate registers\r
+ // A HVC call can return up to 4 values - we do not need to store back r4-r7.\r
+ str r3, [r8, #12]\r
+ str r2, [r8, #8]\r
+ str r1, [r8, #4]\r
+ str r0, [r8, #0]\r
+\r
+ mov r0, r8\r
+\r
+ // Restore the registers r4-r8\r
+ pop {r4-r8}\r
+\r
+ bx lr\r
+\r
+ END\r
--- /dev/null
+#/** @file\r
+#\r
+# Copyright (c) 2012-2013, ARM Ltd. All rights reserved.<BR>\r
+# Copyright (c) 2014, Linaro Ltd. All rights reserved.<BR>\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
+[Defines]\r
+ INF_VERSION = 0x00010005\r
+ BASE_NAME = ArmHvcLib\r
+ FILE_GUID = E594959A-D150-44D3-963B-BA90329D3D9A\r
+ MODULE_TYPE = BASE\r
+ VERSION_STRING = 1.0\r
+ LIBRARY_CLASS = ArmHvcLib\r
+\r
+[Sources.ARM]\r
+ Arm/ArmHvc.asm | RVCT\r
+ Arm/ArmHvc.S | GCC\r
+\r
+[Sources.AARCH64]\r
+ AArch64/ArmHvc.S\r
+\r
+[Packages]\r
+ MdePkg/MdePkg.dec\r
+ ArmPkg/ArmPkg.dec\r