]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/Include/Aarch64/machine/ansi.h
StdLib: Add support for AArch64
[mirror_edk2.git] / StdLib / Include / Aarch64 / machine / ansi.h
diff --git a/StdLib/Include/Aarch64/machine/ansi.h b/StdLib/Include/Aarch64/machine/ansi.h
new file mode 100644 (file)
index 0000000..8273905
--- /dev/null
@@ -0,0 +1,106 @@
+/** @file\r
+    Machine dependent ANSI type definitions.\r
+\r
+    Copyright (c) 2010-2012, Intel Corporation. All rights reserved.<BR>\r
+    This program and the accompanying materials are licensed and made available\r
+    under the terms and conditions of the BSD License that accompanies this\r
+    distribution.  The full text of the license may be found at\r
+    http://opensource.org/licenses/bsd-license.php.\r
+\r
+    THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+    WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ * Copyright (c) 1990, 1993\r
+ *  The Regents of the University of California.  All rights reserved.\r
+ *\r
+ * Redistribution and use in source and binary forms, with or without\r
+ * modification, are permitted provided that the following conditions\r
+ * are met:\r
+ * 1. Redistributions of source code must retain the above copyright\r
+ *    notice, this list of conditions and the following disclaimer.\r
+ * 2. Redistributions in binary form must reproduce the above copyright\r
+ *    notice, this list of conditions and the following disclaimer in the\r
+ *    documentation and/or other materials provided with the distribution.\r
+ * 3. Neither the name of the University nor the names of its contributors\r
+ *    may be used to endorse or promote products derived from this software\r
+ *    without specific prior written permission.\r
+ *\r
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND\r
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
+ * SUCH DAMAGE.\r
+ *\r
+ *  from: @(#)ansi.h  8.2 (Berkeley) 1/4/94\r
+    NetBSD: ansi.h,v 1.7 2006/10/04 13:51:59 tnozaki Exp\r
+**/\r
+#ifndef _ANSI_H_\r
+#define _ANSI_H_\r
+\r
+#include <sys/EfiCdefs.h>\r
+\r
+#include <machine/int_types.h>\r
+\r
+/*\r
+ * Types which are fundamental to the implementation and may appear in\r
+ * more than one standard header are defined here.  Standard headers\r
+ * then use:\r
+ *  #ifdef  _BSD_SIZE_T_\r
+ *  typedef _BSD_SIZE_T_ size_t;\r
+ *  #undef  _BSD_SIZE_T_\r
+ *  #endif\r
+ */\r
+#define _BSD_CLOCK_T_     _EFI_CLOCK_T      /* clock() */\r
+#define _BSD_PTRDIFF_T_   _EFI_PTRDIFF_T_   /* ptr1 - ptr2 */\r
+#define _BSD_SIZE_T_      _EFI_SIZE_T_      /* sizeof() */\r
+#define _BSD_SSIZE_T_     INTN              /* byte count or error */\r
+#define _BSD_TIME_T_      _EFI_TIME_T       /* time() */\r
+#define _BSD_VA_LIST_     VA_LIST\r
+#define _BSD_CLOCKID_T_   INT64             /* clockid_t */\r
+#define _BSD_TIMER_T_     INT64             /* timer_t */\r
+#define _BSD_SUSECONDS_T_ INT64             /* suseconds_t */\r
+#define _BSD_USECONDS_T_  UINT64            /* useconds_t */\r
+\r
+/*\r
+ * NOTE: rune_t is not covered by ANSI nor other standards, and should not\r
+ * be instantiated outside of lib/libc/locale.  use wchar_t.\r
+ *\r
+ * Runes (wchar_t) is declared to be an ``int'' instead of the more natural\r
+ * ``unsigned long'' or ``long''.  Two things are happening here.  It is not\r
+ * unsigned so that EOF (-1) can be naturally assigned to it and used.  Also,\r
+ * it looks like 10646 will be a 31 bit standard.  This means that if your\r
+ * ints cannot hold 32 bits, you will be in trouble.  The reason an int was\r
+ * chosen over a long is that the is*() and to*() routines take ints (says\r
+ * ANSI C), but they use _RUNE_T_ instead of int.  By changing it here, you\r
+ * lose a bit of ANSI conformance, but your programs will still work.\r
+ *\r
+ * Note that _WCHAR_T_ and _RUNE_T_ must be of the same type.  When wchar_t\r
+ * and rune_t are typedef'd, _WCHAR_T_ will be undef'd, but _RUNE_T remains\r
+ * defined for ctype.h.\r
+ */\r
+#define _BSD_WCHAR_T_       _EFI_WCHAR_T    /* wchar_t */\r
+#define _BSD_WINT_T_        _EFI_WINT_T     /* wint_t */\r
+#define _BSD_RUNE_T_        _EFI_WCHAR_T    /* rune_t */\r
+#define _BSD_WCTRANS_T_     void *          /* wctrans_t */\r
+#define _BSD_WCTYPE_T_      unsigned int    /* wctype_t */\r
+\r
+/*\r
+ * mbstate_t is an opaque object to keep conversion state, during multibyte\r
+ * stream conversions.  The content must not be referenced by user programs.\r
+ */\r
+typedef struct {\r
+  UINT32  A;      // Np;\r
+  UINT32  B;      // U;\r
+  UINT32  E;      // L\r
+  UINT8   C[4];   // n[4]\r
+  UINT16  D[2];   // w[2]\r
+} __mbstate_t;\r
+#define _BSD_MBSTATE_T_   __mbstate_t /* mbstate_t */\r
+\r
+#endif  /* _ANSI_H_ */\r