]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - MdePkg/Include/Ebc/ProcessorBind.h
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[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 - 2018, Intel Corporation. All rights reserved.<BR>\r
8SPDX-License-Identifier: BSD-2-Clause-Patent\r
9\r
10**/\r
11\r
12#ifndef __PROCESSOR_BIND_H__\r
13#define __PROCESSOR_BIND_H__\r
14\r
15///\r
16/// Define the processor type so other code can make processor based choices\r
17///\r
18#define MDE_CPU_EBC\r
19\r
20//\r
21// Native integer types\r
22//\r
23\r
24///\r
25/// 1-byte signed value\r
26///\r
27typedef signed char INT8;\r
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
32typedef unsigned char BOOLEAN;\r
33///\r
34/// 1-byte unsigned value.\r
35///\r
36typedef unsigned char UINT8;\r
37///\r
38/// 1-byte Character.\r
39///\r
40typedef char CHAR8;\r
41///\r
42/// 2-byte signed value.\r
43///\r
44typedef short INT16;\r
45///\r
46/// 2-byte unsigned value.\r
47///\r
48typedef unsigned short UINT16;\r
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
53typedef unsigned short CHAR16;\r
54///\r
55/// 4-byte signed value.\r
56///\r
57typedef int INT32;\r
58///\r
59/// 4-byte unsigned value.\r
60///\r
61typedef unsigned int UINT32;\r
62///\r
63/// 8-byte signed value.\r
64///\r
65typedef __int64 INT64;\r
66///\r
67/// 8-byte unsigned value.\r
68///\r
69typedef unsigned __int64 UINT64;\r
70\r
71///\r
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
74/// "long" type scales to the processor native size with EBC compiler\r
75///\r
76typedef long INTN;\r
77///\r
78/// The unsigned 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 the EBC compiler.\r
81///\r
82typedef unsigned long UINTN;\r
83\r
84///\r
85/// A value of native width with the highest bit set.\r
86/// Scalable macro to set the most significant bit in a natural number.\r
87///\r
88#define MAX_BIT ((UINTN)((1ULL << (sizeof (INTN) * 8 - 1))))\r
89///\r
90/// A value of native width with the two highest bits set.\r
91/// Scalable macro to set the most 2 significant bits in a natural number.\r
92///\r
93#define MAX_2_BITS ((UINTN)(3ULL << (sizeof (INTN) * 8 - 2)))\r
94\r
95///\r
96/// Maximum legal EBC address\r
97///\r
98#define MAX_ADDRESS ((UINTN)(~0ULL >> (64 - sizeof (INTN) * 8)))\r
99\r
100///\r
101/// Maximum usable address at boot time (48 bits using 4 KB pages)\r
102///\r
103#define MAX_ALLOC_ADDRESS MAX_ADDRESS\r
104\r
105///\r
106/// Maximum legal EBC INTN and UINTN values.\r
107///\r
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
114#define MIN_INTN (((INTN)-MAX_INTN) - 1)\r
115\r
116///\r
117/// The stack alignment required for EBC\r
118///\r
119#define CPU_STACK_ALIGNMENT sizeof(UINTN)\r
120\r
121///\r
122/// Page allocation granularity for EBC\r
123///\r
124#define DEFAULT_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
125#define RUNTIME_PAGE_ALLOCATION_GRANULARITY (0x1000)\r
126\r
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
130/// EFI intrinsics are required to modify their member functions with EFIAPI.\r
131///\r
132#ifdef EFIAPI\r
133///\r
134/// If EFIAPI is already defined, then we use that definition.\r
135///\r
136#else\r
137#define EFIAPI\r
138#endif\r
139\r
140/**\r
141 Return the pointer to the first instruction of a function given a function pointer.\r
142 On EBC architectures, these two pointer values are the same,\r
143 so the implementation of this macro is very simple.\r
144\r
145 @param FunctionPointer A pointer to a function.\r
146\r
147 @return The pointer to the first instruction of a function given a function pointer.\r
148**/\r
149#define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r
150\r
151#ifndef __USER_LABEL_PREFIX__\r
152#define __USER_LABEL_PREFIX__\r
153#endif\r
154\r
155#endif\r