environment. There are a set of base libraries in the Mde Package that can\r
be used to implement base modules.\r
\r
-Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\r
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
This program and the accompanying materials\r
are licensed and made available under the terms and conditions of the BSD License\r
//\r
#include <ProcessorBind.h>\r
\r
+#if defined(_MSC_EXTENSIONS)\r
+//\r
+// Disable warning when last field of data structure is a zero sized array.\r
+//\r
+#pragma warning ( disable : 4200 )\r
+#endif\r
\r
/**\r
Verifies the storage size of a given data type.\r
#endif\r
\r
//\r
-// For symbol name in GNU assembly code, an extra "_" is necessary\r
+// For symbol name in assembly code, an extra "_" is sometimes necessary\r
//\r
-#if defined(__GNUC__)\r
- ///\r
- /// Private worker functions for ASM_PFX()\r
- ///\r
- #define _CONCATENATE(a, b) __CONCATENATE(a, b)\r
- #define __CONCATENATE(a, b) a ## b\r
\r
- ///\r
- /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix\r
- /// on symbols in assembly language.\r
- ///\r
- #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)\r
-#endif\r
+///\r
+/// Private worker functions for ASM_PFX()\r
+///\r
+#define _CONCATENATE(a, b) __CONCATENATE(a, b)\r
+#define __CONCATENATE(a, b) a ## b\r
+\r
+///\r
+/// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix\r
+/// on symbols in assembly language.\r
+///\r
+#define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name)\r
\r
#if __APPLE__\r
//\r
///\r
#define NULL ((VOID *) 0)\r
\r
+///\r
+/// Maximum values for common UEFI Data Types\r
+///\r
+#define MAX_INT8 ((INT8)0x7F)\r
+#define MAX_UINT8 ((UINT8)0xFF)\r
+#define MAX_INT16 ((INT16)0x7FFF)\r
+#define MAX_UINT16 ((UINT16)0xFFFF)\r
+#define MAX_INT32 ((INT32)0x7FFFFFFF)\r
+#define MAX_UINT32 ((UINT32)0xFFFFFFFF)\r
+#define MAX_INT64 ((INT64)0x7FFFFFFFFFFFFFFFULL)\r
+#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL)\r
\r
#define BIT0 0x00000001\r
#define BIT1 0x00000002\r
// VA_END (VA_LIST Marker) - Clear Marker\r
// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from\r
// the ... list. You must know the size and pass it in this macro.\r
+// VA_COPY (VA_LIST Dest, VA_LIST Start) - Initialize Dest as a copy of Start.\r
//\r
// example:\r
//\r
\r
#define VA_END(Marker) ((void)0)\r
\r
+// For some ARM RVCT compilers, __va_copy is not defined\r
+#ifndef __va_copy\r
+ #define __va_copy(dest, src) ((void)((dest) = (src)))\r
+#endif\r
+\r
+#define VA_COPY(Dest, Start) __va_copy (Dest, Start)\r
+\r
#elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS)\r
//\r
// Use GCC built-in macros for variable argument lists.\r
\r
#define VA_END(Marker) __builtin_va_end (Marker)\r
\r
+#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start)\r
+\r
#else\r
///\r
/// Variable used to traverse the list of arguments. This type can vary by\r
**/\r
#define VA_END(Marker) (Marker = (VA_LIST) 0)\r
\r
+/**\r
+ Initializes a VA_LIST as a copy of an existing VA_LIST.\r
+\r
+ This macro initializes Dest as a copy of Start, as if the VA_START macro had been applied to Dest\r
+ followed by the same sequence of uses of the VA_ARG macro as had previously been used to reach\r
+ the present state of Start. \r
+\r
+ @param Dest VA_LIST used to traverse the list of arguments.\r
+ @param Start VA_LIST used to traverse the list of arguments.\r
+\r
+**/\r
+#define VA_COPY(Dest, Start) ((void)((Dest) = (Start)))\r
+\r
#endif\r
\r
///\r
///\r
#define RETURN_INVALID_LANGUAGE ENCODE_ERROR (32)\r
\r
+///\r
+/// The security status of the data is unknown or compromised\r
+/// and the data must be updated or replaced to restore a valid\r
+/// security status.\r
+///\r
+#define RETURN_COMPROMISED_DATA ENCODE_ERROR (33)\r
+\r
+///\r
+/// A HTTP error occurred during the network operation.\r
+///\r
+#define RETURN_HTTP_ERROR ENCODE_ERROR (35)\r
\r
///\r
/// The string contained one or more characters that\r
///\r
#define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4)\r
\r
+///\r
+/// The data has not been updated within the timeframe set by\r
+/// local policy for this type of data.\r
+///\r
+#define RETURN_WARN_STALE_DATA ENCODE_WARNING (5)\r
+\r
/**\r
Returns a 16-bit signature built from 2 ASCII characters.\r
\r
#define SIGNATURE_64(A, B, C, D, E, F, G, H) \\r
(SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32))\r
\r
+#if defined(_MSC_EXTENSIONS) && !defined (__INTEL_COMPILER) && !defined (MDE_CPU_EBC)\r
+ #pragma intrinsic(_ReturnAddress)\r
+ /**\r
+ Get the return address of the calling funcation.\r
+\r
+ Based on intrinsic function _ReturnAddress that provides the address of\r
+ the instruction in the calling function that will be executed after\r
+ control returns to the caller.\r
+\r
+ @param L Return Level.\r
+\r
+ @return The return address of the calling funcation or 0 if L != 0.\r
+\r
+ **/\r
+ #define RETURN_ADDRESS(L) ((L == 0) ? _ReturnAddress() : (VOID *) 0)\r
+#elif defined(__GNUC__)\r
+ void * __builtin_return_address (unsigned int level);\r
+ /**\r
+ Get the return address of the calling funcation.\r
+\r
+ Based on built-in Function __builtin_return_address that returns\r
+ the return address of the current function, or of one of its callers.\r
+\r
+ @param L Return Level.\r
+\r
+ @return The return address of the calling funcation.\r
+\r
+ **/\r
+ #define RETURN_ADDRESS(L) __builtin_return_address (L)\r
+#else\r
+ /**\r
+ Get the return address of the calling funcation.\r
+\r
+ @param L Return Level.\r
+\r
+ @return 0 as compilers don't support this feature.\r
+\r
+ **/\r
+ #define RETURN_ADDRESS(L) ((VOID *) 0)\r
+#endif\r
+\r
#endif\r
\r