X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=MdePkg%2FInclude%2FBase.h;h=f45f3442cb3a9bacb493ec8b3531cff349ceb359;hb=62ec4a5ef674846f3edd0317e59b0c509873b3b5;hp=cd860acd9106477a53fc128c30ebcdcb967b8c68;hpb=8b157410c1f57f684f049ee7b7989b8065be8f11;p=mirror_edk2.git diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index cd860acd91..f45f3442cb 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -6,7 +6,7 @@ environment. There are a set of base libraries in the Mde Package that can be used to implement base modules. -Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.
Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License @@ -27,6 +27,12 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. // #include +#if defined(_MSC_EXTENSIONS) +// +// Disable warning when last field of data structure is a zero sized array. +// +#pragma warning ( disable : 4200 ) +#endif /** Verifies the storage size of a given data type. @@ -79,21 +85,20 @@ VERIFY_SIZE_OF (CHAR16, 2); #endif // -// For symbol name in GNU assembly code, an extra "_" is necessary +// For symbol name in assembly code, an extra "_" is sometimes necessary // -#if defined(__GNUC__) - /// - /// Private worker functions for ASM_PFX() - /// - #define _CONCATENATE(a, b) __CONCATENATE(a, b) - #define __CONCATENATE(a, b) a ## b - /// - /// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix - /// on symbols in assembly language. - /// - #define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name) -#endif +/// +/// Private worker functions for ASM_PFX() +/// +#define _CONCATENATE(a, b) __CONCATENATE(a, b) +#define __CONCATENATE(a, b) a ## b + +/// +/// The __USER_LABEL_PREFIX__ macro predefined by GNUC represents the prefix +/// on symbols in assembly language. +/// +#define ASM_PFX(name) _CONCATENATE (__USER_LABEL_PREFIX__, name) #if __APPLE__ // @@ -206,6 +211,17 @@ struct _LIST_ENTRY { /// #define NULL ((VOID *) 0) +/// +/// Maximum values for common UEFI Data Types +/// +#define MAX_INT8 ((INT8)0x7F) +#define MAX_UINT8 ((UINT8)0xFF) +#define MAX_INT16 ((INT16)0x7FFF) +#define MAX_UINT16 ((UINT16)0xFFFF) +#define MAX_INT32 ((INT32)0x7FFFFFFF) +#define MAX_UINT32 ((UINT32)0xFFFFFFFF) +#define MAX_INT64 ((INT64)0x7FFFFFFFFFFFFFFFULL) +#define MAX_UINT64 ((UINT64)0xFFFFFFFFFFFFFFFFULL) #define BIT0 0x00000001 #define BIT1 0x00000002 @@ -393,6 +409,7 @@ struct _LIST_ENTRY { // VA_END (VA_LIST Marker) - Clear Marker // VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from // the ... list. You must know the size and pass it in this macro. +// VA_COPY (VA_LIST Dest, VA_LIST Start) - Initialize Dest as a copy of Start. // // example: // @@ -454,6 +471,13 @@ struct _LIST_ENTRY { #define VA_END(Marker) ((void)0) +// For some ARM RVCT compilers, __va_copy is not defined +#ifndef __va_copy + #define __va_copy(dest, src) ((void)((dest) = (src))) +#endif + +#define VA_COPY(Dest, Start) __va_copy (Dest, Start) + #elif defined(__GNUC__) && !defined(NO_BUILTIN_VA_FUNCS) // // Use GCC built-in macros for variable argument lists. @@ -471,6 +495,8 @@ typedef __builtin_va_list VA_LIST; #define VA_END(Marker) __builtin_va_end (Marker) +#define VA_COPY(Dest, Start) __builtin_va_copy (Dest, Start) + #else /// /// Variable used to traverse the list of arguments. This type can vary by @@ -526,6 +552,19 @@ typedef CHAR8 *VA_LIST; **/ #define VA_END(Marker) (Marker = (VA_LIST) 0) +/** + Initializes a VA_LIST as a copy of an existing VA_LIST. + + This macro initializes Dest as a copy of Start, as if the VA_START macro had been applied to Dest + followed by the same sequence of uses of the VA_ARG macro as had previously been used to reach + the present state of Start. + + @param Dest VA_LIST used to traverse the list of arguments. + @param Start VA_LIST used to traverse the list of arguments. + +**/ +#define VA_COPY(Dest, Start) ((void)((Dest) = (Start))) + #endif /// @@ -894,6 +933,17 @@ typedef UINTN RETURN_STATUS; /// #define RETURN_INVALID_LANGUAGE ENCODE_ERROR (32) +/// +/// The security status of the data is unknown or compromised +/// and the data must be updated or replaced to restore a valid +/// security status. +/// +#define RETURN_COMPROMISED_DATA ENCODE_ERROR (33) + +/// +/// A HTTP error occurred during the network operation. +/// +#define RETURN_HTTP_ERROR ENCODE_ERROR (35) /// /// The string contained one or more characters that @@ -918,6 +968,12 @@ typedef UINTN RETURN_STATUS; /// #define RETURN_WARN_BUFFER_TOO_SMALL ENCODE_WARNING (4) +/// +/// The data has not been updated within the timeframe set by +/// local policy for this type of data. +/// +#define RETURN_WARN_STALE_DATA ENCODE_WARNING (5) + /** Returns a 16-bit signature built from 2 ASCII characters. @@ -971,5 +1027,46 @@ typedef UINTN RETURN_STATUS; #define SIGNATURE_64(A, B, C, D, E, F, G, H) \ (SIGNATURE_32 (A, B, C, D) | ((UINT64) (SIGNATURE_32 (E, F, G, H)) << 32)) +#if defined(_MSC_EXTENSIONS) && !defined (__INTEL_COMPILER) && !defined (MDE_CPU_EBC) + #pragma intrinsic(_ReturnAddress) + /** + Get the return address of the calling funcation. + + Based on intrinsic function _ReturnAddress that provides the address of + the instruction in the calling function that will be executed after + control returns to the caller. + + @param L Return Level. + + @return The return address of the calling funcation or 0 if L != 0. + + **/ + #define RETURN_ADDRESS(L) ((L == 0) ? _ReturnAddress() : (VOID *) 0) +#elif defined(__GNUC__) + void * __builtin_return_address (unsigned int level); + /** + Get the return address of the calling funcation. + + Based on built-in Function __builtin_return_address that returns + the return address of the current function, or of one of its callers. + + @param L Return Level. + + @return The return address of the calling funcation. + + **/ + #define RETURN_ADDRESS(L) __builtin_return_address (L) +#else + /** + Get the return address of the calling funcation. + + @param L Return Level. + + @return 0 as compilers don't support this feature. + + **/ + #define RETURN_ADDRESS(L) ((VOID *) 0) +#endif + #endif