Commit | Line | Data |
---|---|---|
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 | |
9095d37b | 7 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
9344f092 | 8 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
959ccb23 | 9 | \r |
959ccb23 | 10 | **/\r |
11 | \r | |
12 | #ifndef __PROCESSOR_BIND_H__\r | |
13 | #define __PROCESSOR_BIND_H__\r | |
14 | \r | |
d484d120 | 15 | ///\r |
16 | /// Define the processor type so other code can make processor based choices\r | |
17 | ///\r | |
959ccb23 | 18 | #define MDE_CPU_EBC\r |
19 | \r | |
20 | //\r | |
21 | // Native integer types\r | |
22 | //\r | |
f4ec40ab | 23 | \r |
24 | ///\r | |
25 | /// 1-byte signed value\r | |
26 | ///\r | |
2f88bd3a | 27 | typedef signed char INT8;\r |
f4ec40ab | 28 | ///\r |
29 | /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other\r | |
30 | /// values are undefined.\r | |
31 | ///\r | |
2f88bd3a | 32 | typedef unsigned char BOOLEAN;\r |
f4ec40ab | 33 | ///\r |
af2dc6a7 | 34 | /// 1-byte unsigned value.\r |
f4ec40ab | 35 | ///\r |
2f88bd3a | 36 | typedef unsigned char UINT8;\r |
f4ec40ab | 37 | ///\r |
af2dc6a7 | 38 | /// 1-byte Character.\r |
f4ec40ab | 39 | ///\r |
2f88bd3a | 40 | typedef char CHAR8;\r |
f4ec40ab | 41 | ///\r |
af2dc6a7 | 42 | /// 2-byte signed value.\r |
f4ec40ab | 43 | ///\r |
2f88bd3a | 44 | typedef short INT16;\r |
f4ec40ab | 45 | ///\r |
af2dc6a7 | 46 | /// 2-byte unsigned value.\r |
f4ec40ab | 47 | ///\r |
2f88bd3a | 48 | typedef unsigned short UINT16;\r |
f4ec40ab | 49 | ///\r |
50 | /// 2-byte Character. Unless otherwise specified all strings are stored in the\r | |
51 | /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.\r | |
52 | ///\r | |
2f88bd3a | 53 | typedef unsigned short CHAR16;\r |
f4ec40ab | 54 | ///\r |
af2dc6a7 | 55 | /// 4-byte signed value.\r |
f4ec40ab | 56 | ///\r |
2f88bd3a | 57 | typedef int INT32;\r |
f4ec40ab | 58 | ///\r |
af2dc6a7 | 59 | /// 4-byte unsigned value.\r |
f4ec40ab | 60 | ///\r |
2f88bd3a | 61 | typedef unsigned int UINT32;\r |
f4ec40ab | 62 | ///\r |
af2dc6a7 | 63 | /// 8-byte signed value.\r |
f4ec40ab | 64 | ///\r |
2f88bd3a | 65 | typedef __int64 INT64;\r |
f4ec40ab | 66 | ///\r |
af2dc6a7 | 67 | /// 8-byte unsigned value.\r |
f4ec40ab | 68 | ///\r |
2f88bd3a | 69 | typedef unsigned __int64 UINT64;\r |
959ccb23 | 70 | \r |
d484d120 | 71 | ///\r |
f4ec40ab | 72 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r |
73 | /// 8 bytes on supported 64-bit processor instructions)\r | |
d484d120 | 74 | /// "long" type scales to the processor native size with EBC compiler\r |
75 | ///\r | |
2f88bd3a | 76 | typedef long INTN;\r |
f4ec40ab | 77 | ///\r |
af2dc6a7 | 78 | /// The unsigned value of native width. (4 bytes on supported 32-bit processor instructions;\r |
f4ec40ab | 79 | /// 8 bytes on supported 64-bit processor instructions)\r |
af2dc6a7 | 80 | /// "long" type scales to the processor native size with the EBC compiler.\r |
f4ec40ab | 81 | ///\r |
2f88bd3a | 82 | typedef unsigned long UINTN;\r |
959ccb23 | 83 | \r |
d484d120 | 84 | ///\r |
f4ec40ab | 85 | /// A value of native width with the highest bit set.\r |
af2dc6a7 | 86 | /// Scalable macro to set the most significant bit in a natural number.\r |
d484d120 | 87 | ///\r |
2f88bd3a | 88 | #define MAX_BIT ((UINTN)((1ULL << (sizeof (INTN) * 8 - 1))))\r |
f4ec40ab | 89 | ///\r |
90 | /// A value of native width with the two highest bits set.\r | |
af2dc6a7 | 91 | /// Scalable macro to set the most 2 significant bits in a natural number.\r |
f4ec40ab | 92 | ///\r |
d7a09cb8 | 93 | #define MAX_2_BITS ((UINTN)(3ULL << (sizeof (INTN) * 8 - 2)))\r |
959ccb23 | 94 | \r |
d484d120 | 95 | ///\r |
96 | /// Maximum legal EBC address\r | |
97 | ///\r | |
2f88bd3a | 98 | #define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))\r |
959ccb23 | 99 | \r |
67b8f806 AB |
100 | ///\r |
101 | /// Maximum usable address at boot time (48 bits using 4 KB pages)\r | |
102 | ///\r | |
2f88bd3a | 103 | #define MAX_ALLOC_ADDRESS MAX_ADDRESS\r |
67b8f806 | 104 | \r |
39899436 LG |
105 | ///\r |
106 | /// Maximum legal EBC INTN and UINTN values.\r | |
107 | ///\r | |
d7a09cb8 SB |
108 | #define MAX_UINTN ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))\r |
109 | #define MAX_INTN ((INTN)(~0ULL >> (65 - sizeof (INTN) * 8)))\r | |
110 | \r | |
111 | ///\r | |
112 | /// Minimum legal EBC INTN value.\r | |
113 | ///\r | |
2f88bd3a | 114 | #define MIN_INTN (((INTN)-MAX_INTN) - 1)\r |
39899436 | 115 | \r |
d484d120 | 116 | ///\r |
117 | /// The stack alignment required for EBC\r | |
118 | ///\r | |
2f88bd3a | 119 | #define CPU_STACK_ALIGNMENT sizeof(UINTN)\r |
959ccb23 | 120 | \r |
08855193 AB |
121 | ///\r |
122 | /// Page allocation granularity for EBC\r | |
123 | ///\r | |
2f88bd3a MK |
124 | #define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r |
125 | #define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)\r | |
08855193 | 126 | \r |
d484d120 | 127 | ///\r |
128 | /// Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
129 | /// use the correct C calling convention. All protocol member functions and\r | |
3963c4bf | 130 | /// EFI intrinsics are required to modify their member functions with EFIAPI.\r |
d484d120 | 131 | ///\r |
6149e6bb | 132 | #ifdef EFIAPI\r |
2f88bd3a MK |
133 | ///\r |
134 | /// If EFIAPI is already defined, then we use that definition.\r | |
135 | ///\r | |
6149e6bb | 136 | #else\r |
9095d37b | 137 | #define EFIAPI\r |
6149e6bb | 138 | #endif\r |
959ccb23 | 139 | \r |
14996c96 LG |
140 | /**\r |
141 | Return the pointer to the first instruction of a function given a function pointer.\r | |
9095d37b | 142 | On EBC architectures, these two pointer values are the same,\r |
14996c96 | 143 | so the implementation of this macro is very simple.\r |
9095d37b | 144 | \r |
3963c4bf | 145 | @param FunctionPointer A pointer to a function.\r |
14996c96 LG |
146 | \r |
147 | @return The pointer to the first instruction of a function given a function pointer.\r | |
148 | **/\r | |
2f88bd3a | 149 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r |
24a7505c | 150 | \r |
02eef553 JJ |
151 | #ifndef __USER_LABEL_PREFIX__\r |
152 | #define __USER_LABEL_PREFIX__\r | |
153 | #endif\r | |
154 | \r | |
9095d37b | 155 | #endif\r |