]>
Commit | Line | Data |
---|---|---|
f51461c8 LG |
1 | /** @file\r |
2 | Processor or Compiler specific defines and types for ARM.\r | |
3 | \r | |
f7496d71 | 4 | Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r |
f51461c8 | 5 | Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r |
f7496d71 LG |
6 | This program and the accompanying materials\r |
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 | |
f51461c8 | 10 | \r |
f7496d71 LG |
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 | |
f51461c8 LG |
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 | |
25 | // Make sure we are using the correct packing rules per EFI specification\r | |
26 | //\r | |
27 | #ifndef __GNUC__\r | |
28 | #pragma pack()\r | |
29 | #endif\r | |
30 | \r | |
f7496d71 | 31 | #if _MSC_EXTENSIONS\r |
f51461c8 | 32 | //\r |
f7496d71 | 33 | // use Microsoft* C complier dependent integer width types\r |
f51461c8 LG |
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 | |
45 | typedef signed char INT8;\r | |
46 | #else\r | |
47 | //\r | |
f7496d71 | 48 | // Assume standard ARM alignment.\r |
f51461c8 LG |
49 | //\r |
50 | typedef unsigned long long UINT64;\r | |
51 | typedef long long INT64;\r | |
52 | typedef unsigned int UINT32;\r | |
53 | typedef int INT32;\r | |
54 | typedef unsigned short UINT16;\r | |
55 | typedef unsigned short CHAR16;\r | |
56 | typedef short INT16;\r | |
57 | typedef unsigned char BOOLEAN;\r | |
58 | typedef unsigned char UINT8;\r | |
59 | typedef char CHAR8;\r | |
60 | typedef signed char INT8;\r | |
61 | \r | |
62 | #define UINT8_MAX 0xff\r | |
63 | #endif\r | |
64 | \r | |
65 | ///\r | |
66 | /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions,\r | |
67 | /// 8 bytes on supported 64-bit processor instructions)\r | |
68 | ///\r | |
69 | typedef UINT32 UINTN;\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 | ///\r | |
75 | typedef INT32 INTN;\r | |
76 | \r | |
77 | //\r | |
78 | // Processor specific defines\r | |
79 | //\r | |
80 | \r | |
81 | ///\r | |
82 | /// A value of native width with the highest bit set.\r | |
83 | ///\r | |
84 | #define MAX_BIT 0x80000000\r | |
85 | \r | |
86 | ///\r | |
87 | /// A value of native width with the two highest bits set.\r | |
88 | ///\r | |
89 | #define MAX_2_BITS 0xC0000000\r | |
90 | \r | |
f51461c8 LG |
91 | ///\r |
92 | /// The stack alignment required for ARM\r | |
93 | ///\r | |
94 | #define CPU_STACK_ALIGNMENT sizeof(UINT64)\r | |
95 | \r | |
96 | //\r | |
97 | // Modifier to ensure that all protocol member functions and EFI intrinsics\r | |
98 | // use the correct C calling convention. All protocol member functions and\r | |
99 | // EFI intrinsics are required to modify their member functions with EFIAPI.\r | |
100 | //\r | |
f7496d71 | 101 | #define EFIAPI\r |
f51461c8 LG |
102 | \r |
103 | #if defined(__GNUC__)\r | |
104 | ///\r | |
105 | /// For GNU assembly code, .global or .globl can declare global symbols.\r | |
106 | /// Define this macro to unify the usage.\r | |
107 | ///\r | |
108 | #define ASM_GLOBAL .globl\r | |
109 | \r | |
110 | #if !defined(__APPLE__)\r | |
111 | ///\r | |
112 | /// ARM EABI defines that the linker should not manipulate call relocations\r | |
113 | /// (do bl/blx conversion) unless the target symbol has function type.\r | |
114 | /// CodeSourcery 2010.09 started requiring the .type to function properly\r | |
115 | ///\r | |
116 | #define INTERWORK_FUNC(func__) .type ASM_PFX(func__), %function\r | |
117 | \r | |
118 | #define GCC_ASM_EXPORT(func__) \\r | |
119 | .global _CONCATENATE (__USER_LABEL_PREFIX__, func__) ;\\r | |
f7496d71 | 120 | .type ASM_PFX(func__), %function\r |
f51461c8 LG |
121 | \r |
122 | #define GCC_ASM_IMPORT(func__) \\r | |
123 | .extern _CONCATENATE (__USER_LABEL_PREFIX__, func__)\r | |
f7496d71 | 124 | \r |
f51461c8 LG |
125 | #else\r |
126 | //\r | |
f7496d71 | 127 | // .type not supported by Apple Xcode tools\r |
f51461c8 | 128 | //\r |
f7496d71 | 129 | #define INTERWORK_FUNC(func__)\r |
f51461c8 LG |
130 | \r |
131 | #define GCC_ASM_EXPORT(func__) \\r | |
132 | .globl _CONCATENATE (__USER_LABEL_PREFIX__, func__) \\r | |
f7496d71 LG |
133 | \r |
134 | #define GCC_ASM_IMPORT(name)\r | |
f51461c8 LG |
135 | \r |
136 | #endif\r | |
137 | #endif\r | |
138 | \r | |
139 | /**\r | |
140 | Return the pointer to the first instruction of a function given a function pointer.\r | |
f7496d71 | 141 | On ARM CPU architectures, these two pointer values are the same,\r |
f51461c8 | 142 | so the implementation of this macro is very simple.\r |
f7496d71 | 143 | \r |
f51461c8 LG |
144 | @param FunctionPointer A pointer to a function.\r |
145 | \r | |
146 | @return The pointer to the first instruction of a function given a function pointer.\r | |
f7496d71 | 147 | \r |
f51461c8 LG |
148 | **/\r |
149 | #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)\r | |
150 | \r | |
151 | #endif\r | |
152 | \r | |
153 | \r |