summaryrefslogtreecommitdiffstats
path: root/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
diff options
context:
space:
mode:
authorPete Batard <pete@akeo.ie>2018-01-12 21:33:29 +0800
committerLiming Gao <liming.gao@intel.com>2018-02-07 09:49:22 +0800
commite58427e3964e50caf274d4ba84a984f0cdfcd90d (patch)
treece08f15e3bf59df342795815d18877f74e41a8b1 /ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
parent30939ff2bc43f9cadb098025836f630e1d577147 (diff)
downloadedk2-e58427e3964e50caf274d4ba84a984f0cdfcd90d.tar.gz
edk2-e58427e3964e50caf274d4ba84a984f0cdfcd90d.tar.bz2
edk2-e58427e3964e50caf274d4ba84a984f0cdfcd90d.zip
ArmPkg/Library/CompilerIntrinsicsLib: Enable VS2017/ARM builds
Introduce CRT assembly replacements for __rt_sdiv, __rt_udiv, __rt_udiv64, __rt_sdiv64, __rt_srsh (by reusing the RVCT code) as well as memcpy and memset. For MSFT compatibility, some of the code needs to be explicitly forced to ARM, and the /oldit assembly flag needs to be added. Also, while RVCT_ASM_EXPORT macro invocations have been removed, the replacement code is designed to be as close as possible to the one that would have been generated if using the macros. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Pete Batard <pete@akeo.ie> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Diffstat (limited to 'ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c')
-rw-r--r--ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c b/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
new file mode 100644
index 0000000000..64205e5d10
--- /dev/null
+++ b/ArmPkg/Library/CompilerIntrinsicsLib/memset_ms.c
@@ -0,0 +1,33 @@
+//------------------------------------------------------------------------------
+//
+// Copyright (c) 2017, Pete Batard. All rights reserved.<BR>
+//
+// This program and the accompanying materials are licensed and made
+// available under the terms and conditions of the BSD License which
+// accompanies this distribution. The full text of the license may be
+// found at http://opensource.org/licenses/bsd-license.php
+//
+// THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+// WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR
+// IMPLIED.
+//
+//------------------------------------------------------------------------------
+
+#if defined(_M_ARM64)
+typedef unsigned __int64 size_t;
+#else
+typedef unsigned __int32 size_t;
+#endif
+
+void* memset(void *, int, size_t);
+#pragma intrinsic(memset)
+#pragma function(memset)
+void *memset(void *s, int c, size_t n)
+{
+ unsigned char *d = s;
+
+ while (n--)
+ *d++ = (unsigned char)c;
+
+ return s;
+}