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