StdLib: Patches and updates for ARM.

Add ARMGCC and RVCT toolchain support.
Update and Add ARM specific machine headers.
Set the empty macro for __warn_references().
Make __flt_rounds() return 'Round to nearest' by default on ARM.

Signed-off-by:  Olivier Martin [olivier.martin@arm.com]
Reviewed-by:    darylm503


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12367 6f19259b-4bc3-4df7-8a09-765794883524
diff --git a/StdLib/Include/Arm/machine/ansi.h b/StdLib/Include/Arm/machine/ansi.h
index e06f111..4c9e65a 100644
--- a/StdLib/Include/Arm/machine/ansi.h
+++ b/StdLib/Include/Arm/machine/ansi.h
@@ -1,8 +1,8 @@
-/*	$NetBSD: ansi.h,v 1.7 2006/10/04 13:51:59 tnozaki Exp $	*/

+/*  $NetBSD: ansi.h,v 1.7 2006/10/04 13:51:59 tnozaki Exp $ */

 

 /*

  * Copyright (c) 1990, 1993

- *	The Regents of the University of California.  All rights reserved.

+ *  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

@@ -28,13 +28,13 @@
  * 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

+ *  from: @(#)ansi.h  8.2 (Berkeley) 1/4/94

  */

 

-#ifndef	_ANSI_H_

-#define	_ANSI_H_

+#ifndef _ANSI_H_

+#define _ANSI_H_

 

-#include <sys/cdefs.h>

+#include <sys/EfiCdefs.h>

 

 #include <machine/int_types.h>

 

@@ -42,33 +42,21 @@
  * 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

+ *  #ifdef  _BSD_SIZE_T_

+ *  typedef _BSD_SIZE_T_ size_t;

+ *  #undef  _BSD_SIZE_T_

+ *  #endif

  */

-#ifdef __ELF__

-#define	_BSD_CLOCK_T_		unsigned int	/* clock() */

-#define	_BSD_PTRDIFF_T_		long int	/* ptr1 - ptr2 */

-#define	_BSD_SIZE_T_		unsigned long int /* sizeof() */

-#define	_BSD_SSIZE_T_		long int	/* byte count or error */

-#define	_BSD_TIME_T_		int		/* time() */

-#else

-#define	_BSD_CLOCK_T_		unsigned long	/* clock() */

-#define	_BSD_PTRDIFF_T_		int		/* ptr1 - ptr2 */

-#define	_BSD_SIZE_T_		unsigned int	/* sizeof() */

-#define	_BSD_SSIZE_T_		int		/* byte count or error */

-#define	_BSD_TIME_T_		long		/* time() */

-#endif

-#if __GNUC_PREREQ__(2, 96)

-#define	_BSD_VA_LIST_		__builtin_va_list /* GCC built-in type */

-#else

-#define	_BSD_VA_LIST_		char *		/* va_list */

-#endif

-#define	_BSD_CLOCKID_T_		int		/* clockid_t */

-#define	_BSD_TIMER_T_		int		/* timer_t */

-#define	_BSD_SUSECONDS_T_	int		/* suseconds_t */

-#define	_BSD_USECONDS_T_	unsigned int	/* useconds_t */

+#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

@@ -82,25 +70,25 @@
  * 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_		int		/* wchar_t */

-#define	_BSD_WINT_T_		int		/* wint_t */

-#define	_BSD_RUNE_T_		int		/* rune_t */

-#define _BSD_WCTRANS_T_		void *		/* wctrans_t */

-#define _BSD_WCTYPE_T_		void *		/* wctype_t */

+#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 union {

-	__int64_t __mbstateL;	/* for alignment */

-	char __mbstate8[128];

+  __int64_t __mbstateL; /* for alignment */

+  char __mbstate8[128];

 } __mbstate_t;

-#define	_BSD_MBSTATE_T_		__mbstate_t	/* mbstate_t */

+#define _BSD_MBSTATE_T_   __mbstate_t /* mbstate_t */

 

-#endif	/* _ANSI_H_ */

+#endif  /* _ANSI_H_ */

diff --git a/StdLib/Include/Arm/machine/bswap.h b/StdLib/Include/Arm/machine/bswap.h
new file mode 100644
index 0000000..b486b37
--- /dev/null
+++ b/StdLib/Include/Arm/machine/bswap.h
@@ -0,0 +1,11 @@
+/*      $NetBSD: bswap.h,v 1.4 2006/01/31 07:49:18 dsl Exp $      */

+

+#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/Arm/machine/byte_swap.h b/StdLib/Include/Arm/machine/byte_swap.h
new file mode 100644
index 0000000..2a02645
--- /dev/null
+++ b/StdLib/Include/Arm/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 _ARM_BYTE_SWAP_H_

+#define _ARM_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 /* _ARM_BYTE_SWAP_H_ */

diff --git a/StdLib/Include/Arm/machine/endian.h b/StdLib/Include/Arm/machine/endian.h
new file mode 100644
index 0000000..bb53c0b
--- /dev/null
+++ b/StdLib/Include/Arm/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/Arm/machine/endian_machdep.h b/StdLib/Include/Arm/machine/endian_machdep.h
new file mode 100644
index 0000000..abe2b40
--- /dev/null
+++ b/StdLib/Include/Arm/machine/endian_machdep.h
@@ -0,0 +1,8 @@
+/* $NetBSD: endian_machdep.h,v 1.8 2006/01/30 21:52:38 dsl Exp $ */

+

+/* GCC predefines __ARMEB__ when building for big-endian ARM. */

+#ifdef __ARMEB__

+#define _BYTE_ORDER _BIG_ENDIAN

+#else

+#define _BYTE_ORDER _LITTLE_ENDIAN

+#endif

diff --git a/StdLib/Include/Arm/machine/int_const.h b/StdLib/Include/Arm/machine/int_const.h
new file mode 100644
index 0000000..f3a22f6
--- /dev/null
+++ b/StdLib/Include/Arm/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 _ARM_INT_CONST_H_

+#define _ARM_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 /* !_ARM_INT_CONST_H_ */

diff --git a/StdLib/Include/Arm/machine/int_limits.h b/StdLib/Include/Arm/machine/int_limits.h
new file mode 100644
index 0000000..c15eb7f
--- /dev/null
+++ b/StdLib/Include/Arm/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 _ARM_INT_LIMITS_H_

+#define _ARM_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      (-0x7fffffffL-1)                /* intptr_t       */

+#define INTPTR_MAX      0x7fffffffL                     /* intptr_t       */

+#define UINTPTR_MAX     0xffffffffUL                    /* 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     (-0x7fffffffL-1)                /* ptrdiff_t      */

+#define PTRDIFF_MAX     0x7fffffffL                     /* ptrdiff_t      */

+

+/* limits of sig_atomic_t */

+#define SIG_ATOMIC_MIN  (-0x7fffffff-1)                 /* sig_atomic_t   */

+#define SIG_ATOMIC_MAX  0x7fffffff                      /* sig_atomic_t   */

+

+/* limit of size_t */

+#define SIZE_MAX        0xffffffffUL                    /* size_t         */

+

+#endif /* !_ARM_INT_LIMITS_H_ */

diff --git a/StdLib/Include/Arm/machine/int_mwgwtypes.h b/StdLib/Include/Arm/machine/int_mwgwtypes.h
new file mode 100644
index 0000000..c9a4917
--- /dev/null
+++ b/StdLib/Include/Arm/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 _ARM_INT_MWGWTYPES_H_

+#define _ARM_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 /* !_ARM_INT_MWGWTYPES_H_ */

diff --git a/StdLib/Include/Arm/machine/int_types.h b/StdLib/Include/Arm/machine/int_types.h
new file mode 100644
index 0000000..cebebe3
--- /dev/null
+++ b/StdLib/Include/Arm/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 _ARM_INT_TYPES_H_

+#define _ARM_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  /* !_ARM_INT_TYPES_H_ */

diff --git a/StdLib/Include/Arm/machine/limits.h b/StdLib/Include/Arm/machine/limits.h
new file mode 100644
index 0000000..5caa9a1
--- /dev/null
+++ b/StdLib/Include/Arm/machine/limits.h
@@ -0,0 +1,95 @@
+/*      $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

+ */

+

+#ifndef _ARM32_LIMITS_H_

+#define _ARM32_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       0xffffffffUL    /* max value for an unsigned long */

+#define __LONG_MAX        0x7fffffffL     /* max value for a long */

+#define __LONG_MIN        (-0x7fffffffL-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        32

+#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  /* _ARM32_LIMITS_H_ */

diff --git a/StdLib/Include/Arm/machine/param.h b/StdLib/Include/Arm/machine/param.h
new file mode 100644
index 0000000..ac76253
--- /dev/null
+++ b/StdLib/Include/Arm/machine/param.h
@@ -0,0 +1,137 @@
+/*      $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 _ARM_PARAM_H_

+#define _ARM_PARAM_H_

+

+/*

+ * 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)

+#ifndef MACHINE_ARCH                    /* XXX For now */

+#ifndef __ARMEB__

+#define _MACHINE_ARCH   arm

+#define MACHINE_ARCH    "arm"

+#else

+#define _MACHINE_ARCH   armeb

+#define MACHINE_ARCH    "armeb"

+#endif /* __ARMEB__ */

+#endif /* MACHINE_ARCH */

+#else

+#undef _MACHINE

+#undef MACHINE

+#undef _MACHINE_ARCH

+#undef MACHINE_ARCH

+#define _MACHINE        arm

+#define MACHINE         "arm"

+#ifndef __ARMEB__

+#define _MACHINE_ARCH   arm

+#define MACHINE_ARCH    "arm"

+#else

+#define _MACHINE_ARCH   armeb

+#define MACHINE_ARCH    "armeb"

+#endif /* __ARMEB__ */

+#endif /* !_KERNEL */

+

+#define MID_MACHINE     MID_ARM6

+

+/*

+ * 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 /* _ARM_PARAM_H_ */

diff --git a/StdLib/Include/Arm/machine/signal.h b/StdLib/Include/Arm/machine/signal.h
index d42ca13..6628eb9 100644
--- a/StdLib/Include/Arm/machine/signal.h
+++ b/StdLib/Include/Arm/machine/signal.h
@@ -11,7 +11,7 @@
 **/

 #ifndef _MACHINE_SIGNAL_H

 #define _MACHINE_SIGNAL_H

-#include  <sys/common.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

diff --git a/StdLib/Include/Arm/machine/types.h b/StdLib/Include/Arm/machine/types.h
new file mode 100644
index 0000000..a59d5be
--- /dev/null
+++ b/StdLib/Include/Arm/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/sys/cdefs_aout.h b/StdLib/Include/sys/cdefs_aout.h
index 0ce4fd9..2749918 100644
--- a/StdLib/Include/sys/cdefs_aout.h
+++ b/StdLib/Include/sys/cdefs_aout.h
@@ -17,59 +17,63 @@
 

 #ifdef __GNUC__

 #if __STDC__

-    #ifndef   DONT_USE_STRONG_WEAK_ALIAS

-#define __strong_alias(alias,sym)               \

-    __asm(".global " _C_LABEL_STRING(#alias) "\n"     \

-      _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));

-#define __weak_alias(alias,sym)           \

-    __asm(".weak " _C_LABEL_STRING(#alias) "\n"     \

-      _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));

+  #ifndef   DONT_USE_STRONG_WEAK_ALIAS

+    #define __strong_alias(alias,sym)               \

+        __asm(".global " _C_LABEL_STRING(#alias) "\n"     \

+          _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));

+    #define __weak_alias(alias,sym)           \

+        __asm(".weak " _C_LABEL_STRING(#alias) "\n"     \

+          _C_LABEL_STRING(#alias) " = " _C_LABEL_STRING(#sym));

 

-/* Do not use __weak_extern, use __weak_reference instead */

-#define __weak_extern(sym)            \

-    __asm(".weak " _C_LABEL_STRING(#sym));

+    /* Do not use __weak_extern, use __weak_reference instead */

+    #define __weak_extern(sym)            \

+        __asm(".weak " _C_LABEL_STRING(#sym));

 

-#if __GNUC_PREREQ__(4, 0)

-#define __weak_reference(sym) __attribute__((__weakref__))

-#else

-#define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))

-#endif

-

-#define __warn_references(sym,msg)          \

-  __asm(".stabs \"" msg "\",30,0,0,0");       \

-  __asm(".stabs \"_" #sym "\",1,0,0,0");

+    #if __GNUC_PREREQ__(4, 0)

+      #define __weak_reference(sym) __attribute__((__weakref__))

     #else

-      #define __strong_alias(alias,sym)   /* NOTHING */

-      #define __weak_alias(alias,sym)     /* NOTHING */

-      #define __weak_extern(sym)          /* NOTHING */

-      #define __weak_reference(sym)       /* NOTHING */

+      #define __weak_reference(sym) ; __asm(".weak " _C_LABEL_STRING(#sym))

+    #endif

 

+    #define __warn_references(sym,msg)          \

+      __asm(".stabs \"" msg "\",30,0,0,0");       \

+      __asm(".stabs \"_" #sym "\",1,0,0,0");

+  #else

+    #define __strong_alias(alias,sym)   /* NOTHING */

+    #define __weak_alias(alias,sym)     /* NOTHING */

+    #define __weak_extern(sym)          /* NOTHING */

+    #define __weak_reference(sym)       /* NOTHING */

+

+    #if !defined(__CC_ARM)

       #define __warn_references(sym,msg)          \

               __asm(".stabs \"" msg "\",30,0,0,0");       \

               __asm(".stabs \"_" #sym "\",1,0,0,0");

+    #else

+      #define __warn_references(sym,msg)

     #endif

-#else /* __STDC__ */

-#define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)

-#define ___weak_alias(alias,sym)          \

-    __asm(".weak alias\nalias = sym");

-/* Do not use __weak_extern, use __weak_reference instead */

-#define __weak_extern(sym) ___weak_extern(_/**/sym)

-#define ___weak_extern(sym)           \

-    __asm(".weak sym");

+  #endif

+#else   /* __STDC__ */

+  #define __weak_alias(alias,sym) ___weak_alias(_/**/alias,_/**/sym)

+  #define ___weak_alias(alias,sym)          \

+      __asm(".weak alias\nalias = sym");

+  /* Do not use __weak_extern, use __weak_reference instead */

+  #define __weak_extern(sym) ___weak_extern(_/**/sym)

+  #define ___weak_extern(sym)           \

+      __asm(".weak sym");

 

-#if __GNUC_PREREQ__(4, 0)

-#define __weak_reference(sym) __attribute__((__weakref__))

-#else

-#define ___weak_reference(sym)  ; __asm(".weak sym");

-#define __weak_reference(sym) ___weak_reference(_/**/sym)

-#endif

+  #if __GNUC_PREREQ__(4, 0)

+    #define __weak_reference(sym) __attribute__((__weakref__))

+  #else

+    #define ___weak_reference(sym)  ; __asm(".weak sym");

+    #define __weak_reference(sym) ___weak_reference(_/**/sym)

+  #endif

 

-#define __warn_references(sym,msg)          \

-  __asm(".stabs msg,30,0,0,0");         \

-  __asm(".stabs \"_/**/sym\",1,0,0,0");

+  #define __warn_references(sym,msg)          \

+    __asm(".stabs msg,30,0,0,0");         \

+    __asm(".stabs \"_/**/sym\",1,0,0,0");

 #endif /* __STDC__ */

 #else /* __GNUC__ */

-#define __warn_references(sym,msg)

+  #define __warn_references(sym,msg)

 #endif /* __GNUC__ */

 

 #if defined(__sh__)   /* XXX SH COFF */

diff --git a/StdLib/LibC/Main/Arm/flt_rounds.c b/StdLib/LibC/Main/Arm/flt_rounds.c
index 3f43650..a64f447 100644
--- a/StdLib/LibC/Main/Arm/flt_rounds.c
+++ b/StdLib/LibC/Main/Arm/flt_rounds.c
@@ -1,4 +1,4 @@
-/*	$NetBSD: flt_rounds.c,v 1.3 2006/02/25 00:58:35 wiz Exp $	*/

+/*  $NetBSD: flt_rounds.c,v 1.3 2006/02/25 00:58:35 wiz Exp $ */

 

 /*

  * Copyright (c) 1996 Mark Brinicombe

@@ -15,7 +15,7 @@
  * 3. All advertising materials mentioning features or use of this software

  *    must display the following acknowledgement:

  *      This product includes software developed by Mark Brinicombe

- *	for the NetBSD Project.

+ *  for the NetBSD Project.

  * 4. The name of the author may not be used to endorse or promote products

  *    derived from this software without specific prior written permission

  *

@@ -31,29 +31,29 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

  */

 

-#include <sys/cdefs.h>

+#include <sys/EfiCdefs.h>

 #if defined(LIBC_SCCS) && !defined(lint)

 __RCSID("$NetBSD: flt_rounds.c,v 1.3 2006/02/25 00:58:35 wiz Exp $");

 #endif /* LIBC_SCCS and not lint */

 

 #include <sys/types.h>

-#include <ieeefp.h>

+//#include <ieeefp.h>

 

 static const int map[] = {

-	1,	/* round to nearest */

-	2,	/* round to positive infinity */

-	3,	/* round to negative infinity */

-	0	/* round to zero */

+  1,  /* round to nearest */

+  2,  /* round to positive infinity */

+  3,  /* round to negative infinity */

+  0 /* round to zero */

 };

 

 /*

  * Return the current FP rounding mode

  *

  * Returns:

- *	0 - round to zero

- *	1 - round to nearest

- *	2 - round to postive infinity

- *	3 - round to negative infinity

+ *  0 - round to zero

+ *  1 - round to nearest

+ *  2 - round to postive infinity

+ *  3 - round to negative infinity

  *

  * ok all we need to do is get the current FP rounding mode

  * index our map table and return the appropriate value.

@@ -77,5 +77,6 @@
 int

 __flt_rounds()

 {

-	return(map[fpgetround()]);

+  //return(map[fpgetround()]);

+  return 1; //TODO: FixMe

 }

diff --git a/StdLib/StdLib.dsc b/StdLib/StdLib.dsc
index 717e2d8..c352b22 100644
--- a/StdLib/StdLib.dsc
+++ b/StdLib/StdLib.dsc
@@ -25,7 +25,7 @@
   PLATFORM_VERSION               = 0.01

   DSC_SPECIFICATION              = 0x00010006

   OUTPUT_DIRECTORY               = Build/StdLib

-  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64

+  SUPPORTED_ARCHITECTURES        = IA32|IPF|X64|ARM

   BUILD_TARGETS                  = DEBUG|RELEASE

   SKUID_IDENTIFIER               = DEFAULT

 

diff --git a/StdLib/StdLib.inc b/StdLib/StdLib.inc
index 3f16fb9..5446ecd 100644
--- a/StdLib/StdLib.inc
+++ b/StdLib/StdLib.inc
@@ -62,10 +62,19 @@
   PalLib|MdePkg/Library/UefiPalLib/UefiPalLib.inf

   TimerLib|MdePkg/Library/SecPeiDxeTimerLibCpu/SecPeiDxeTimerLibCpu.inf

 

+[LibraryClasses.ARM.UEFI_APPLICATION]

+  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+  TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf

+

+

 !else

   # Use this instance if Running in an Emulation Environment.

 [LibraryClasses.Common.UEFI_APPLICATION]

   TimerLib|MdePkg/Library/BaseTimerLibNullTemplate/BaseTimerLibNullTemplate.inf

+

+[LibraryClasses.ARM.UEFI_APPLICATION]

+  NULL|ArmPkg/Library/CompilerIntrinsicsLib/CompilerIntrinsicsLib.inf

+

 !endif

 

 [Components]

@@ -99,9 +108,11 @@
 !ifndef $(EMULATE)

   # These Build Options are used when building the Standard Libraries to be run

   # on real hardware.

-  INTEL:*_*_*_CC_FLAGS      = /Qfreestanding

-   MSFT:*_*_*_CC_FLAGS      = /X /Zc:wchar_t

-    GCC:*_*_*_CC_FLAGS      = -nostdinc -nostdlib

+   INTEL:*_*_*_CC_FLAGS      = /Qfreestanding

+    MSFT:*_*_*_CC_FLAGS      = /X /Zc:wchar_t

+     GCC:*_*_*_CC_FLAGS      = -nostdinc -nostdlib

+    RVCT:*_*_*_CC_FLAGS      = --library_interface=none -J$(WORKSPACE)/StdLib/Include -J$(WORKSPACE)/StdLib/Include/Arm -DNT32dvm

+  ARMGCC:*_*_*_CC_FLAGS      = -nostdinc -nostdlib -Wno-unknown-pragmas -Wno-unused -Wno-format-zero-length -DNT32dvm

 

 !else

   # The Build Options, below, are only used when building the Standard Libraries

@@ -112,3 +123,5 @@
    MSFT:*_*_IA32_CC_FLAGS     = /Od /D NT32dvm

     GCC:*_*_IA32_CC_FLAGS     = -O0 -DNT32dvm

 !endif

+

+