]>
Commit | Line | Data |
---|---|---|
ebd04fc2 | 1 | /** @file\r |
2 | Processor or Compiler specific defines and types for ARM.\r | |
3 | \r | |
068a82fc | 4 | Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r |
9df063a0 HT |
5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
6 | This program and the accompanying materials \r | |
ebd04fc2 | 7 | are licensed and made available under the terms and conditions of the BSD License \r |
8 | which accompanies this distribution. The full text of the license may be found at \r | |
9 | http://opensource.org/licenses/bsd-license.php \r | |
10 | \r | |
11 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
12 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
13 | \r | |
14 | **/\r | |
15 | \r | |
16 | #ifndef __PROCESSOR_BIND_H__\r | |
17 | #define __PROCESSOR_BIND_H__\r | |
18 | \r | |
19 | ///\r | |
20 | /// Define the processor type so other code can make processor based choices\r | |
21 | ///\r | |
22 | #define MDE_CPU_ARM\r | |
23 | \r | |
24 | //\r | |
ea3c1b3a | 25 | // Make sure we are using the correct packing rules per EFI specification\r |
ebd04fc2 | 26 | //\r |
27 | #ifndef __GNUC__\r | |
28 | #pragma pack()\r | |
29 | #endif\r | |
30 | \r | |
31 | #if _MSC_EXTENSIONS \r | |
32 | //\r | |
0e4cdd85 | 33 | // use Microsoft* C complier dependent integer width types \r |
ebd04fc2 | 34 | //\r |
35 | typedef unsigned __int64 UINT64;\r | |
36 | typedef __int64 INT64;\r | |
37 | typedef unsigned __int32 UINT32;\r | |
38 | typedef __int32 INT32;\r | |
39 | typedef unsigned short UINT16;\r | |
40 | typedef unsigned short CHAR16;\r | |
41 | typedef short INT16;\r | |
42 | typedef unsigned char BOOLEAN;\r | |
43 | typedef unsigned char UINT8;\r | |
44 | typedef char CHAR8;\r | |
d22ebbe3 | 45 | typedef signed char INT8;\r |
ebd04fc2 | 46 | #else\r |
47 | //\r | |
48 | // Assume standard ARM alignment. \r | |
49 | // Need to check portability of long long\r | |
50 | //\r | |
51 | typedef unsigned long long UINT64;\r | |
52 | typedef long long INT64;\r | |
53 | typedef unsigned int UINT32;\r | |
54 | typedef int INT32;\r | |
55 | typedef unsigned short UINT16;\r | |
56 | typedef unsigned short CHAR16;\r | |
57 | typedef short INT16;\r | |
58 | typedef unsigned char BOOLEAN;\r | |
59 | typedef unsigned char UINT8;\r | |
60 | typedef char CHAR8;\r | |
d22ebbe3 | 61 | typedef signed char INT8;\r |
ebd04fc2 | 62 | #endif\r |
63 | \r | |
4e094cba | 64 | ///\r |
65 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
66 | /// 8 bytes on supported 64-bit processor instructions)\r | |
67 | ///\r | |
ebd04fc2 | 68 | typedef UINT32 UINTN;\r |
69 | \r | |
4e094cba | 70 | ///\r |
71 | /// Signed value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
72 | /// 8 bytes on supported 64-bit processor instructions)\r | |
73 | ///\r | |
ebd04fc2 | 74 | typedef INT32 INTN;\r |
75 | \r | |
76 | //\r | |
77 | // Processor specific defines\r | |
78 | //\r | |
4e094cba | 79 | \r |
80 | ///\r | |
81 | /// A value of native width with the highest bit set.\r | |
82 | ///\r | |
ebd04fc2 | 83 | #define MAX_BIT 0x80000000\r |
84 | \r | |
4e094cba | 85 | ///\r |
86 | /// A value of native width with the two highest bits set.\r | |
87 | ///\r | |
ebd04fc2 | 88 | #define MAX_2_BITS 0xC0000000\r |
89 | \r | |
90 | ///\r | |
91 | /// Maximum legal ARM address\r | |
92 | ///\r | |
93 | #define MAX_ADDRESS 0xFFFFFFFF\r | |
94 | \r | |
068a82fc LG |
95 | ///\r |
96 | /// Maximum legal ARM INTN and UINTN values.\r | |
97 | ///\r | |
98 | #define MAX_INTN ((INTN)0x7FFFFFFF)\r | |
99 | #define MAX_UINTN ((UINTN)0xFFFFFFFF)\r | |
100 | \r | |
ebd04fc2 | 101 | ///\r |
102 | /// The stack alignment required for ARM\r | |
103 | ///\r | |
104 | #define CPU_STACK_ALIGNMENT sizeof(UINT64)\r | |
105 | \r | |
106 | //\r | |
107 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
108 | // use the correct C calling convention. All protocol member functions and\r | |
ea3c1b3a | 109 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r |
ebd04fc2 | 110 | //\r |
111 | #define EFIAPI \r | |
112 | \r | |
ba0a34f1 OM |
113 | // When compiling with Clang, we still use GNU as for the assembler, so we still\r |
114 | // need to define the GCC_ASM* macros.\r | |
115 | #if defined(__GNUC__) || defined(__clang__)\r | |
ebd04fc2 | 116 | ///\r |
117 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
118 | /// Define this macro to unify the usage.\r | |
119 | ///\r | |
120 | #define ASM_GLOBAL .globl\r | |
e7cb469e | 121 | \r |
122 | #if !defined(__APPLE__)\r | |
123 | ///\r | |
124 | /// ARM EABI defines that the linker should not manipulate call relocations\r | |
125 | /// (do bl/blx conversion) unless the target symbol has function type.\r | |
126 | /// CodeSourcery 2010.09 started requiring the .type to function properly\r | |
127 | ///\r | |
128 | #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function\r | |
4c8a6e06 | 129 | \r |
130 | #define GCC_ASM_EXPORT(func__) \\r | |
131 | .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r | |
132 | .type ASM_PFX(func__), %function \r | |
133 | \r | |
134 | #define GCC_ASM_IMPORT(func__) \\r | |
135 | .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r | |
136 | \r | |
e7cb469e | 137 | #else\r |
138 | //\r | |
139 | // .type not supported by Apple Xcode tools \r | |
140 | //\r | |
4c8a6e06 | 141 | #define INTERWORK_FUNC(func__) \r |
142 | \r | |
143 | #define GCC_ASM_EXPORT(func__) \\r | |
144 | .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \\r | |
145 | \r | |
6ced2e11 | 146 | #define GCC_ASM_IMPORT(name) \r |
4c8a6e06 | 147 | \r |
e7cb469e | 148 | #endif\r |
ebd04fc2 | 149 | #endif\r |
150 | \r | |
4e094cba | 151 | /**\r |
152 | Return the pointer to the first instruction of a function given a function pointer.\r | |
153 | On ARM CPU architectures, these two pointer values are the same, \r | |
154 | so the implementation of this macro is very simple.\r | |
155 | \r | |
156 | @param FunctionPointer A pointer to a function.\r | |
157 | \r | |
158 | @return The pointer to the first instruction of a function given a function pointer.\r | |
159 | \r | |
160 | **/\r | |
1afe0401 | 161 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r |
ebd04fc2 | 162 | \r |
02eef553 JJ |
163 | #ifndef __USER_LABEL_PREFIX__\r |
164 | #define __USER_LABEL_PREFIX__\r | |
165 | #endif\r | |
166 | \r | |
ebd04fc2 | 167 | #endif\r |
4c8a6e06 | 168 | \r |
169 | \r |