SecurityPkg:Tpm2DeviceLibDTpm: Support TPM command cancel
[mirror_edk2.git] / MdePkg / Include / Ebc / ProcessorBind.h
CommitLineData
959ccb23 1/** @file\r
2 Processor or compiler specific defines and types for EBC.\r
3\r
1a2f870c 4 We currently only have one EBC compiler so there may be some Intel compiler\r
959ccb23 5 specific functions in this file.\r
6\r
39899436 7Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
af2dc6a7 8This program and the accompanying materials are licensed and made available under \r
9the terms and conditions of the BSD License that accompanies this distribution. \r
10The full text of the license may be found at\r
11http://opensource.org/licenses/bsd-license.php. \r
12 \r
13THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
959ccb23 15\r
959ccb23 16**/\r
17\r
18#ifndef __PROCESSOR_BIND_H__\r
19#define __PROCESSOR_BIND_H__\r
20\r
d484d120 21///\r
22/// Define the processor type so other code can make processor based choices\r
23///\r
959ccb23 24#define MDE_CPU_EBC\r
25\r
26//\r
27// Native integer types\r
28//\r
f4ec40ab 29\r
30///\r
31/// 1-byte signed value\r
32///\r
d22ebbe3 33typedef signed char INT8;\r
f4ec40ab 34///\r
35/// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r
36/// values are undefined.\r
37///\r
959ccb23 38typedef unsigned char BOOLEAN;\r
f4ec40ab 39///\r
af2dc6a7 40/// 1-byte unsigned value.\r
f4ec40ab 41///\r
959ccb23 42typedef unsigned char UINT8;\r
f4ec40ab 43///\r
af2dc6a7 44/// 1-byte Character.\r
f4ec40ab 45///\r
7d0db9ce 46typedef char CHAR8;\r
f4ec40ab 47///\r
af2dc6a7 48/// 2-byte signed value.\r
f4ec40ab 49///\r
959ccb23 50typedef short INT16;\r
f4ec40ab 51///\r
af2dc6a7 52/// 2-byte unsigned value.\r
f4ec40ab 53///\r
959ccb23 54typedef unsigned short UINT16;\r
f4ec40ab 55///\r
56/// 2-byte Character. Unless otherwise specified all strings are stored in the\r
57/// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r
58///\r
959ccb23 59typedef unsigned short CHAR16;\r
f4ec40ab 60///\r
af2dc6a7 61/// 4-byte signed value.\r
f4ec40ab 62///\r
959ccb23 63typedef int INT32;\r
f4ec40ab 64///\r
af2dc6a7 65/// 4-byte unsigned value.\r
f4ec40ab 66///\r
959ccb23 67typedef unsigned int UINT32;\r
f4ec40ab 68///\r
af2dc6a7 69/// 8-byte signed value.\r
f4ec40ab 70///\r
959ccb23 71typedef __int64 INT64;\r
f4ec40ab 72///\r
af2dc6a7 73/// 8-byte unsigned value.\r
f4ec40ab 74///\r
959ccb23 75typedef unsigned __int64 UINT64;\r
76\r
d484d120 77///\r
f4ec40ab 78/// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r
79/// 8 bytes on supported 64-bit processor instructions)\r
d484d120 80/// "long" type scales to the processor native size with EBC compiler\r
81///\r
959ccb23 82typedef long INTN;\r
f4ec40ab 83///\r
af2dc6a7 84/// The unsigned value of native width. (4 bytes on supported 32-bit processor instructions;\r
f4ec40ab 85/// 8 bytes on supported 64-bit processor instructions)\r
af2dc6a7 86/// "long" type scales to the processor native size with the EBC compiler.\r
f4ec40ab 87///\r
959ccb23 88typedef unsigned long UINTN;\r
89\r
d484d120 90///\r
f4ec40ab 91/// A value of native width with the highest bit set.\r
af2dc6a7 92/// Scalable macro to set the most significant bit in a natural number.\r
d484d120 93///\r
959ccb23 94#define MAX_BIT (1ULL << (sizeof (INTN) * 8 - 1)) \r
f4ec40ab 95///\r
96/// A value of native width with the two highest bits set.\r
af2dc6a7 97/// Scalable macro to set the most 2 significant bits in a natural number.\r
f4ec40ab 98///\r
959ccb23 99#define MAX_2_BITS (3ULL << (sizeof (INTN) * 8 - 2))\r
100\r
d484d120 101///\r
102/// Maximum legal EBC address\r
103///\r
959ccb23 104#define MAX_ADDRESS ((UINTN) ~0)\r
105\r
39899436
LG
106///\r
107/// Maximum legal EBC INTN and UINTN values.\r
108///\r
109#define MAX_UINTN ((UINTN) ~0)\r
110#define MAX_INTN ((INTN)~MAX_BIT)\r
111\r
d484d120 112///\r
113/// The stack alignment required for EBC\r
114///\r
959ccb23 115#define CPU_STACK_ALIGNMENT sizeof(UINTN)\r
116\r
08855193
AB
117///\r
118/// Page allocation granularity for EBC\r
119///\r
120#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
121#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
122\r
d484d120 123///\r
124/// Modifier to ensure that all protocol member functions and EFI intrinsics\r
125/// use the correct C calling convention. All protocol member functions and\r
3963c4bf 126/// EFI intrinsics are required to modify their member functions with EFIAPI.\r
d484d120 127///\r
6149e6bb 128#ifdef EFIAPI\r
129 ///\r
130 /// If EFIAPI is already defined, then we use that definition.\r
131 ///\r
132#else\r
959ccb23 133#define EFIAPI \r
6149e6bb 134#endif\r
959ccb23 135\r
14996c96
LG
136/**\r
137 Return the pointer to the first instruction of a function given a function pointer.\r
138 On EBC architectures, these two pointer values are the same, \r
139 so the implementation of this macro is very simple.\r
140 \r
3963c4bf 141 @param FunctionPointer A pointer to a function.\r
14996c96
LG
142\r
143 @return The pointer to the first instruction of a function given a function pointer.\r
144**/\r
9a1d00cb 145#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
24a7505c 146\r
02eef553
JJ
147#ifndef __USER_LABEL_PREFIX__\r
148#define __USER_LABEL_PREFIX__\r
149#endif\r
150\r
959ccb23 151#endif \r
152\r