]> git.proxmox.com Git - mirror_edk2.git/blame - MdePkg/Include/Ebc/ProcessorBind.h
MdePkg: Clean up source files
[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
9095d37b
LG
7Copyright (c) 2006 - 2018, 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
af2dc6a7 10The full text of the license may be found at\r
9095d37b
LG
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
d7a09cb8 94#define MAX_BIT ((UINTN)((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
d7a09cb8 99#define MAX_2_BITS ((UINTN)(3ULL << (sizeof (INTN) * 8 - 2)))\r
959ccb23 100\r
d484d120 101///\r
102/// Maximum legal EBC address\r
103///\r
d7a09cb8 104#define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))\r
959ccb23 105\r
39899436
LG
106///\r
107/// Maximum legal EBC INTN and UINTN values.\r
108///\r
d7a09cb8
SB
109#define MAX_UINTN ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))\r
110#define MAX_INTN ((INTN)(~0ULL >> (65 - sizeof (INTN) * 8)))\r
111\r
112///\r
113/// Minimum legal EBC INTN value.\r
114///\r
115#define MIN_INTN (((INTN)-MAX_INTN) - 1)\r
39899436 116\r
d484d120 117///\r
118/// The stack alignment required for EBC\r
119///\r
959ccb23 120#define CPU_STACK_ALIGNMENT sizeof(UINTN)\r
121\r
08855193
AB
122///\r
123/// Page allocation granularity for EBC\r
124///\r
125#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
126#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
127\r
d484d120 128///\r
129/// Modifier to ensure that all protocol member functions and EFI intrinsics\r
130/// use the correct C calling convention. All protocol member functions and\r
3963c4bf 131/// EFI intrinsics are required to modify their member functions with EFIAPI.\r
d484d120 132///\r
6149e6bb 133#ifdef EFIAPI\r
134 ///\r
135 /// If EFIAPI is already defined, then we use that definition.\r
136 ///\r
137#else\r
9095d37b 138#define EFIAPI\r
6149e6bb 139#endif\r
959ccb23 140\r
14996c96
LG
141/**\r
142 Return the pointer to the first instruction of a function given a function pointer.\r
9095d37b 143 On EBC architectures, these two pointer values are the same,\r
14996c96 144 so the implementation of this macro is very simple.\r
9095d37b 145\r
3963c4bf 146 @param FunctionPointer A pointer to a function.\r
14996c96
LG
147\r
148 @return The pointer to the first instruction of a function given a function pointer.\r
149**/\r
9a1d00cb 150#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
24a7505c 151\r
02eef553
JJ
152#ifndef __USER_LABEL_PREFIX__\r
153#define __USER_LABEL_PREFIX__\r
154#endif\r
155\r
9095d37b 156#endif\r
959ccb23 157\r