Sync EDKII BaseTools to BaseTools project r1928
[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
6149e6bb 7 Copyright (c) 2006 - 2009, Intel Corporation<BR> \r
959ccb23 8 All rights reserved. This program and the accompanying materials \r
9 are licensed and made available under the terms and conditions of the BSD License \r
10 which accompanies this distribution. The full text of the license may be found at \r
11 http://opensource.org/licenses/bsd-license.php \r
12\r
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
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
959ccb23 33typedef 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
40/// 1-byte unsigned value\r
41///\r
959ccb23 42typedef unsigned char UINT8;\r
f4ec40ab 43///\r
44/// 1-byte Character\r
45///\r
7d0db9ce 46typedef char CHAR8;\r
f4ec40ab 47///\r
48/// 2-byte signed value\r
49///\r
959ccb23 50typedef short INT16;\r
f4ec40ab 51///\r
52/// 2-byte unsigned value\r
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
61/// 4-byte signed value\r
62///\r
959ccb23 63typedef int INT32;\r
f4ec40ab 64///\r
65/// 4-byte unsigned value\r
66///\r
959ccb23 67typedef unsigned int UINT32;\r
f4ec40ab 68///\r
69/// 8-byte signed value\r
70///\r
959ccb23 71typedef __int64 INT64;\r
f4ec40ab 72///\r
73/// 8-byte unsigned value\r
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
84/// 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 EBC compiler\r
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
d484d120 92/// Scalable macro to set the most significant bit in a natural number\r
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
97/// Scalable macro to set the most 2 significant bits in a natural number\r
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
d484d120 106///\r
107/// The stack alignment required for EBC\r
108///\r
959ccb23 109#define CPU_STACK_ALIGNMENT sizeof(UINTN)\r
110\r
d484d120 111///\r
112/// Modifier to ensure that all protocol member functions and EFI intrinsics\r
113/// use the correct C calling convention. All protocol member functions and\r
3963c4bf 114/// EFI intrinsics are required to modify their member functions with EFIAPI.\r
d484d120 115///\r
6149e6bb 116#ifdef EFIAPI\r
117 ///\r
118 /// If EFIAPI is already defined, then we use that definition.\r
119 ///\r
120#else\r
959ccb23 121#define EFIAPI \r
6149e6bb 122#endif\r
959ccb23 123\r
14996c96
LG
124/**\r
125 Return the pointer to the first instruction of a function given a function pointer.\r
126 On EBC architectures, these two pointer values are the same, \r
127 so the implementation of this macro is very simple.\r
128 \r
3963c4bf 129 @param FunctionPointer A pointer to a function.\r
14996c96
LG
130\r
131 @return The pointer to the first instruction of a function given a function pointer.\r
132**/\r
9a1d00cb 133#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
24a7505c 134\r
959ccb23 135#endif \r
136\r