Discussion:
[edk2] [PATCH 1/4] StdLib: Added BaseStackLib for ARM architectures
Olivier Martin
2015-07-16 13:52:03 UTC
Permalink
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Olivier Martin <***@arm.com>
Reviewed-by: Ronald Cron <***@arm.com>
---
StdLib/StdLib.inc | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/StdLib/StdLib.inc b/StdLib/StdLib.inc
index 1b7fcf0..391c7c9 100644
--- a/StdLib/StdLib.inc
+++ b/StdLib/StdLib.inc
@@ -73,9 +73,15 @@
[LibraryClasses.ARM]
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+ # Add support for GCC stack protector
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+
[LibraryClasses.AArch64]
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+ # Add support for GCC stack protector
+ NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
+
[Components]
# BaseLib and BaseMemoryLib need to be built with the /GL- switch when using the Microsoft
# tool chain. This is required so that the library functions can be resolved during
--
2.1.1
Olivier Martin
2015-07-16 13:52:05 UTC
Permalink
From: Harry Liebel <***@arm.com>

Provide missing functionality by using files from LLVM.

Changes made:
- Formatting changes (tabs to spaces, DOS line endings etc).
- Simplified 'int_endianness.h' to work for our case.
- Added LLVM licence to the individual files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <***@arm.com>
Reviewed-by: Olivier Martin <***@arm.com>
---
StdLib/LibC/LibC.inf | 2 +
StdLib/LibC/Main/Arm/fixunsdfsi.c | 74 +++++++++
StdLib/LibC/Main/Arm/floatunsidf.c | 71 +++++++++
StdLib/LibC/Main/Arm/fp_lib.h | 282 ++++++++++++++++++++++++++++++++++
StdLib/LibC/Main/Arm/int_endianness.h | 71 +++++++++
StdLib/LibC/Main/Arm/int_lib.h | 105 +++++++++++++
StdLib/LibC/Main/Arm/int_types.h | 170 ++++++++++++++++++++
StdLib/LibC/Main/Arm/int_util.h | 68 ++++++++
8 files changed, 843 insertions(+)
create mode 100644 StdLib/LibC/Main/Arm/fixunsdfsi.c
create mode 100644 StdLib/LibC/Main/Arm/floatunsidf.c
create mode 100644 StdLib/LibC/Main/Arm/fp_lib.h
create mode 100644 StdLib/LibC/Main/Arm/int_endianness.h
create mode 100644 StdLib/LibC/Main/Arm/int_lib.h
create mode 100644 StdLib/LibC/Main/Arm/int_types.h
create mode 100644 StdLib/LibC/Main/Arm/int_util.h

diff --git a/StdLib/LibC/LibC.inf b/StdLib/LibC/LibC.inf
index d8704db..e44d8a8 100644
--- a/StdLib/LibC/LibC.inf
+++ b/StdLib/LibC/LibC.inf
@@ -85,6 +85,8 @@
Main/Ipf/FpuRmode.s

[Sources.ARM]
+ Main/Arm/fixunsdfsi.c
+ Main/Arm/floatunsidf.c
Main/Arm/flt_rounds.c

[Binaries.IA32]
diff --git a/StdLib/LibC/Main/Arm/fixunsdfsi.c b/StdLib/LibC/Main/Arm/fixunsdfsi.c
new file mode 100644
index 0000000..a63d220
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/fixunsdfsi.c
@@ -0,0 +1,74 @@
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#include "int_lib.h"
+
+/* Returns: convert a to a unsigned int, rounding toward zero.
+ * Negative values all become zero.
+ */
+
+/* Assumption: double is a IEEE 64 bit floating point type
+ * su_int is a 32 bit integral type
+ * value in double is representable in su_int or is negative
+ * (no range checking performed)
+ */
+
+/* seee eeee eeee mmmm mmmm mmmm mmmm mmmm | mmmm mmmm mmmm mmmm mmmm mmmm mmmm mmmm */
+
+ARM_EABI_FNALIAS(d2uiz, fixunsdfsi)
+
+COMPILER_RT_ABI su_int
+__fixunsdfsi(double a)
+{
+ double_bits fb;
+ fb.f = a;
+ int e = ((fb.u.s.high & 0x7FF00000) >> 20) - 1023;
+ if (e < 0 || (fb.u.s.high & 0x80000000))
+ return 0;
+ return (
+ 0x80000000u |
+ ((fb.u.s.high & 0x000FFFFF) << 11) |
+ (fb.u.s.low >> 21)
+ ) >> (31 - e);
+}
diff --git a/StdLib/LibC/Main/Arm/floatunsidf.c b/StdLib/LibC/Main/Arm/floatunsidf.c
new file mode 100644
index 0000000..5f5fb1e
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/floatunsidf.c
@@ -0,0 +1,71 @@
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#define DOUBLE_PRECISION
+#include "fp_lib.h"
+
+#include "int_lib.h"
+
+ARM_EABI_FNALIAS(ui2d, floatunsidf)
+
+COMPILER_RT_ABI fp_t
+__floatunsidf(unsigned int a) {
+
+ const int aWidth = sizeof a * CHAR_BIT;
+
+ // Handle zero as a special case to protect clz
+ if (a == 0) return fromRep(0);
+
+ // Exponent of (fp_t)a is the width of abs(a).
+ const int exponent = (aWidth - 1) - __builtin_clz(a);
+ rep_t result;
+
+ // Shift a into the significand field and clear the implicit bit.
+ const int shift = significandBits - exponent;
+ result = (rep_t)a << shift ^ implicitBit;
+
+ // Insert the exponent
+ result += (rep_t)(exponent + exponentBias) << significandBits;
+ return fromRep(result);
+}
diff --git a/StdLib/LibC/Main/Arm/fp_lib.h b/StdLib/LibC/Main/Arm/fp_lib.h
new file mode 100644
index 0000000..2b46cfa
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/fp_lib.h
@@ -0,0 +1,282 @@
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#ifndef FP_LIB_HEADER
+#define FP_LIB_HEADER
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <limits.h>
+#include "int_lib.h"
+
+#if defined SINGLE_PRECISION
+
+typedef uint32_t rep_t;
+typedef int32_t srep_t;
+typedef float fp_t;
+#define REP_C UINT32_C
+#define significandBits 23
+
+static inline int rep_clz(rep_t a) {
+ return __builtin_clz(a);
+}
+
+// 32x32 --> 64 bit multiply
+static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+ const uint64_t product = (uint64_t)a*b;
+ *hi = product >> 32;
+ *lo = product;
+}
+COMPILER_RT_ABI fp_t __addsf3(fp_t a, fp_t b);
+
+#elif defined DOUBLE_PRECISION
+
+typedef uint64_t rep_t;
+typedef int64_t srep_t;
+typedef double fp_t;
+#define REP_C UINT64_C
+#define significandBits 52
+
+static inline int rep_clz(rep_t a) {
+#if defined __LP64__
+ return __builtin_clzl(a);
+#else
+ if (a & REP_C(0xffffffff00000000))
+ return __builtin_clz(a >> 32);
+ else
+ return 32 + __builtin_clz(a & REP_C(0xffffffff));
+#endif
+}
+
+#define loWord(a) (a & 0xffffffffU)
+#define hiWord(a) (a >> 32)
+
+// 64x64 -> 128 wide multiply for platforms that don't have such an operation;
+// many 64-bit platforms have this operation, but they tend to have hardware
+// floating-point, so we don't bother with a special case for them here.
+static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+ // Each of the component 32x32 -> 64 products
+ const uint64_t plolo = loWord(a) * loWord(b);
+ const uint64_t plohi = loWord(a) * hiWord(b);
+ const uint64_t philo = hiWord(a) * loWord(b);
+ const uint64_t phihi = hiWord(a) * hiWord(b);
+ // Sum terms that contribute to lo in a way that allows us to get the carry
+ const uint64_t r0 = loWord(plolo);
+ const uint64_t r1 = hiWord(plolo) + loWord(plohi) + loWord(philo);
+ *lo = r0 + (r1 << 32);
+ // Sum terms contributing to hi with the carry from lo
+ *hi = hiWord(plohi) + hiWord(philo) + hiWord(r1) + phihi;
+}
+#undef loWord
+#undef hiWord
+
+COMPILER_RT_ABI fp_t __adddf3(fp_t a, fp_t b);
+
+#elif defined QUAD_PRECISION
+#if __LDBL_MANT_DIG__ == 113
+#define CRT_LDBL_128BIT
+typedef __uint128_t rep_t;
+typedef __int128_t srep_t;
+typedef long double fp_t;
+#define REP_C (__uint128_t)
+// Note: Since there is no explicit way to tell compiler the constant is a
+// 128-bit integer, we let the constant be casted to 128-bit integer
+#define significandBits 112
+
+static inline int rep_clz(rep_t a) {
+ const union
+ {
+ __uint128_t ll;
+#if _YUGA_BIG_ENDIAN
+ struct { uint64_t high, low; } s;
+#else
+ struct { uint64_t low, high; } s;
+#endif
+ } uu = { .ll = a };
+
+ uint64_t word;
+ uint64_t add;
+
+ if (uu.s.high){
+ word = uu.s.high;
+ add = 0;
+ }
+ else{
+ word = uu.s.low;
+ add = 64;
+ }
+ return __builtin_clzll(word) + add;
+}
+
+#define Word_LoMask UINT64_C(0x00000000ffffffff)
+#define Word_HiMask UINT64_C(0xffffffff00000000)
+#define Word_FullMask UINT64_C(0xffffffffffffffff)
+#define Word_1(a) (uint64_t)((a >> 96) & Word_LoMask)
+#define Word_2(a) (uint64_t)((a >> 64) & Word_LoMask)
+#define Word_3(a) (uint64_t)((a >> 32) & Word_LoMask)
+#define Word_4(a) (uint64_t)(a & Word_LoMask)
+
+// 128x128 -> 256 wide multiply for platforms that don't have such an operation;
+// many 64-bit platforms have this operation, but they tend to have hardware
+// floating-point, so we don't bother with a special case for them here.
+static inline void wideMultiply(rep_t a, rep_t b, rep_t *hi, rep_t *lo) {
+
+ const uint64_t product11 = Word_1(a) * Word_1(b);
+ const uint64_t product12 = Word_1(a) * Word_2(b);
+ const uint64_t product13 = Word_1(a) * Word_3(b);
+ const uint64_t product14 = Word_1(a) * Word_4(b);
+ const uint64_t product21 = Word_2(a) * Word_1(b);
+ const uint64_t product22 = Word_2(a) * Word_2(b);
+ const uint64_t product23 = Word_2(a) * Word_3(b);
+ const uint64_t product24 = Word_2(a) * Word_4(b);
+ const uint64_t product31 = Word_3(a) * Word_1(b);
+ const uint64_t product32 = Word_3(a) * Word_2(b);
+ const uint64_t product33 = Word_3(a) * Word_3(b);
+ const uint64_t product34 = Word_3(a) * Word_4(b);
+ const uint64_t product41 = Word_4(a) * Word_1(b);
+ const uint64_t product42 = Word_4(a) * Word_2(b);
+ const uint64_t product43 = Word_4(a) * Word_3(b);
+ const uint64_t product44 = Word_4(a) * Word_4(b);
+
+ const __uint128_t sum0 = (__uint128_t)product44;
+ const __uint128_t sum1 = (__uint128_t)product34 +
+ (__uint128_t)product43;
+ const __uint128_t sum2 = (__uint128_t)product24 +
+ (__uint128_t)product33 +
+ (__uint128_t)product42;
+ const __uint128_t sum3 = (__uint128_t)product14 +
+ (__uint128_t)product23 +
+ (__uint128_t)product32 +
+ (__uint128_t)product41;
+ const __uint128_t sum4 = (__uint128_t)product13 +
+ (__uint128_t)product22 +
+ (__uint128_t)product31;
+ const __uint128_t sum5 = (__uint128_t)product12 +
+ (__uint128_t)product21;
+ const __uint128_t sum6 = (__uint128_t)product11;
+
+ const __uint128_t r0 = (sum0 & Word_FullMask) +
+ ((sum1 & Word_LoMask) << 32);
+ const __uint128_t r1 = (sum0 >> 64) +
+ ((sum1 >> 32) & Word_FullMask) +
+ (sum2 & Word_FullMask) +
+ ((sum3 << 32) & Word_HiMask);
+
+ *lo = r0 + (r1 << 64);
+ *hi = (r1 >> 64) +
+ (sum1 >> 96) +
+ (sum2 >> 64) +
+ (sum3 >> 32) +
+ sum4 +
+ (sum5 << 32) +
+ (sum6 << 64);
+}
+#undef Word_1
+#undef Word_2
+#undef Word_3
+#undef Word_4
+#undef Word_HiMask
+#undef Word_LoMask
+#undef Word_FullMask
+#endif // __LDBL_MANT_DIG__ == 113
+#else
+#error SINGLE_PRECISION, DOUBLE_PRECISION or QUAD_PRECISION must be defined.
+#endif
+
+#if defined(SINGLE_PRECISION) || defined(DOUBLE_PRECISION) || defined(CRT_LDBL_128BIT)
+#define typeWidth (sizeof(rep_t)*CHAR_BIT)
+#define exponentBits (typeWidth - significandBits - 1)
+#define maxExponent ((1 << exponentBits) - 1)
+#define exponentBias (maxExponent >> 1)
+
+#define implicitBit (REP_C(1) << significandBits)
+#define significandMask (implicitBit - 1U)
+#define signBit (REP_C(1) << (significandBits + exponentBits))
+#define absMask (signBit - 1U)
+#define exponentMask (absMask ^ significandMask)
+#define oneRep ((rep_t)exponentBias << significandBits)
+#define infRep exponentMask
+#define quietBit (implicitBit >> 1)
+#define qnanRep (exponentMask | quietBit)
+
+static inline rep_t toRep(fp_t x) {
+ const union { fp_t f; rep_t i; } rep = {.f = x};
+ return rep.i;
+}
+
+static inline fp_t fromRep(rep_t x) {
+ const union { fp_t f; rep_t i; } rep = {.i = x};
+ return rep.f;
+}
+
+static inline int normalize(rep_t *significand) {
+ const int shift = rep_clz(*significand) - rep_clz(implicitBit);
+ *significand <<= shift;
+ return 1 - shift;
+}
+
+static inline void wideLeftShift(rep_t *hi, rep_t *lo, int count) {
+ *hi = *hi << count | *lo >> (typeWidth - count);
+ *lo = *lo << count;
+}
+
+static inline void wideRightShiftWithSticky(rep_t *hi, rep_t *lo, unsigned int count) {
+ if (count < typeWidth) {
+ const bool sticky = *lo << (typeWidth - count);
+ *lo = *hi << (typeWidth - count) | *lo >> count | sticky;
+ *hi = *hi >> count;
+ }
+ else if (count < 2*typeWidth) {
+ const bool sticky = *hi << (2*typeWidth - count) | *lo;
+ *lo = *hi >> (count - typeWidth) | sticky;
+ *hi = 0;
+ } else {
+ const bool sticky = *hi | *lo;
+ *lo = sticky;
+ *hi = 0;
+ }
+}
+#endif
+
+#endif // FP_LIB_HEADER
diff --git a/StdLib/LibC/Main/Arm/int_endianness.h b/StdLib/LibC/Main/Arm/int_endianness.h
new file mode 100644
index 0000000..f2dd973
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/int_endianness.h
@@ -0,0 +1,71 @@
+/** @file
+*
+* Copyright (c) 2013 - 2014, ARM Limited. All rights reserved.
+*
+* 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.
+*
+**/
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#ifndef INT_ENDIANNESS_H
+#define INT_ENDIANNESS_H
+
+#include <sys/endian.h>
+
+#if _BYTE_ORDER == _BIG_ENDIAN
+#define _YUGA_LITTLE_ENDIAN 0
+#define _YUGA_BIG_ENDIAN 1
+#elif _BYTE_ORDER == _LITTLE_ENDIAN
+#define _YUGA_LITTLE_ENDIAN 1
+#define _YUGA_BIG_ENDIAN 0
+#endif /* _BYTE_ORDER */
+
+#endif /* INT_ENDIANNESS_H */
diff --git a/StdLib/LibC/Main/Arm/int_lib.h b/StdLib/LibC/Main/Arm/int_lib.h
new file mode 100644
index 0000000..460cf8b
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/int_lib.h
@@ -0,0 +1,105 @@
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#ifndef INT_LIB_H
+#define INT_LIB_H
+
+/* Assumption: Signed integral is 2's complement. */
+/* Assumption: Right shift of signed negative is arithmetic shift. */
+/* Assumption: Endianness is little or big (not mixed). */
+
+/* ABI macro definitions */
+
+/*
+ * TODO define this appropriately for targets that require explicit export
+ * declarations (i.e. Windows)
+ */
+#define COMPILER_RT_EXPORT
+
+#if __ARM_EABI__
+# define ARM_EABI_FNALIAS(aeabi_name, name) \
+ void __aeabi_##aeabi_name() __attribute__((alias("__" #name)));
+# define COMPILER_RT_ABI COMPILER_RT_EXPORT __attribute__((pcs("aapcs")))
+#else
+# define ARM_EABI_FNALIAS(aeabi_name, name)
+# define COMPILER_RT_ABI COMPILER_RT_EXPORT
+#endif
+
+#if defined(__NetBSD__) && (defined(_KERNEL) || defined(_STANDALONE))
+/*
+ * Kernel and boot environment can't use normal headers,
+ * so use the equivalent system headers.
+ */
+# include <machine/limits.h>
+# include <sys/stdint.h>
+# include <sys/types.h>
+#else
+/* Include the standard compiler builtin headers we use functionality from. */
+# include <limits.h>
+# include <stdint.h>
+# include <stdbool.h>
+# include <float.h>
+#endif
+
+/* Include the commonly used internal type definitions. */
+#include "int_types.h"
+
+/* Include internal utility function declarations. */
+#include "int_util.h"
+
+COMPILER_RT_ABI si_int __paritysi2(si_int a);
+COMPILER_RT_ABI si_int __paritydi2(di_int a);
+
+COMPILER_RT_ABI di_int __divdi3(di_int a, di_int b);
+COMPILER_RT_ABI si_int __divsi3(si_int a, si_int b);
+COMPILER_RT_ABI su_int __udivsi3(su_int n, su_int d);
+
+COMPILER_RT_ABI su_int __udivmodsi4(su_int a, su_int b, su_int* rem);
+COMPILER_RT_ABI du_int __udivmoddi4(du_int a, du_int b, du_int* rem);
+#ifdef CRT_HAS_128BIT
+COMPILER_RT_ABI si_int __clzti2(ti_int a);
+COMPILER_RT_ABI tu_int __udivmodti4(tu_int a, tu_int b, tu_int* rem);
+#endif
+
+#endif /* INT_LIB_H */
diff --git a/StdLib/LibC/Main/Arm/int_types.h b/StdLib/LibC/Main/Arm/int_types.h
new file mode 100644
index 0000000..8a4e1a3
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/int_types.h
@@ -0,0 +1,170 @@
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#ifndef INT_TYPES_H
+#define INT_TYPES_H
+
+#include "int_endianness.h"
+
+typedef int si_int;
+typedef unsigned su_int;
+
+typedef long long di_int;
+typedef unsigned long long du_int;
+
+typedef union
+{
+ di_int all;
+ struct
+ {
+#if _YUGA_LITTLE_ENDIAN
+ su_int low;
+ si_int high;
+#else
+ si_int high;
+ su_int low;
+#endif /* _YUGA_LITTLE_ENDIAN */
+ }s;
+} dwords;
+
+typedef union
+{
+ du_int all;
+ struct
+ {
+#if _YUGA_LITTLE_ENDIAN
+ su_int low;
+ su_int high;
+#else
+ su_int high;
+ su_int low;
+#endif /* _YUGA_LITTLE_ENDIAN */
+ }s;
+} udwords;
+
+#if __LP64__
+#define CRT_HAS_128BIT
+#endif
+
+#ifdef CRT_HAS_128BIT
+typedef int ti_int __attribute__ ((mode (TI)));
+typedef unsigned tu_int __attribute__ ((mode (TI)));
+
+typedef union
+{
+ ti_int all;
+ struct
+ {
+#if _YUGA_LITTLE_ENDIAN
+ du_int low;
+ di_int high;
+#else
+ di_int high;
+ du_int low;
+#endif /* _YUGA_LITTLE_ENDIAN */
+ }s;
+} twords;
+
+typedef union
+{
+ tu_int all;
+ struct
+ {
+#if _YUGA_LITTLE_ENDIAN
+ du_int low;
+ du_int high;
+#else
+ du_int high;
+ du_int low;
+#endif /* _YUGA_LITTLE_ENDIAN */
+ }s;
+} utwords;
+
+static inline ti_int make_ti(di_int h, di_int l) {
+ twords r;
+ r.s.high = h;
+ r.s.low = l;
+ return r.all;
+}
+
+static inline tu_int make_tu(du_int h, du_int l) {
+ utwords r;
+ r.s.high = h;
+ r.s.low = l;
+ return r.all;
+}
+
+#endif /* CRT_HAS_128BIT */
+
+typedef union
+{
+ su_int u;
+ float f;
+} float_bits;
+
+typedef union
+{
+ udwords u;
+ double f;
+} double_bits;
+
+typedef struct
+{
+#if _YUGA_LITTLE_ENDIAN
+ udwords low;
+ udwords high;
+#else
+ udwords high;
+ udwords low;
+#endif /* _YUGA_LITTLE_ENDIAN */
+} uqwords;
+
+typedef union
+{
+ uqwords u;
+ long double f;
+} long_double_bits;
+
+#endif /* INT_TYPES_H */
+
diff --git a/StdLib/LibC/Main/Arm/int_util.h b/StdLib/LibC/Main/Arm/int_util.h
new file mode 100644
index 0000000..19a26ea
--- /dev/null
+++ b/StdLib/LibC/Main/Arm/int_util.h
@@ -0,0 +1,68 @@
+/** @file
+
+ Copyright (c) 2014, ARM Limited. All rights reserved.
+
+ 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.
+
+**/
+/**
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
+
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal with
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+of the Software, and to permit persons to whom the Software is furnished to do
+so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimers in the
+ documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at
+ Urbana-Champaign, nor the names of its contributors may be used to
+ endorse or promote products derived from this Software without specific
+ prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+SOFTWARE.
+**/
+
+#ifndef INT_UTIL_H
+#define INT_UTIL_H
+
+/** \brief Trigger a program abort (or panic for kernel code). */
+#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
+ __func__)
+
+void compilerrt_abort_impl(const char *file, int line,
+ const char *function) __attribute__((noreturn));
+
+#endif /* INT_UTIL_H */
--
2.1.1
Olivier Martin
2015-07-16 13:52:06 UTC
Permalink
From: Brendan Jackman <***@arm.com>

- Use some files from ARM version.
- Use NetBSD software floating point library to provide floating point
operations not handled directly by hardware floating point enabled
GCC compiler.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Harry Liebel <***@arm.com>
Reviewed-by: Olivier Martin <***@arm.com>
---
StdLib/Include/Aarch64/arm-gcc.h | 110 +++++++++
StdLib/Include/Aarch64/machine/ansi.h | 106 ++++++++
StdLib/Include/Aarch64/machine/bswap.h | 13 +
StdLib/Include/Aarch64/machine/byte_swap.h | 63 +++++
StdLib/Include/Aarch64/machine/endian.h | 3 +
StdLib/Include/Aarch64/machine/endian_machdep.h | 3 +
StdLib/Include/Aarch64/machine/fenv.h | 39 +++
StdLib/Include/Aarch64/machine/float.h | 59 +++++
StdLib/Include/Aarch64/machine/ieee.h | 31 +++
StdLib/Include/Aarch64/machine/ieeefp.h | 45 ++++
StdLib/Include/Aarch64/machine/int_const.h | 63 +++++
StdLib/Include/Aarch64/machine/int_limits.h | 127 ++++++++++
StdLib/Include/Aarch64/machine/int_mwgwtypes.h | 82 ++++++
StdLib/Include/Aarch64/machine/int_types.h | 61 +++++
StdLib/Include/Aarch64/machine/limits.h | 100 ++++++++
StdLib/Include/Aarch64/machine/math.h | 3 +
StdLib/Include/Aarch64/machine/param.h | 124 ++++++++++
StdLib/Include/Aarch64/machine/signal.h | 22 ++
StdLib/Include/Aarch64/machine/types.h | 82 ++++++
StdLib/Include/Aarch64/milieu.h | 52 ++++
StdLib/Include/Aarch64/softfloat.h | 316 ++++++++++++++++++++++++
StdLib/LibC/LibC.inf | 3 +
StdLib/LibC/Softfloat/Softfloat.inf | 11 +-
StdLib/LibC/gdtoa/gdtoa.inf | 4 +
StdLib/StdLib.dec | 3 +
StdLib/StdLib.dsc | 2 +-
StdLib/StdLib.inc | 3 +
27 files changed, 1528 insertions(+), 2 deletions(-)
create mode 100644 StdLib/Include/Aarch64/arm-gcc.h
create mode 100644 StdLib/Include/Aarch64/machine/ansi.h
create mode 100644 StdLib/Include/Aarch64/machine/bswap.h
create mode 100644 StdLib/Include/Aarch64/machine/byte_swap.h
create mode 100644 StdLib/Include/Aarch64/machine/endian.h
create mode 100644 StdLib/Include/Aarch64/machine/endian_machdep.h
create mode 100644 StdLib/Include/Aarch64/machine/fenv.h
create mode 100644 StdLib/Include/Aarch64/machine/float.h
create mode 100644 StdLib/Include/Aarch64/machine/ieee.h
create mode 100644 StdLib/Include/Aarch64/machine/ieeefp.h
create mode 100644 StdLib/Include/Aarch64/machine/int_const.h
create mode 100644 StdLib/Include/Aarch64/machine/int_limits.h
create mode 100644 StdLib/Include/Aarch64/machine/int_mwgwtypes.h
create mode 100644 StdLib/Include/Aarch64/machine/int_types.h
create mode 100644 StdLib/Include/Aarch64/machine/limits.h
create mode 100644 StdLib/Include/Aarch64/machine/math.h
create mode 100644 StdLib/Include/Aarch64/machine/param.h
create mode 100644 StdLib/Include/Aarch64/machine/signal.h
create mode 100644 StdLib/Include/Aarch64/machine/types.h
create mode 100644 StdLib/Include/Aarch64/milieu.h
create mode 100644 StdLib/Include/Aarch64/softfloat.h

diff --git a/StdLib/Include/Aarch64/arm-gcc.h b/StdLib/Include/Aarch64/arm-gcc.h
new file mode 100644
index 0000000..ef0014b
--- /dev/null
+++ b/StdLib/Include/Aarch64/arm-gcc.h
@@ -0,0 +1,110 @@
+/** @file
+
+ Copyright (c) 2014, ARM Limited. All rights reserved.
+
+ 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.
+
+**/
+
+/* $NetBSD: arm-gcc.h,v 1.4 2013/01/26 07:08:14 matt Exp $ */
+
+/*
+-------------------------------------------------------------------------------
+One of the macros `BIGENDIAN' or `LITTLEENDIAN' must be defined.
+-------------------------------------------------------------------------------
+*/
+#define LITTLEENDIAN
+
+/*
+-------------------------------------------------------------------------------
+The macro `BITS64' can be defined to indicate that 64-bit integer types are
+supported by the compiler.
+-------------------------------------------------------------------------------
+*/
+#define BITS64
+
+/*
+-------------------------------------------------------------------------------
+Each of the following `typedef's defines the most convenient type that holds
+integers of at least as many bits as specified. For example, `uint8' should
+be the most convenient type that can hold unsigned integers of as many as
+8 bits. The `flag' type must be able to hold either a 0 or 1. For most
+implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
+to the same as `int'.
+-------------------------------------------------------------------------------
+*/
+typedef int flag;
+typedef int uint8;
+typedef int int8;
+typedef int uint16;
+typedef int int16;
+typedef unsigned int uint32;
+typedef signed int int32;
+#ifdef BITS64
+typedef unsigned long long int uint64;
+typedef signed long long int int64;
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Each of the following `typedef's defines a type that holds integers
+of _exactly_ the number of bits specified. For instance, for most
+implementation of C, `bits16' and `sbits16' should be `typedef'ed to
+`unsigned short int' and `signed short int' (or `short int'), respectively.
+-------------------------------------------------------------------------------
+*/
+typedef unsigned char bits8;
+typedef signed char sbits8;
+typedef unsigned short int bits16;
+typedef signed short int sbits16;
+typedef unsigned int bits32;
+typedef signed int sbits32;
+#ifdef BITS64
+typedef unsigned long long int bits64;
+typedef signed long long int sbits64;
+#endif
+
+#ifdef BITS64
+/*
+-------------------------------------------------------------------------------
+The `LIT64' macro takes as its argument a textual integer literal and
+if necessary ``marks'' the literal as having a 64-bit integer type.
+For example, the GNU C Compiler (`gcc') requires that 64-bit literals be
+appended with the letters `LL' standing for `long long', which is `gcc's
+name for the 64-bit integer type. Some compilers may allow `LIT64' to be
+defined as the identity macro: `#define LIT64( a ) a'.
+-------------------------------------------------------------------------------
+*/
+#define LIT64( a ) a##ULL
+#endif
+
+/*
+-------------------------------------------------------------------------------
+The macro `INLINE' can be used before functions that should be inlined. If
+a compiler does not support explicit inlining, this macro should be defined
+to be `static'.
+-------------------------------------------------------------------------------
+*/
+#define INLINE static inline
+
+/*
+-------------------------------------------------------------------------------
+The ARM FPA is odd in that it stores doubles high-order word first, no matter
+what the endianness of the CPU. VFP is sane.
+-------------------------------------------------------------------------------
+*/
+#if defined(SOFTFLOAT_FOR_GCC)
+#if defined(__VFP_FP__)
+#define FLOAT64_DEMANGLE(a) (a)
+#define FLOAT64_MANGLE(a) (a)
+#else
+#define FLOAT64_DEMANGLE(a) (((a) << 32) | ((a) >> 32))
+#define FLOAT64_MANGLE(a) FLOAT64_DEMANGLE(a)
+#endif
+#endif
diff --git a/StdLib/Include/Aarch64/machine/ansi.h b/StdLib/Include/Aarch64/machine/ansi.h
new file mode 100644
index 0000000..8273905
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/ansi.h
@@ -0,0 +1,106 @@
+/** @file
+ Machine dependent ANSI type definitions.
+
+ Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that 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.
+
+ * Copyright (c) 1990, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: @(#)ansi.h 8.2 (Berkeley) 1/4/94
+ NetBSD: ansi.h,v 1.7 2006/10/04 13:51:59 tnozaki Exp
+**/
+#ifndef _ANSI_H_
+#define _ANSI_H_
+
+#include <sys/EfiCdefs.h>
+
+#include <machine/int_types.h>
+
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here. Standard headers
+ * then use:
+ * #ifdef _BSD_SIZE_T_
+ * typedef _BSD_SIZE_T_ size_t;
+ * #undef _BSD_SIZE_T_
+ * #endif
+ */
+#define _BSD_CLOCK_T_ _EFI_CLOCK_T /* clock() */
+#define _BSD_PTRDIFF_T_ _EFI_PTRDIFF_T_ /* ptr1 - ptr2 */
+#define _BSD_SIZE_T_ _EFI_SIZE_T_ /* sizeof() */
+#define _BSD_SSIZE_T_ INTN /* byte count or error */
+#define _BSD_TIME_T_ _EFI_TIME_T /* time() */
+#define _BSD_VA_LIST_ VA_LIST
+#define _BSD_CLOCKID_T_ INT64 /* clockid_t */
+#define _BSD_TIMER_T_ INT64 /* timer_t */
+#define _BSD_SUSECONDS_T_ INT64 /* suseconds_t */
+#define _BSD_USECONDS_T_ UINT64 /* useconds_t */
+
+/*
+ * NOTE: rune_t is not covered by ANSI nor other standards, and should not
+ * be instantiated outside of lib/libc/locale. use wchar_t.
+ *
+ * Runes (wchar_t) is declared to be an ``int'' instead of the more natural
+ * ``unsigned long'' or ``long''. Two things are happening here. It is not
+ * unsigned so that EOF (-1) can be naturally assigned to it and used. Also,
+ * it looks like 10646 will be a 31 bit standard. This means that if your
+ * ints cannot hold 32 bits, you will be in trouble. The reason an int was
+ * chosen over a long is that the is*() and to*() routines take ints (says
+ * ANSI C), but they use _RUNE_T_ instead of int. By changing it here, you
+ * lose a bit of ANSI conformance, but your programs will still work.
+ *
+ * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type. When wchar_t
+ * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains
+ * defined for ctype.h.
+ */
+#define _BSD_WCHAR_T_ _EFI_WCHAR_T /* wchar_t */
+#define _BSD_WINT_T_ _EFI_WINT_T /* wint_t */
+#define _BSD_RUNE_T_ _EFI_WCHAR_T /* rune_t */
+#define _BSD_WCTRANS_T_ void * /* wctrans_t */
+#define _BSD_WCTYPE_T_ unsigned int /* wctype_t */
+
+/*
+ * mbstate_t is an opaque object to keep conversion state, during multibyte
+ * stream conversions. The content must not be referenced by user programs.
+ */
+typedef struct {
+ UINT32 A; // Np;
+ UINT32 B; // U;
+ UINT32 E; // L
+ UINT8 C[4]; // n[4]
+ UINT16 D[2]; // w[2]
+} __mbstate_t;
+#define _BSD_MBSTATE_T_ __mbstate_t /* mbstate_t */
+
+#endif /* _ANSI_H_ */
diff --git a/StdLib/Include/Aarch64/machine/bswap.h b/StdLib/Include/Aarch64/machine/bswap.h
new file mode 100644
index 0000000..142f739
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/bswap.h
@@ -0,0 +1,13 @@
+/* $NetBSD: bswap.h,v 1.4 2006/01/31 07:49:18 dsl Exp $ */
+
+/* Written by Manuel Bouyer. Public domain */
+
+#ifndef _MACHINE_BSWAP_H_
+#define _MACHINE_BSWAP_H_
+
+#include <machine/byte_swap.h>
+
+#define __BSWAP_RENAME
+#include <sys/bswap.h>
+
+#endif /* !_MACHINE_BSWAP_H_ */
diff --git a/StdLib/Include/Aarch64/machine/byte_swap.h b/StdLib/Include/Aarch64/machine/byte_swap.h
new file mode 100644
index 0000000..8e1272c
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/byte_swap.h
@@ -0,0 +1,63 @@
+/*-
+ * Copyright (c) 1997, 1999, 2002 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Charles M. Hannum, Neil A. Carson, and Jason R. Thorpe.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AARCH64_BYTE_SWAP_H_
+#define _AARCH64_BYTE_SWAP_H_
+
+#ifdef __GNUC__
+#include <sys/types.h>
+__BEGIN_DECLS
+
+#define __BYTE_SWAP_U32_VARIABLE __byte_swap_u32_variable
+static __inline uint32_t
+__byte_swap_u32_variable(uint32_t v)
+{
+ uint32_t t1;
+
+ t1 = v ^ ((v << 16) | (v >> 16));
+ t1 &= 0xff00ffffU;
+ v = (v >> 8) | (v << 24);
+ v ^= (t1 >> 8);
+ return (v);
+}
+
+#define __BYTE_SWAP_U16_VARIABLE __byte_swap_u16_variable
+static __inline uint16_t
+__byte_swap_u16_variable(uint16_t v)
+{
+
+ v &= 0xffff;
+ v = (v >> 8) | (v << 8);
+ return (v);
+}
+
+__END_DECLS
+#endif
+
+#endif /* _AARCH64_BYTE_SWAP_H_ */
diff --git a/StdLib/Include/Aarch64/machine/endian.h b/StdLib/Include/Aarch64/machine/endian.h
new file mode 100644
index 0000000..bb53c0b
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/endian.h
@@ -0,0 +1,3 @@
+/* $NetBSD: endian.h,v 1.3 2001/06/23 12:20:27 bjh21 Exp $ */
+
+#include <sys/endian.h>
diff --git a/StdLib/Include/Aarch64/machine/endian_machdep.h b/StdLib/Include/Aarch64/machine/endian_machdep.h
new file mode 100644
index 0000000..1940786
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/endian_machdep.h
@@ -0,0 +1,3 @@
+/* $NetBSD: endian_machdep.h,v 1.8 2006/01/30 21:52:38 dsl Exp $ */
+
+#define _BYTE_ORDER _LITTLE_ENDIAN
diff --git a/StdLib/Include/Aarch64/machine/fenv.h b/StdLib/Include/Aarch64/machine/fenv.h
new file mode 100644
index 0000000..8e255f5
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/fenv.h
@@ -0,0 +1,39 @@
+/* $NetBSD: fenv.h,v 1.2 2014/01/29 00:22:09 matt Exp $ */
+
+/*
+ * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
+ * Public domain.
+ */
+
+#ifndef _AARCH64_FENV_H_
+#define _AARCH64_FENV_H_
+
+/* AArch64 split FPSCR into two registers FPCR and FPSR */
+typedef struct {
+ unsigned int __fpcr;
+ unsigned int __fpsr;
+} fenv_t;
+typedef int fexcept_t;
+
+#define FE_INVALID 0x01 /* invalid operation exception */
+#define FE_DIVBYZERO 0x02 /* divide-by-zero exception */
+#define FE_OVERFLOW 0x04 /* overflow exception */
+#define FE_UNDERFLOW 0x08 /* underflow exception */
+#define FE_INEXACT 0x10 /* imprecise (loss of precision; "inexact") */
+
+#define FE_ALL_EXCEPT 0x1f
+
+#define FE_TONEAREST 0 /* round to nearest representable number */
+#define FE_UPWARD 1 /* round toward positive infinity */
+#define FE_DOWNWARD 2 /* round toward negative infinity */
+#define FE_TOWARDZERO 3 /* round to zero (truncate) */
+
+__BEGIN_DECLS
+
+/* Default floating-point environment */
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV (&__fe_dfl_env)
+
+__END_DECLS
+
+#endif /* _AARCH64_FENV_H_ */
diff --git a/StdLib/Include/Aarch64/machine/float.h b/StdLib/Include/Aarch64/machine/float.h
new file mode 100644
index 0000000..f1da46c
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/float.h
@@ -0,0 +1,59 @@
+/* $NetBSD: float.h,v 1.6 2005/12/11 12:16:47 christos Exp $ */
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AARCH64_FLOAT_H_
+#define _AARCH64_FLOAT_H_
+
+#ifndef __VFP_FP__
+#define LDBL_MANT_DIG 64
+#define LDBL_EPSILON 1.0842021724855044340E-19L
+#define LDBL_DIG 18
+#define LDBL_MIN_EXP (-16381)
+#define LDBL_MIN 1.6810515715560467531E-4932L
+#define LDBL_MIN_10_EXP (-4931)
+#define LDBL_MAX_EXP 16384
+#define LDBL_MAX 1.1897314953572317650E+4932L
+#define LDBL_MAX_10_EXP 4932
+#endif
+
+#include <sys/float_ieee754.h>
+
+#ifndef __VFP_FP__
+#if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE) && \
+ !defined(_XOPEN_SOURCE) || \
+ ((__STDC_VERSION__ - 0) >= 199901L) || \
+ ((_POSIX_C_SOURCE - 0) >= 200112L) || \
+ ((_XOPEN_SOURCE - 0) >= 600) || \
+ defined(_ISOC99_SOURCE) || defined(_NETBSD_SOURCE)
+#define DECIMAL_DIG 21
+#endif /* !defined(_ANSI_SOURCE) && ... */
+#endif /* !__VFP_FP__ */
+
+#endif /* !_AARCH64_FLOAT_H_ */
diff --git a/StdLib/Include/Aarch64/machine/ieee.h b/StdLib/Include/Aarch64/machine/ieee.h
new file mode 100644
index 0000000..4aa90bd
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/ieee.h
@@ -0,0 +1,31 @@
+/* $NetBSD: ieee.h,v 1.9 2005/12/11 12:16:47 christos Exp $ */
+/*-
+ * Copyright (c) 2008 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <sys/ieee754.h>
diff --git a/StdLib/Include/Aarch64/machine/ieeefp.h b/StdLib/Include/Aarch64/machine/ieeefp.h
new file mode 100644
index 0000000..f37278b
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/ieeefp.h
@@ -0,0 +1,45 @@
+/* $NetBSD: ieeefp.h,v 1.3 2013/04/23 05:42:23 matt Exp $ */
+
+/*
+ * Based on ieeefp.h written by J.T. Conklin, Apr 28, 1995
+ * Public domain.
+ */
+
+#ifndef _AARCH64_IEEEFP_H_
+#define _AARCH64_IEEEFP_H_
+
+#include <LibConfig.h>
+#include <sys/featuretest.h>
+
+#if defined(_NETBSD_SOURCE) || defined(_ISOC99_SOURCE)
+
+#include <machine/fenv.h>
+
+#if !defined(_ISOC99_SOURCE)
+
+/* Exception type (used by fpsetmask() et al.) */
+
+typedef int fp_except;
+
+/* Bit defines for fp_except */
+
+#define FP_X_INV FE_INVALID /* invalid operation exception */
+#define FP_X_DZ FE_DIVBYZERO /* divide-by-zero exception */
+#define FP_X_OFL FE_OVERFLOW /* overflow exception */
+#define FP_X_UFL FE_UNDERFLOW /* underflow exception */
+#define FP_X_IMP FE_INEXACT /* imprecise (prec. loss; "inexact") */
+
+/* Rounding modes */
+
+typedef enum {
+ FP_RN=FE_TONEAREST, /* round to nearest representable number */
+ FP_RP=FE_UPWARD, /* round toward positive infinity */
+ FP_RM=FE_DOWNWARD, /* round toward negative infinity */
+ FP_RZ=FE_TOWARDZERO /* round to zero (truncate) */
+} fp_rnd;
+
+#endif /* !_ISOC99_SOURCE */
+
+#endif /* _NETBSD_SOURCE || _ISOC99_SOURCE */
+
+#endif /* _AARCH64_IEEEFP_H_ */
diff --git a/StdLib/Include/Aarch64/machine/int_const.h b/StdLib/Include/Aarch64/machine/int_const.h
new file mode 100644
index 0000000..22db5cd
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/int_const.h
@@ -0,0 +1,63 @@
+/* $NetBSD: int_const.h,v 1.1 2001/04/14 22:38:38 kleink Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the NetBSD
+ * Foundation, Inc. and its contributors.
+ * 4. Neither the name of The NetBSD Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AARCH64_INT_CONST_H_
+#define _AARCH64_INT_CONST_H_
+
+/*
+ * 7.18.4 Macros for integer constants
+ */
+
+/* 7.18.4.1 Macros for minimum-width integer constants */
+
+#define INT8_C(c) c
+#define INT16_C(c) c
+#define INT32_C(c) c
+#define INT64_C(c) c ## LL
+
+#define UINT8_C(c) c ## U
+#define UINT16_C(c) c ## U
+#define UINT32_C(c) c ## U
+#define UINT64_C(c) c ## ULL
+
+/* 7.18.4.2 Macros for greatest-width integer constants */
+
+#define INTMAX_C(c) c ## LL
+#define UINTMAX_C(c) c ## ULL
+
+#endif /* !_AARCH64_INT_CONST_H_ */
diff --git a/StdLib/Include/Aarch64/machine/int_limits.h b/StdLib/Include/Aarch64/machine/int_limits.h
new file mode 100644
index 0000000..48379a0
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/int_limits.h
@@ -0,0 +1,127 @@
+/* $NetBSD: int_limits.h,v 1.9 2008/08/29 19:08:29 matt Exp $ */
+
+/*-
+ * Copyright (c) 2001 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Klaus Klein.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _AARCH64_INT_LIMITS_H_
+#define _AARCH64_INT_LIMITS_H_
+
+/*
+ * 7.18.2 Limits of specified-width integer types
+ */
+
+/* 7.18.2.1 Limits of exact-width integer types */
+
+/* minimum values of exact-width signed integer types */
+#define INT8_MIN (-0x7f-1) /* int8_t */
+#define INT16_MIN (-0x7fff-1) /* int16_t */
+#define INT32_MIN (-0x7fffffff-1) /* int32_t */
+#define INT64_MIN (-0x7fffffffffffffffLL-1) /* int64_t */
+
+/* maximum values of exact-width signed integer types */
+#define INT8_MAX 0x7f /* int8_t */
+#define INT16_MAX 0x7fff /* int16_t */
+#define INT32_MAX 0x7fffffff /* int32_t */
+#define INT64_MAX 0x7fffffffffffffffLL /* int64_t */
+
+/* maximum values of exact-width unsigned integer types */
+#define UINT8_MAX 0xff /* uint8_t */
+#define UINT16_MAX 0xffff /* uint16_t */
+#define UINT32_MAX 0xffffffffU /* uint32_t */
+#define UINT64_MAX 0xffffffffffffffffULL /* uint64_t */
+
+/* 7.18.2.2 Limits of minimum-width integer types */
+
+/* minimum values of minimum-width signed integer types */
+#define INT_LEAST8_MIN (-0x7f-1) /* int_least8_t */
+#define INT_LEAST16_MIN (-0x7fff-1) /* int_least16_t */
+#define INT_LEAST32_MIN (-0x7fffffff-1) /* int_least32_t */
+#define INT_LEAST64_MIN (-0x7fffffffffffffffLL-1) /* int_least64_t */
+
+/* maximum values of minimum-width signed integer types */
+#define INT_LEAST8_MAX 0x7f /* int_least8_t */
+#define INT_LEAST16_MAX 0x7fff /* int_least16_t */
+#define INT_LEAST32_MAX 0x7fffffff /* int_least32_t */
+#define INT_LEAST64_MAX 0x7fffffffffffffffLL /* int_least64_t */
+
+/* maximum values of minimum-width unsigned integer types */
+#define UINT_LEAST8_MAX 0xff /* uint_least8_t */
+#define UINT_LEAST16_MAX 0xffff /* uint_least16_t */
+#define UINT_LEAST32_MAX 0xffffffffU /* uint_least32_t */
+#define UINT_LEAST64_MAX 0xffffffffffffffffULL /* uint_least64_t */
+
+/* 7.18.2.3 Limits of fastest minimum-width integer types */
+
+/* minimum values of fastest minimum-width signed integer types */
+#define INT_FAST8_MIN (-0x7fffffff-1) /* int_fast8_t */
+#define INT_FAST16_MIN (-0x7fffffff-1) /* int_fast16_t */
+#define INT_FAST32_MIN (-0x7fffffff-1) /* int_fast32_t */
+#define INT_FAST64_MIN (-0x7fffffffffffffffLL-1) /* int_fast64_t */
+
+/* maximum values of fastest minimum-width signed integer types */
+#define INT_FAST8_MAX 0x7fffffff /* int_fast8_t */
+#define INT_FAST16_MAX 0x7fffffff /* int_fast16_t */
+#define INT_FAST32_MAX 0x7fffffff /* int_fast32_t */
+#define INT_FAST64_MAX 0x7fffffffffffffffLL /* int_fast64_t */
+
+/* maximum values of fastest minimum-width unsigned integer types */
+#define UINT_FAST8_MAX 0xffffffffU /* uint_fast8_t */
+#define UINT_FAST16_MAX 0xffffffffU /* uint_fast16_t */
+#define UINT_FAST32_MAX 0xffffffffU /* uint_fast32_t */
+#define UINT_FAST64_MAX 0xffffffffffffffffULL /* uint_fast64_t */
+
+/* 7.18.2.4 Limits of integer types capable of holding object pointers */
+
+#define INTPTR_MIN (-0x7fffffffffffffffLL-1) /* intptr_t */
+#define INTPTR_MAX 0x7fffffffffffffffLL /* intptr_t */
+#define UINTPTR_MAX 0xffffffffffffffffULL /* uintptr_t */
+
+/* 7.18.2.5 Limits of greatest-width integer types */
+
+#define INTMAX_MIN (-0x7fffffffffffffffLL-1) /* intmax_t */
+#define INTMAX_MAX 0x7fffffffffffffffLL /* intmax_t */
+#define UINTMAX_MAX 0xffffffffffffffffULL /* uintmax_t */
+
+
+/*
+ * 7.18.3 Limits of other integer types
+ */
+
+/* limits of ptrdiff_t */
+#define PTRDIFF_MIN (-0x7fffffffffffffffLL-1) /* ptrdiff_t */
+#define PTRDIFF_MAX 0x7fffffffffffffffLL /* ptrdiff_t */
+
+/* limits of sig_atomic_t */
+#define SIG_ATOMIC_MIN (-0x7fffffffffffffffLL-1) /* sig_atomic_t */
+#define SIG_ATOMIC_MAX 0x7fffffffffffffffLL /* sig_atomic_t */
+
+/* limit of size_t */
+#define SIZE_MAX 0xffffffffffffffffULL /* size_t */
+
+#endif /* !_AARCH64_INT_LIMITS_H_ */
diff --git a/StdLib/Include/Aarch64/machine/int_mwgwtypes.h b/StdLib/Include/Aarch64/machine/int_mwgwtypes.h
new file mode 100644
index 0000000..d3a1784
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/int_mwgwtypes.h
@@ -0,0 +1,82 @@
+/** @file
+ Minimum and Greatest Width Integer types.
+
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available under
+ the terms and conditions of the BSD License that 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.
+
+ Portions Copyright (c) 2001 The NetBSD Foundation, Inc.
+ All rights reserved.
+
+ This code is derived from software contributed to The NetBSD Foundation
+ by Klaus Klein.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. All advertising materials mentioning features or use of this software
+ must display the following acknowledgement:
+ This product includes software developed by the NetBSD
+ Foundation, Inc. and its contributors.
+ 4. Neither the name of The NetBSD Foundation nor the names of its
+ contributors may be used to endorse or promote products derived
+ from this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+
+ NetBSD: int_mwgwtypes.h,v 1.5 2005/12/24 20:06:47 perry Exp
+**/
+#ifndef _AARCH64_INT_MWGWTYPES_H_
+#define _AARCH64_INT_MWGWTYPES_H_
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.2 Minimum-width integer types */
+
+typedef CHAR8 int_least8_t;
+typedef UINT8 uint_least8_t;
+typedef INT16 int_least16_t;
+typedef UINT16 uint_least16_t;
+typedef INT32 int_least32_t;
+typedef UINT32 uint_least32_t;
+typedef INT64 int_least64_t;
+typedef UINT64 uint_least64_t;
+
+/* 7.18.1.3 Fastest minimum-width integer types */
+typedef INT32 int_fast8_t;
+typedef UINT32 uint_fast8_t;
+typedef INT32 int_fast16_t;
+typedef UINT32 uint_fast16_t;
+typedef INT32 int_fast32_t;
+typedef UINT32 uint_fast32_t;
+typedef INT64 int_fast64_t;
+typedef UINT64 uint_fast64_t;
+
+/* 7.18.1.5 Greatest-width integer types */
+
+typedef INT64 intmax_t;
+typedef UINT64 uintmax_t;
+
+#endif /* !_AARCH64_INT_MWGWTYPES_H_ */
diff --git a/StdLib/Include/Aarch64/machine/int_types.h b/StdLib/Include/Aarch64/machine/int_types.h
new file mode 100644
index 0000000..2fafff0
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/int_types.h
@@ -0,0 +1,61 @@
+/* $NetBSD: int_types.h,v 1.10 2005/12/24 20:07:10 perry Exp $ */
+
+/*-
+ * Copyright (c) 1990 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: @(#)types.h 7.5 (Berkeley) 3/9/91
+ */
+
+#ifndef _AARCH64_INT_TYPES_H_
+#define _AARCH64_INT_TYPES_H_
+
+#include <sys/EfiCdefs.h>
+
+/*
+ * 7.18.1 Integer types
+ */
+
+/* 7.18.1.1 Exact-width integer types */
+
+typedef INT8 __int8_t;
+typedef UINT8 __uint8_t;
+typedef INT16 __int16_t;
+typedef UINT16 __uint16_t;
+typedef INT32 __int32_t;
+typedef UINT32 __uint32_t;
+typedef INT64 __int64_t;
+typedef UINT64 __uint64_t;
+
+#define __BIT_TYPES_DEFINED__
+
+/* 7.18.1.4 Integer types capable of holding object pointers */
+
+typedef INTN __intptr_t;
+typedef UINTN __uintptr_t;
+
+#endif /* !_AARCH64_INT_TYPES_H_ */
diff --git a/StdLib/Include/Aarch64/machine/limits.h b/StdLib/Include/Aarch64/machine/limits.h
new file mode 100644
index 0000000..dec214d
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/limits.h
@@ -0,0 +1,100 @@
+/* $NetBSD: limits.h,v 1.9 2008/08/29 19:08:29 matt Exp $ */
+
+/*
+ * Copyright (c) 1988 The Regents of the University of California.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * from: @(#)limits.h 7.2 (Berkeley) 6/28/90
+ */
+
+//TODO These values have been chosen during porting with the selection criteria
+//of being different from ARMv7 in the hope of discovering as many bugs as
+//possible as soon as possible. They are NOT authoritative!
+// ... (and should be replaced ASAP with more carefully chosen ones)
+
+#ifndef _AARCH64_LIMITS_H_
+#define _AARCH64_LIMITS_H_
+
+#include <sys/featuretest.h>
+
+#define __CHAR_BIT 8 /* number of bits in a char */
+//#define __MB_LEN_MAX 32 /* no multibyte characters */
+
+#define __SCHAR_MIN (-0x7f-1) /* max value for a signed char */
+#define __SCHAR_MAX 0x7f /* min value for a signed char */
+
+#define __UCHAR_MAX 0xff /* max value for an unsigned char */
+#define __CHAR_MAX 0xff /* max value for a char */
+#define __CHAR_MIN 0 /* min value for a char */
+
+#define __USHRT_MAX 0xffff /* max value for an unsigned short */
+#define __SHRT_MAX 0x7fff /* max value for a short */
+#define __SHRT_MIN (-0x7fff-1) /* min value for a short */
+
+#define __UINT_MAX 0xffffffffU /* max value for an unsigned int */
+#define __INT_MAX 0x7fffffff /* max value for an int */
+#define __INT_MIN (-0x7fffffff-1) /* min value for an int */
+
+#define __ULONG_MAX 0xffffffffffffffffUL /* max value for an unsigned long */
+#define __LONG_MAX 0x7fffffffffffffffL /* max value for a long */
+#define __LONG_MIN (-0x7fffffffffffffffL-1) /* min value for a long */
+
+#if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
+ defined(_NETBSD_SOURCE)
+#define SSIZE_MAX LONG_MAX /* max value for a ssize_t */
+
+#if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) >= 199901L || \
+ defined(_NETBSD_SOURCE)
+#define __ULLONG_MAX 0xffffffffffffffffULL /* max unsigned long long */
+#define __LLONG_MAX 0x7fffffffffffffffLL /* max signed long long */
+#define __LLONG_MIN (-0x7fffffffffffffffLL-1) /* min signed long long */
+#endif
+
+#if defined(_NETBSD_SOURCE)
+#define SIZE_T_MAX LONG_MAX /* max value for a size_t */
+
+#define UQUAD_MAX 0xffffffffffffffffLL /* max unsigned quad */
+#define QUAD_MAX 0x7fffffffffffffffLL /* max signed quad */
+#define QUAD_MIN (-0x7fffffffffffffffLL-1) /* min signed quad */
+
+#endif /* _NETBSD_SOURCE */
+#endif /* _POSIX_C_SOURCE || _XOPEN_SOURCE || _NETBSD_SOURCE */
+
+#if defined(_XOPEN_SOURCE) || defined(_NETBSD_SOURCE)
+#define LONG_BIT 64
+#define WORD_BIT 32
+
+#define DBL_DIG 15
+#define DBL_MAX 1.7976931348623157E+308
+#define DBL_MIN 2.2250738585072014E-308
+
+//#define FLT_DIG 6
+//#define FLT_MAX 3.40282347E+38F
+//#define FLT_MIN 1.17549435E-38F
+#endif
+
+#endif /* _AARCH64_LIMITS_H_ */
diff --git a/StdLib/Include/Aarch64/machine/math.h b/StdLib/Include/Aarch64/machine/math.h
new file mode 100644
index 0000000..35ace3d
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/math.h
@@ -0,0 +1,3 @@
+/* $NetBSD: math.h,v 1.2 2002/02/19 13:08:14 simonb Exp $ */
+
+#define __HAVE_NANF
diff --git a/StdLib/Include/Aarch64/machine/param.h b/StdLib/Include/Aarch64/machine/param.h
new file mode 100644
index 0000000..c7700b3
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/param.h
@@ -0,0 +1,124 @@
+/* $NetBSD: param.h,v 1.13 2010/05/06 19:10:26 joerg Exp $ */
+
+/*
+ * Copyright (c) 1994,1995 Mark Brinicombe.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the RiscBSD team.
+ * 4. The name "RiscBSD" nor the name of the author may be used to
+ * endorse or promote products derived from this software without specific
+ * prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY RISCBSD ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL RISCBSD OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef _AARCH64_PARAM_H_
+#define _AARCH64_PARAM_H_
+
+// TODO: These were based on the ARMv7 version. Verify that it is correct.
+
+/*
+ * Machine dependent constants for all ARM processors
+ */
+
+/*
+ * For KERNEL code:
+ * MACHINE must be defined by the individual port. This is so that
+ * uname returns the correct thing, etc.
+ *
+ * MACHINE_ARCH may be defined by individual ports as a temporary
+ * measure while we're finishing the conversion to ELF.
+ *
+ * For non-KERNEL code:
+ * If ELF, MACHINE and MACHINE_ARCH are forced to "arm/armeb".
+ */
+
+#if defined(_KERNEL)
+#undef _MACHINE
+#undef MACHINE
+#undef _MACHINE_ARCH
+#undef MACHINE_ARCH
+#define _MACHINE aarch64
+#define MACHINE "aarch64"
+#define _MACHINE_ARCH aarch64
+#define MACHINE_ARCH "aarch64"
+#endif /* !_KERNEL */
+
+#define MID_MACHINE MID_AARCH64
+
+/*
+ * Round p (pointer or byte index) up to a correctly-aligned value
+ * for all data types (int, long, ...). The result is u_int and
+ * must be cast to any desired pointer type.
+ *
+ * ALIGNED_POINTER is a boolean macro that checks whether an address
+ * is valid to fetch data elements of type t from on this architecture.
+ * This does not reflect the optimal alignment, just the possibility
+ * (within reasonable limits).
+ *
+ */
+#define ALIGNBYTES (sizeof(int) - 1)
+#define ALIGN(p) (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
+#define ALIGNED_POINTER(p,t) ((((u_long)(p)) & (sizeof(t)-1)) == 0)
+/* ARM-specific macro to align a stack pointer (downwards). */
+#define STACKALIGNBYTES (8 - 1)
+#define STACKALIGN(p) ((u_int)(p) &~ STACKALIGNBYTES)
+
+#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */
+#define DEV_BSIZE (1 << DEV_BSHIFT)
+#define BLKDEV_IOSIZE 2048
+
+#ifndef MAXPHYS
+#define MAXPHYS 65536 /* max I/O transfer size */
+#endif
+
+/*
+ * Constants related to network buffer management.
+ * MCLBYTES must be no larger than NBPG (the software page size), and,
+ * on machines that exchange pages of input or output buffers with mbuf
+ * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
+ * of the hardware page size.
+ */
+#define MSIZE 256 /* size of an mbuf */
+
+#ifndef MCLSHIFT
+#define MCLSHIFT 11 /* convert bytes to m_buf clusters */
+ /* 2K cluster can hold Ether frame */
+#endif /* MCLSHIFT */
+
+#define MCLBYTES (1 << MCLSHIFT) /* size of a m_buf cluster */
+
+#ifndef NMBCLUSTERS_MAX
+#define NMBCLUSTERS_MAX (0x2000000 / MCLBYTES) /* Limit to 64MB for clusters */
+#endif
+
+/*
+ * Compatibility /dev/zero mapping.
+ */
+#ifdef _KERNEL
+#ifdef COMPAT_16
+#define COMPAT_ZERODEV(x) (x == makedev(0, _DEV_ZERO_oARM))
+#endif
+#endif /* _KERNEL */
+
+#endif /* _AARCH64_PARAM_H_ */
diff --git a/StdLib/Include/Aarch64/machine/signal.h b/StdLib/Include/Aarch64/machine/signal.h
new file mode 100644
index 0000000..6628eb9
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/signal.h
@@ -0,0 +1,22 @@
+/**
+Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+This program and the accompanying materials are licensed and made available under
+the terms and conditions of the BSD License that 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.
+
+**/
+#ifndef _MACHINE_SIGNAL_H
+#define _MACHINE_SIGNAL_H
+#include <sys/EfiCdefs.h>
+
+/** The type sig_atomic_t is the (possibly volatile-qualified) integer type of
+ an object that can be accessed as an atomic entity, even in the presence
+ of asynchronous interrupts.
+**/
+typedef INTN sig_atomic_t;
+
+#endif /* _MACHINE_SIGNAL_H */
diff --git a/StdLib/Include/Aarch64/machine/types.h b/StdLib/Include/Aarch64/machine/types.h
new file mode 100644
index 0000000..a59d5be
--- /dev/null
+++ b/StdLib/Include/Aarch64/machine/types.h
@@ -0,0 +1,82 @@
+/** @file
+ Machine dependent type definitions.
+
+ Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials are licensed and made available
+ under the terms and conditions of the BSD License that 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.
+
+ Copyright (c) 1990 The Regents of the University of California.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ 3. Neither the name of the University nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ SUCH DAMAGE.
+
+ types.h 7.5 (Berkeley) 3/9/91
+ NetBSD: types.h,v 1.49 2006/09/03 13:51:23 bjh21 Exp
+**/
+#ifndef _MACHTYPES_H_
+#define _MACHTYPES_H_
+
+#include <sys/EfiCdefs.h>
+#include <sys/featuretest.h>
+#include <machine/int_types.h>
+
+/* Handle the long and unsigned long data types which EFI doesn't directly support. */
+//typedef INTN LONGN;
+//typedef UINTN ULONGN;
+
+typedef PHYSICAL_ADDRESS paddr_t;
+typedef UINT64 psize_t;
+typedef PHYSICAL_ADDRESS vaddr_t;
+typedef UINT64 vsize_t;
+
+typedef INT32 pmc_evid_t;
+typedef UINT64 pmc_ctr_t;
+typedef INT32 register_t;
+
+typedef volatile INT32 __cpu_simple_lock_t;
+
+#define __SIMPLELOCK_LOCKED 1
+#define __SIMPLELOCK_UNLOCKED 0
+
+/* The ARMv7 does not have strict alignment requirements. */
+#define __NO_STRICT_ALIGNMENT
+//TODO: Fixme for the ARM architecture that requires strict alignment
+
+#define __HAVE_DEVICE_REGISTER
+#define __HAVE_CPU_COUNTER
+#define __HAVE_SYSCALL_INTERN
+#define __HAVE_MINIMAL_EMUL
+#define __HAVE_OLD_DISKLABEL
+#define __HAVE_GENERIC_SOFT_INTERRUPTS
+#define __HAVE_CPU_MAXPROC
+#define __HAVE_TIMECOUNTER
+#define __HAVE_GENERIC_TODR
+
+#endif /* _MACHTYPES_H_ */
diff --git a/StdLib/Include/Aarch64/milieu.h b/StdLib/Include/Aarch64/milieu.h
new file mode 100644
index 0000000..73643bf
--- /dev/null
+++ b/StdLib/Include/Aarch64/milieu.h
@@ -0,0 +1,52 @@
+/* $NetBSD: milieu.h,v 1.1 2000/12/29 20:13:54 bjh21 Exp $ */
+
+/*
+===============================================================================
+
+This C header file is part of the SoftFloat IEC/IEEE Floating-point
+Arithmetic Package, Release 2a.
+
+Written by John R. Hauser. This work was made possible in part by the
+International Computer Science Institute, located at Suite 600, 1947 Center
+Street, Berkeley, California 94704. Funding was partially provided by the
+National Science Foundation under grant MIP-9311980. The original version
+of this code was written as part of a project to build a fixed-point vector
+processor in collaboration with the University of California at Berkeley,
+overseen by Profs. Nelson Morgan and John Wawrzynek. More information
+is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
+arithmetic/SoftFloat.html'.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
+AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+
+Derivative works are acceptable, even for commercial purposes, so long as
+(1) they include prominent notice that the work is derivative, and (2) they
+include prominent notice akin to these four paragraphs for those parts of
+this code that are retained.
+
+===============================================================================
+*/
+
+/*
+-------------------------------------------------------------------------------
+Include common integer types and flags.
+-------------------------------------------------------------------------------
+*/
+#include "arm-gcc.h"
+
+
+// Used by profiler.
+#if 0
+/*
+-------------------------------------------------------------------------------
+Symbolic Boolean literals.
+-------------------------------------------------------------------------------
+*/
+enum {
+ FALSE = 0,
+ TRUE = 1
+};
+#endif
diff --git a/StdLib/Include/Aarch64/softfloat.h b/StdLib/Include/Aarch64/softfloat.h
new file mode 100644
index 0000000..c290657
--- /dev/null
+++ b/StdLib/Include/Aarch64/softfloat.h
@@ -0,0 +1,316 @@
+/* $NetBSD: softfloat.h,v 1.10 2013/04/24 18:04:46 matt Exp $ */
+
+/* This is a derivative work. */
+
+/*
+===============================================================================
+
+This C header file is part of the SoftFloat IEC/IEEE Floating-point
+Arithmetic Package, Release 2a.
+
+Written by John R. Hauser. This work was made possible in part by the
+International Computer Science Institute, located at Suite 600, 1947 Center
+Street, Berkeley, California 94704. Funding was partially provided by the
+National Science Foundation under grant MIP-9311980. The original version
+of this code was written as part of a project to build a fixed-point vector
+processor in collaboration with the University of California at Berkeley,
+overseen by Profs. Nelson Morgan and John Wawrzynek. More information
+is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
+arithmetic/SoftFloat.html'.
+
+THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE. Although reasonable effort
+has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
+TIMES RESULT IN INCORRECT BEHAVIOR. USE OF THIS SOFTWARE IS RESTRICTED TO
+PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
+AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
+
+Derivative works are acceptable, even for commercial purposes, so long as
+(1) they include prominent notice that the work is derivative, and (2) they
+include prominent notice akin to these four paragraphs for those parts of
+this code that are retained.
+
+===============================================================================
+*/
+
+/*
+-------------------------------------------------------------------------------
+The macro `FLOATX80' must be defined to enable the extended double-precision
+floating-point format `floatx80'. If this macro is not defined, the
+`floatx80' type will not be defined, and none of the functions that either
+input or output the `floatx80' type will be defined. The same applies to
+the `FLOAT128' macro and the quadruple-precision format `float128'.
+-------------------------------------------------------------------------------
+*/
+/* #define FLOATX80 */
+#define FLOAT128
+
+#include <stdint.h>
+#include <machine/ieeefp.h>
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE floating-point types.
+-------------------------------------------------------------------------------
+*/
+typedef unsigned int float32;
+typedef unsigned long long float64;
+#ifdef FLOATX80
+typedef struct {
+ unsigned short high;
+ unsigned long long low;
+} floatx80;
+#endif
+#ifdef FLOAT128
+typedef struct {
+ unsigned long long high, low;
+} float128;
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE floating-point underflow tininess-detection mode.
+-------------------------------------------------------------------------------
+*/
+#ifndef SOFTFLOAT_FOR_GCC
+extern int float_detect_tininess;
+#endif
+enum {
+ float_tininess_after_rounding = 0,
+ float_tininess_before_rounding = 1
+};
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE floating-point rounding mode.
+-------------------------------------------------------------------------------
+*/
+extern fp_rnd float_rounding_mode;
+#define float_round_nearest_even FP_RN
+#define float_round_to_zero FP_RZ
+#define float_round_down FP_RM
+#define float_round_up FP_RP
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE floating-point exception flags.
+-------------------------------------------------------------------------------
+*/
+extern fp_except float_exception_flags;
+extern fp_except float_exception_mask;
+enum {
+ float_flag_inexact = FP_X_IMP,
+ float_flag_underflow = FP_X_UFL,
+ float_flag_overflow = FP_X_OFL,
+ float_flag_divbyzero = FP_X_DZ,
+ float_flag_invalid = FP_X_INV
+};
+
+/*
+-------------------------------------------------------------------------------
+Routine to raise any or all of the software IEC/IEEE floating-point
+exception flags.
+-------------------------------------------------------------------------------
+*/
+void float_raise( fp_except );
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE integer-to-floating-point conversion routines.
+-------------------------------------------------------------------------------
+*/
+float32 int32_to_float32( int32 );
+float32 uint32_to_float32( uint32 );
+float64 int32_to_float64( int32 );
+float64 uint32_to_float64( uint32 );
+#ifdef FLOATX80
+floatx80 int32_to_floatx80( int32 );
+floatx80 uint32_to_floatx80( uint32 );
+#endif
+#ifdef FLOAT128
+float128 int32_to_float128( int32 );
+float128 uint32_to_float128( uint32 );
+#endif
+#ifndef SOFTFLOAT_FOR_GCC /* __floatdi?f is in libgcc2.c */
+float32 int64_to_float32( long long );
+float64 int64_to_float64( long long );
+#ifdef FLOATX80
+floatx80 int64_to_floatx80( long long );
+#endif
+#ifdef FLOAT128
+float128 int64_to_float128( long long );
+#endif
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE single-precision conversion routines.
+-------------------------------------------------------------------------------
+*/
+int float32_to_int32( float32 );
+int float32_to_int32_round_to_zero( float32 );
+#if defined(SOFTFLOAT_FOR_GCC) && defined(SOFTFLOAT_NEED_FIXUNS)
+unsigned int float32_to_uint32_round_to_zero( float32 );
+#endif
+#ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */
+long long float32_to_int64( float32 );
+long long float32_to_int64_round_to_zero( float32 );
+#endif
+float64 float32_to_float64( float32 );
+#ifdef FLOATX80
+floatx80 float32_to_floatx80( float32 );
+#endif
+#ifdef FLOAT128
+float128 float32_to_float128( float32 );
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE single-precision operations.
+-------------------------------------------------------------------------------
+*/
+float32 float32_round_to_int( float32 );
+float32 float32_add( float32, float32 );
+float32 float32_sub( float32, float32 );
+float32 float32_mul( float32, float32 );
+float32 float32_div( float32, float32 );
+float32 float32_rem( float32, float32 );
+float32 float32_sqrt( float32 );
+int float32_eq( float32, float32 );
+int float32_le( float32, float32 );
+int float32_lt( float32, float32 );
+int float32_eq_signaling( float32, float32 );
+int float32_le_quiet( float32, float32 );
+int float32_lt_quiet( float32, float32 );
+#ifndef SOFTFLOAT_FOR_GCC
+int float32_is_signaling_nan( float32 );
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE double-precision conversion routines.
+-------------------------------------------------------------------------------
+*/
+int float64_to_int32( float64 );
+int float64_to_int32_round_to_zero( float64 );
+#if defined(SOFTFLOAT_FOR_GCC) && defined(SOFTFLOAT_NEED_FIXUNS)
+unsigned int float64_to_uint32_round_to_zero( float64 );
+#endif
+#ifndef SOFTFLOAT_FOR_GCC /* __fix?fdi provided by libgcc2.c */
+long long float64_to_int64( float64 );
+long long float64_to_int64_round_to_zero( float64 );
+#endif
+float32 float64_to_float32( float64 );
+#ifdef FLOATX80
+floatx80 float64_to_floatx80( float64 );
+#endif
+#ifdef FLOAT128
+float128 float64_to_float128( float64 );
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE double-precision operations.
+-------------------------------------------------------------------------------
+*/
+float64 float64_round_to_int( float64 );
+float64 float64_add( float64, float64 );
+float64 float64_sub( float64, float64 );
+float64 float64_mul( float64, float64 );
+float64 float64_div( float64, float64 );
+float64 float64_rem( float64, float64 );
+float64 float64_sqrt( float64 );
+int float64_eq( float64, float64 );
+int float64_le( float64, float64 );
+int float64_lt( float64, float64 );
+int float64_eq_signaling( float64, float64 );
+int float64_le_quiet( float64, float64 );
+int float64_lt_quiet( float64, float64 );
+#ifndef SOFTFLOAT_FOR_GCC
+int float64_is_signaling_nan( float64 );
+#endif
+
+#ifdef FLOATX80
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE extended double-precision conversion routines.
+-------------------------------------------------------------------------------
+*/
+int floatx80_to_int32( floatx80 );
+int floatx80_to_int32_round_to_zero( floatx80 );
+long long floatx80_to_int64( floatx80 );
+long long floatx80_to_int64_round_to_zero( floatx80 );
+float32 floatx80_to_float32( floatx80 );
+float64 floatx80_to_float64( floatx80 );
+#ifdef FLOAT128
+float128 floatx80_to_float128( floatx80 );
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE extended double-precision rounding precision. Valid
+values are 32, 64, and 80.
+-------------------------------------------------------------------------------
+*/
+extern int floatx80_rounding_precision;
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE extended double-precision operations.
+-------------------------------------------------------------------------------
+*/
+floatx80 floatx80_round_to_int( floatx80 );
+floatx80 floatx80_add( floatx80, floatx80 );
+floatx80 floatx80_sub( floatx80, floatx80 );
+floatx80 floatx80_mul( floatx80, floatx80 );
+floatx80 floatx80_div( floatx80, floatx80 );
+floatx80 floatx80_rem( floatx80, floatx80 );
+floatx80 floatx80_sqrt( floatx80 );
+int floatx80_eq( floatx80, floatx80 );
+int floatx80_le( floatx80, floatx80 );
+int floatx80_lt( floatx80, floatx80 );
+int floatx80_eq_signaling( floatx80, floatx80 );
+int floatx80_le_quiet( floatx80, floatx80 );
+int floatx80_lt_quiet( floatx80, floatx80 );
+int floatx80_is_signaling_nan( floatx80 );
+
+#endif
+
+#ifdef FLOAT128
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE quadruple-precision conversion routines.
+-------------------------------------------------------------------------------
+*/
+int float128_to_int32( float128 );
+int float128_to_int32_round_to_zero( float128 );
+long long float128_to_int64( float128 );
+long long float128_to_int64_round_to_zero( float128 );
+float32 float128_to_float32( float128 );
+float64 float128_to_float64( float128 );
+#ifdef FLOATX80
+floatx80 float128_to_floatx80( float128 );
+#endif
+
+/*
+-------------------------------------------------------------------------------
+Software IEC/IEEE quadruple-precision operations.
+-------------------------------------------------------------------------------
+*/
+float128 float128_round_to_int( float128 );
+float128 float128_add( float128, float128 );
+float128 float128_sub( float128, float128 );
+float128 float128_mul( float128, float128 );
+float128 float128_div( float128, float128 );
+float128 float128_rem( float128, float128 );
+float128 float128_sqrt( float128 );
+int float128_eq( float128, float128 );
+int float128_le( float128, float128 );
+int float128_lt( float128, float128 );
+int float128_eq_signaling( float128, float128 );
+int float128_le_quiet( float128, float128 );
+int float128_lt_quiet( float128, float128 );
+int float128_is_signaling_nan( float128 );
+
+#endif
diff --git a/StdLib/LibC/LibC.inf b/StdLib/LibC/LibC.inf
index e44d8a8..f136306 100644
--- a/StdLib/LibC/LibC.inf
+++ b/StdLib/LibC/LibC.inf
@@ -89,6 +89,9 @@
Main/Arm/floatunsidf.c
Main/Arm/flt_rounds.c

+[Sources.AARCH64]
+ Main/Arm/flt_rounds.c
+
[Binaries.IA32]
LIB|Main/Ia32/ftol2.obj|*|MSFT

diff --git a/StdLib/LibC/Softfloat/Softfloat.inf b/StdLib/LibC/Softfloat/Softfloat.inf
index 012190c..99763bc 100644
--- a/StdLib/LibC/Softfloat/Softfloat.inf
+++ b/StdLib/LibC/Softfloat/Softfloat.inf
@@ -22,7 +22,7 @@
LIBRARY_CLASS = LibSoftfloat

#
-# VALID_ARCHITECTURES = ARM
+# VALID_ARCHITECTURES = ARM AARCH64
#

# Only tested with GCC
@@ -43,6 +43,15 @@
Arm/__aeabi_dcmpun.c
Arm/__aeabi_fcmpun.c

+[Sources.AARCH64]
+ bits64/softfloat.c
+ eqtf2.c
+ getf2.c
+ gttf2.c
+ letf2.c
+ lttf2.c
+ netf2.c
+
[Sources]
fpgetround.c
fpsetround.c
diff --git a/StdLib/LibC/gdtoa/gdtoa.inf b/StdLib/LibC/gdtoa/gdtoa.inf
index 48b7df4..a23749a 100644
--- a/StdLib/LibC/gdtoa/gdtoa.inf
+++ b/StdLib/LibC/gdtoa/gdtoa.inf
@@ -46,6 +46,10 @@
strtof.c
Ipf/strtold.c

+[Sources.AARCH64]
+ strtof.c
+ Ipf/strtold.c
+
[Sources]
strtod.c # Public interfaces
atof.c
diff --git a/StdLib/StdLib.dec b/StdLib/StdLib.dec
index 7a0b551..98a5d89 100644
--- a/StdLib/StdLib.dec
+++ b/StdLib/StdLib.dec
@@ -35,6 +35,9 @@
[Includes.ARM]
Include/Arm

+[Includes.AARCH64]
+ Include/Aarch64
+

[Guids]
gStdLibTokenSpaceGuid = { 0x447559f0, 0xd02e, 0x4cf1, { 0x99, 0xbc, 0xca, 0x11, 0x65, 0x40, 0x54, 0xc2 }}
diff --git a/StdLib/StdLib.dsc b/StdLib/StdLib.dsc
index c2842ce..f62d2ad 100644
--- a/StdLib/StdLib.dsc
+++ b/StdLib/StdLib.dsc
@@ -27,7 +27,7 @@
PLATFORM_VERSION = 0.01
DSC_SPECIFICATION = 0x00010006
OUTPUT_DIRECTORY = Build/StdLib
- SUPPORTED_ARCHITECTURES = IA32|X64|ARM
+ SUPPORTED_ARCHITECTURES = IA32|X64|ARM|AARCH64
BUILD_TARGETS = DEBUG|RELEASE|NOOPT
SKUID_IDENTIFIER = DEFAULT

diff --git a/StdLib/StdLib.inc b/StdLib/StdLib.inc
index ac2d5ac..9d540ab 100644
--- a/StdLib/StdLib.inc
+++ b/StdLib/StdLib.inc
@@ -80,6 +80,9 @@
[LibraryClasses.AArch64]
NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+ # Use the softfloat library to cover missing hardfloat operations.
+ NULL|StdLib/LibC/Softfloat/Softfloat.inf
+
# Add support for GCC stack protector
NULL|MdePkg/Library/BaseStackCheckLib/BaseStackCheckLib.inf
--
2.1.1
Daryl McDaniel
2015-07-30 02:21:26 UTC
Permalink
Now that we have received legal approval of the LLVM / University of
Illinois license, I can say that this set of patches looks OK to me.
0. [PATCH 0/4] StdLib: Add ARM SoftFloat & AArch64 supports
1. [PATCH 1/4] StdLib: Added BaseStackLib for ARM architectures
2. [PATCH 2/4] StdLib/LibC: Add software floating point library from
NetBSD
3. [PATCH 3/4] StdLib/LibC: Provide missing ARM symbols
4. [PATCH 4/4] StdLib: Add support for AArch64

Reviewed by: Daryl McDaniel <edk2-***@mc2research.org>

Daryl McDaniel


-----Original Message-----
From: edk2-devel [mailto:edk2-devel-***@lists.01.org] On Behalf Of
Olivier Martin
Sent: Thursday, July 16, 2015 6:52 AM
To: ***@intel.com
Cc: ***@linaro.org; edk2-***@ml01.01.org;
edk2-***@lists.sourceforge.net; Olivier Martin <***@arm.com>
Subject: [edk2] [PATCH 0/4] StdLib: Add ARM SoftFloat & AArch64 supports

This patchset adds support for ARM SoftFloat. ARM Hardware floating point is
disabled when building UEFI Firmware.
Software Floating point is required to get full StdLib support.

This support also adds AArch64 support.

Contributed-under: TianoCore Contribution Agreement 1.0
Reviewed-by: Olivier Martin <***@arm.com>

Brendan Jackman (1):
StdLib: Add support for AArch64

Harry Liebel (2):
StdLib/LibC: Add software floating point library from NetBSD
StdLib/LibC: Provide missing ARM symbols

Olivier Martin (1):
StdLib: Added BaseStackLib for ARM architectures

StdLib/Include/Aarch64/arm-gcc.h | 110 +
StdLib/Include/Aarch64/machine/ansi.h | 106 +
StdLib/Include/Aarch64/machine/bswap.h | 13 +
StdLib/Include/Aarch64/machine/byte_swap.h | 63 +
StdLib/Include/Aarch64/machine/endian.h | 3 +
StdLib/Include/Aarch64/machine/endian_machdep.h | 3 +
StdLib/Include/Aarch64/machine/fenv.h | 39 +
StdLib/Include/Aarch64/machine/float.h | 59 +
StdLib/Include/Aarch64/machine/ieee.h | 31 +
StdLib/Include/Aarch64/machine/ieeefp.h | 45 +
StdLib/Include/Aarch64/machine/int_const.h | 63 +
StdLib/Include/Aarch64/machine/int_limits.h | 127 +
StdLib/Include/Aarch64/machine/int_mwgwtypes.h | 82 +
StdLib/Include/Aarch64/machine/int_types.h | 61 +
StdLib/Include/Aarch64/machine/limits.h | 100 +
StdLib/Include/Aarch64/machine/math.h | 3 +
StdLib/Include/Aarch64/machine/param.h | 124 +
StdLib/Include/Aarch64/machine/signal.h | 22 +
StdLib/Include/Aarch64/machine/types.h | 82 +
StdLib/Include/Aarch64/milieu.h | 52 +
StdLib/Include/Aarch64/softfloat.h | 316 ++
StdLib/Include/Arm/arm-gcc.h | 114 +
StdLib/Include/Arm/machine/fenv.h | 55 +
StdLib/Include/Arm/machine/ieeefp.h | 58 +
StdLib/Include/Arm/milieu.h | 38 +
StdLib/Include/Arm/softfloat.h | 316 ++
StdLib/Include/ieeefp.h | 46 +
StdLib/LibC/LibC.inf | 5 +
StdLib/LibC/Main/Arm/fixunsdfsi.c | 74 +
StdLib/LibC/Main/Arm/floatunsidf.c | 71 +
StdLib/LibC/Main/Arm/fp_lib.h | 282 +
StdLib/LibC/Main/Arm/int_endianness.h | 71 +
StdLib/LibC/Main/Arm/int_lib.h | 105 +
StdLib/LibC/Main/Arm/int_types.h | 170 +
StdLib/LibC/Main/Arm/int_util.h | 68 +
StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c | 35 +
StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c | 42 +
StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c | 37 +
StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c | 42 +
StdLib/LibC/Softfloat/Makefile.inc | 42 +
StdLib/LibC/Softfloat/README.NetBSD | 8 +
StdLib/LibC/Softfloat/README.txt | 39 +
StdLib/LibC/Softfloat/Softfloat.inf | 74 +
StdLib/LibC/Softfloat/bits32/softfloat-macros | 648 +++
StdLib/LibC/Softfloat/bits32/softfloat.c | 2355 ++++++++
StdLib/LibC/Softfloat/bits64/softfloat-macros | 745 +++
StdLib/LibC/Softfloat/bits64/softfloat.c | 5602
++++++++++++++++++++
StdLib/LibC/Softfloat/eqdf2.c | 38 +
StdLib/LibC/Softfloat/eqsf2.c | 38 +
StdLib/LibC/Softfloat/eqtf2.c | 40 +
StdLib/LibC/Softfloat/fpgetmask.c | 55 +
StdLib/LibC/Softfloat/fpgetround.c | 55 +
StdLib/LibC/Softfloat/fpgetsticky.c | 55 +
StdLib/LibC/Softfloat/fpsetmask.c | 60 +
StdLib/LibC/Softfloat/fpsetround.c | 60 +
StdLib/LibC/Softfloat/fpsetsticky.c | 60 +
StdLib/LibC/Softfloat/gedf2.c | 38 +
StdLib/LibC/Softfloat/gesf2.c | 38 +
StdLib/LibC/Softfloat/getf2.c | 40 +
StdLib/LibC/Softfloat/gexf2.c | 39 +
StdLib/LibC/Softfloat/gtdf2.c | 36 +
StdLib/LibC/Softfloat/gtsf2.c | 36 +
StdLib/LibC/Softfloat/gttf2.c | 40 +
StdLib/LibC/Softfloat/gtxf2.c | 39 +
StdLib/LibC/Softfloat/ledf2.c | 36 +
StdLib/LibC/Softfloat/lesf2.c | 36 +
StdLib/LibC/Softfloat/letf2.c | 40 +
StdLib/LibC/Softfloat/ltdf2.c | 36 +
StdLib/LibC/Softfloat/ltsf2.c | 36 +
StdLib/LibC/Softfloat/lttf2.c | 40 +
StdLib/LibC/Softfloat/nedf2.c | 36 +
StdLib/LibC/Softfloat/negdf2.c | 36 +
StdLib/LibC/Softfloat/negsf2.c | 36 +
StdLib/LibC/Softfloat/negtf2.c | 41 +
StdLib/LibC/Softfloat/negxf2.c | 39 +
StdLib/LibC/Softfloat/nesf2.c | 36 +
StdLib/LibC/Softfloat/netf2.c | 40 +
StdLib/LibC/Softfloat/nexf2.c | 39 +
StdLib/LibC/Softfloat/softfloat-for-gcc.h | 242 +
StdLib/LibC/Softfloat/softfloat-history.txt | 52 +
StdLib/LibC/Softfloat/softfloat-source.txt | 383 ++
StdLib/LibC/Softfloat/softfloat-specialize | 529 ++
StdLib/LibC/Softfloat/softfloat.txt | 372 ++
StdLib/LibC/Softfloat/templates/milieu.h | 48 +
.../LibC/Softfloat/templates/softfloat-specialize | 464 ++
StdLib/LibC/Softfloat/templates/softfloat.h | 290 +
StdLib/LibC/Softfloat/timesoftfloat.c | 2641 +++++++++
StdLib/LibC/Softfloat/timesoftfloat.txt | 149 +
StdLib/LibC/Softfloat/unorddf2.c | 40 +
StdLib/LibC/Softfloat/unordsf2.c | 40 +
StdLib/LibC/Softfloat/unordtf2.c | 44 +
StdLib/LibC/gdtoa/gdtoa.inf | 4 +
StdLib/StdLib.dec | 3 +
StdLib/StdLib.dsc | 2 +-
StdLib/StdLib.inc | 10 +
103 files changed, 19548 insertions(+), 1 deletion(-) create mode 100644
StdLib/Include/Aarch64/arm-gcc.h create mode 100644
StdLib/Include/Aarch64/machine/ansi.h
create mode 100644 StdLib/Include/Aarch64/machine/bswap.h
create mode 100644 StdLib/Include/Aarch64/machine/byte_swap.h
create mode 100644 StdLib/Include/Aarch64/machine/endian.h
create mode 100644 StdLib/Include/Aarch64/machine/endian_machdep.h
create mode 100644 StdLib/Include/Aarch64/machine/fenv.h
create mode 100644 StdLib/Include/Aarch64/machine/float.h
create mode 100644 StdLib/Include/Aarch64/machine/ieee.h
create mode 100644 StdLib/Include/Aarch64/machine/ieeefp.h
create mode 100644 StdLib/Include/Aarch64/machine/int_const.h
create mode 100644 StdLib/Include/Aarch64/machine/int_limits.h
create mode 100644 StdLib/Include/Aarch64/machine/int_mwgwtypes.h
create mode 100644 StdLib/Include/Aarch64/machine/int_types.h
create mode 100644 StdLib/Include/Aarch64/machine/limits.h
create mode 100644 StdLib/Include/Aarch64/machine/math.h
create mode 100644 StdLib/Include/Aarch64/machine/param.h
create mode 100644 StdLib/Include/Aarch64/machine/signal.h
create mode 100644 StdLib/Include/Aarch64/machine/types.h
create mode 100644 StdLib/Include/Aarch64/milieu.h create mode 100644
StdLib/Include/Aarch64/softfloat.h
create mode 100644 StdLib/Include/Arm/arm-gcc.h create mode 100644
StdLib/Include/Arm/machine/fenv.h create mode 100644
StdLib/Include/Arm/machine/ieeefp.h
create mode 100644 StdLib/Include/Arm/milieu.h create mode 100644
StdLib/Include/Arm/softfloat.h create mode 100644 StdLib/Include/ieeefp.h
create mode 100644 StdLib/LibC/Main/Arm/fixunsdfsi.c create mode 100644
StdLib/LibC/Main/Arm/floatunsidf.c
create mode 100644 StdLib/LibC/Main/Arm/fp_lib.h create mode 100644
StdLib/LibC/Main/Arm/int_endianness.h
create mode 100644 StdLib/LibC/Main/Arm/int_lib.h create mode 100644
StdLib/LibC/Main/Arm/int_types.h create mode 100644
StdLib/LibC/Main/Arm/int_util.h create mode 100644
StdLib/LibC/Softfloat/Arm/__aeabi_dcmpeq.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpge.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpgt.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmple.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmplt.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_dcmpun.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpeq.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpge.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpgt.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmple.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmplt.c
create mode 100644 StdLib/LibC/Softfloat/Arm/__aeabi_fcmpun.c
create mode 100644 StdLib/LibC/Softfloat/Makefile.inc
create mode 100644 StdLib/LibC/Softfloat/README.NetBSD
create mode 100644 StdLib/LibC/Softfloat/README.txt create mode 100644
StdLib/LibC/Softfloat/Softfloat.inf
create mode 100644 StdLib/LibC/Softfloat/bits32/softfloat-macros
create mode 100644 StdLib/LibC/Softfloat/bits32/softfloat.c
create mode 100644 StdLib/LibC/Softfloat/bits64/softfloat-macros
create mode 100644 StdLib/LibC/Softfloat/bits64/softfloat.c
create mode 100644 StdLib/LibC/Softfloat/eqdf2.c create mode 100644
StdLib/LibC/Softfloat/eqsf2.c create mode 100644
StdLib/LibC/Softfloat/eqtf2.c create mode 100644
StdLib/LibC/Softfloat/fpgetmask.c create mode 100644
StdLib/LibC/Softfloat/fpgetround.c
create mode 100644 StdLib/LibC/Softfloat/fpgetsticky.c
create mode 100644 StdLib/LibC/Softfloat/fpsetmask.c create mode 100644
StdLib/LibC/Softfloat/fpsetround.c
create mode 100644 StdLib/LibC/Softfloat/fpsetsticky.c
create mode 100644 StdLib/LibC/Softfloat/gedf2.c create mode 100644
StdLib/LibC/Softfloat/gesf2.c create mode 100644
StdLib/LibC/Softfloat/getf2.c create mode 100644
StdLib/LibC/Softfloat/gexf2.c create mode 100644
StdLib/LibC/Softfloat/gtdf2.c create mode 100644
StdLib/LibC/Softfloat/gtsf2.c create mode 100644
StdLib/LibC/Softfloat/gttf2.c create mode 100644
StdLib/LibC/Softfloat/gtxf2.c create mode 100644
StdLib/LibC/Softfloat/ledf2.c create mode 100644
StdLib/LibC/Softfloat/lesf2.c create mode 100644
StdLib/LibC/Softfloat/letf2.c create mode 100644
StdLib/LibC/Softfloat/ltdf2.c create mode 100644
StdLib/LibC/Softfloat/ltsf2.c create mode 100644
StdLib/LibC/Softfloat/lttf2.c create mode 100644
StdLib/LibC/Softfloat/nedf2.c create mode 100644
StdLib/LibC/Softfloat/negdf2.c create mode 100644
StdLib/LibC/Softfloat/negsf2.c create mode 100644
StdLib/LibC/Softfloat/negtf2.c create mode 100644
StdLib/LibC/Softfloat/negxf2.c create mode 100644
StdLib/LibC/Softfloat/nesf2.c create mode 100644
StdLib/LibC/Softfloat/netf2.c create mode 100644
StdLib/LibC/Softfloat/nexf2.c create mode 100644
StdLib/LibC/Softfloat/softfloat-for-gcc.h
create mode 100644 StdLib/LibC/Softfloat/softfloat-history.txt
create mode 100644 StdLib/LibC/Softfloat/softfloat-source.txt
create mode 100644 StdLib/LibC/Softfloat/softfloat-specialize
create mode 100644 StdLib/LibC/Softfloat/softfloat.txt
create mode 100644 StdLib/LibC/Softfloat/templates/milieu.h
create mode 100644 StdLib/LibC/Softfloat/templates/softfloat-specialize
create mode 100644 StdLib/LibC/Softfloat/templates/softfloat.h
create mode 100644 StdLib/LibC/Softfloat/timesoftfloat.c
create mode 100644 StdLib/LibC/Softfloat/timesoftfloat.txt
create mode 100644 StdLib/LibC/Softfloat/unorddf2.c create mode 100644
StdLib/LibC/Softfloat/unordsf2.c create mode 100644
StdLib/LibC/Softfloat/unordtf2.c

--
2.1.1

_______________________________________________
edk2-devel mailing list
edk2-***@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


------------------------------------------------------------------------------
Loading...