]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Ebc/ProcessorBind.h
SecurityPkg:Tpm2DeviceLibDTpm: Support TPM command cancel
[mirror_edk2.git] / MdePkg / Include / Ebc / ProcessorBind.h
... / ...
CommitLineData
1/** @file\r
2 Processor or compiler specific defines and types for EBC.\r
3\r
4 We currently only have one EBC compiler so there may be some Intel compiler\r
5 specific functions in this file.\r
6\r
7Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
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
15\r
16**/\r
17\r
18#ifndef __PROCESSOR_BIND_H__\r
19#define __PROCESSOR_BIND_H__\r
20\r
21///\r
22/// Define the processor type so other code can make processor based choices\r
23///\r
24#define MDE_CPU_EBC\r
25\r
26//\r
27// Native integer types\r
28//\r
29\r
30///\r
31/// 1-byte signed value\r
32///\r
33typedef signed char INT8;\r
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
38typedef unsigned char BOOLEAN;\r
39///\r
40/// 1-byte unsigned value.\r
41///\r
42typedef unsigned char UINT8;\r
43///\r
44/// 1-byte Character.\r
45///\r
46typedef char CHAR8;\r
47///\r
48/// 2-byte signed value.\r
49///\r
50typedef short INT16;\r
51///\r
52/// 2-byte unsigned value.\r
53///\r
54typedef unsigned short UINT16;\r
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
59typedef unsigned short CHAR16;\r
60///\r
61/// 4-byte signed value.\r
62///\r
63typedef int INT32;\r
64///\r
65/// 4-byte unsigned value.\r
66///\r
67typedef unsigned int UINT32;\r
68///\r
69/// 8-byte signed value.\r
70///\r
71typedef __int64 INT64;\r
72///\r
73/// 8-byte unsigned value.\r
74///\r
75typedef unsigned __int64 UINT64;\r
76\r
77///\r
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
80/// "long" type scales to the processor native size with EBC compiler\r
81///\r
82typedef long INTN;\r
83///\r
84/// The unsigned value of native width. (4 bytes on supported 32-bit processor instructions;\r
85/// 8 bytes on supported 64-bit processor instructions)\r
86/// "long" type scales to the processor native size with the EBC compiler.\r
87///\r
88typedef unsigned long UINTN;\r
89\r
90///\r
91/// A value of native width with the highest bit set.\r
92/// Scalable macro to set the most significant bit in a natural number.\r
93///\r
94#define MAX_BIT (1ULL << (sizeof (INTN) * 8 - 1)) \r
95///\r
96/// A value of native width with the two highest bits set.\r
97/// Scalable macro to set the most 2 significant bits in a natural number.\r
98///\r
99#define MAX_2_BITS (3ULL << (sizeof (INTN) * 8 - 2))\r
100\r
101///\r
102/// Maximum legal EBC address\r
103///\r
104#define MAX_ADDRESS ((UINTN) ~0)\r
105\r
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
112///\r
113/// The stack alignment required for EBC\r
114///\r
115#define CPU_STACK_ALIGNMENT sizeof(UINTN)\r
116\r
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
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
126/// EFI intrinsics are required to modify their member functions with EFIAPI.\r
127///\r
128#ifdef EFIAPI\r
129 ///\r
130 /// If EFIAPI is already defined, then we use that definition.\r
131 ///\r
132#else\r
133#define EFIAPI \r
134#endif\r
135\r
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
141 @param FunctionPointer A pointer to a function.\r
142\r
143 @return The pointer to the first instruction of a function given a function pointer.\r
144**/\r
145#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
146\r
147#ifndef __USER_LABEL_PREFIX__\r
148#define __USER_LABEL_PREFIX__\r
149#endif\r
150\r
151#endif \r
152\r