1 /*----------------------------------------------------------------------------- 2 * config/eaplatform.h 3 * 4 * Copyright (c) Electronic Arts Inc. All rights reserved. 5 *----------------------------------------------------------------------------- 6 * Currently supported platform indentification defines include: 7 */ 8 #ifdef EA_PLATFORM_PS4 // ifdef for code stripping purposes 9 // EA_PLATFORM_PS4 (EA_PLATFORM_KETTLE) 10 #endif 11 #ifdef EA_PLATFORM_XBOXONE // ifdef for code stripping purposes 12 // EA_PLATFORM_XBOXONE (EA_PLATFORM_CAPILANO) 13 // EA_PLATFORM_XBOXONE_XDK (EA_PLATFORM_CAPILANO_XDK), set by capilano_config package 14 // EA_PLATFORM_XBOXONE_ADK (EA_PLATFORM_CAPILANO_ADK), set by capilano_config package 15 #endif 16 // EA_PLATFORM_ANDROID 17 // EA_PLATFORM_APPLE 18 // EA_PLATFORM_IPHONE 19 // EA_PLATFORM_IPHONE_SIMULATOR 20 // EA_PLATFORM_OSX 21 // EA_PLATFORM_LINUX 22 // EA_PLATFORM_SAMSUNG_TV 23 // EA_PLATFORM_WINDOWS 24 // EA_PLATFORM_WIN32 25 // EA_PLATFORM_WIN64 26 // EA_PLATFORM_WINDOWS_PHONE 27 // EA_PLATFORM_WINRT 28 // EA_PLATFORM_SUN 29 // EA_PLATFORM_LRB (Larrabee) 30 // EA_PLATFORM_POSIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX, EA_PLATFORM_UNIX, EA_PLATFORM_QNX) 31 // EA_PLATFORM_UNIX (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX) 32 // EA_PLATFORM_CYGWIN (pseudo-platform; may be defined along with another platform like EA_PLATFORM_LINUX) 33 // EA_PLATFORM_MINGW (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS) 34 // EA_PLATFORM_MICROSOFT (pseudo-platform; may be defined along with another platform like EA_PLATFORM_WINDOWS) 35 // 36 // EA_ABI_ARM_LINUX (a.k.a. "eabi". for all platforms that use the CodeSourcery GNU/Linux toolchain, like Android) 37 // EA_ABI_ARM_APPLE (similar to eabi but not identical) 38 // EA_ABI_ARM64_APPLE (similar to eabi but not identical) https://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/Articles/ARM64FunctionCallingConventions.html 39 // EA_ABI_ARM_WINCE (similar to eabi but not identical) 40 // 41 // Other definitions emanated from this file inclue: 42 // EA_PLATFORM_NAME = <string> 43 // EA_PLATFORM_DESCRIPTION = <string> 44 // EA_PROCESSOR_XXX 45 // EA_MISALIGNED_SUPPORT_LEVEL=0|1|2 46 // EA_SYSTEM_LITTLE_ENDIAN | EA_SYSTEM_BIG_ENDIAN 47 // EA_ASM_STYLE_ATT | EA_ASM_STYLE_INTEL | EA_ASM_STYLE_MOTOROLA 48 // EA_PLATFORM_PTR_SIZE = <integer size in bytes> 49 // EA_PLATFORM_WORD_SIZE = <integer size in bytes> 50 // EA_CACHE_LINE_SIZE = <integer size in bytes> 51 //--------------------------------------------------------------------------- 52 53 /* 54 EA_PLATFORM_MOBILE 55 EA_PLATFORM_MOBILE is a peer to EA_PLATORM_DESKTOP and EA_PLATFORM_CONSOLE. Their definition is qualitative rather 56 than quantitative, and refers to the general (usually weaker) capabilities of the machine. Mobile devices have a 57 similar set of weaknesses that are useful to generally categorize. The primary motivation is to avoid code that 58 tests for multiple mobile platforms on a line and needs to be updated every time we get a new one. 59 For example, mobile platforms tend to have weaker ARM processors, don't have full multiple processor support, 60 are hand-held, don't have mice (though may have touch screens or basic cursor controls), have writable solid 61 state permanent storage. Production user code shouldn't have too many expectations about the meaning of this define. 62 63 EA_PLATFORM_DESKTOP 64 This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are powerful. 65 For example, they nearly always have virtual memory, mapped memory, hundreds of GB of writable disk storage, 66 TCP/IP network connections, mice, keyboards, 512+ MB of RAM, multiprocessing, multiple display support. 67 Production user code shouldn't have too many expectations about the meaning of this define. 68 69 EA_PLATFORM_CONSOLE 70 This is similar to EA_PLATFORM_MOBILE in its qualitative nature and refers to platforms that are consoles. 71 This means platforms that are connected to TVs, are fairly powerful (especially graphics-wise), are tightly 72 controlled by vendors, tend not to have mapped memory, tend to have TCP/IP, don't have multiple process support 73 though they might have multiple CPUs, support TV output only. Production user code shouldn't have too many 74 expectations about the meaning of this define. 75 76 */ 77 78 79 #ifndef INCLUDED_eaplatform_H 80 #define INCLUDED_eaplatform_H 81 82 83 // Cygwin 84 // This is a pseudo-platform which will be defined along with EA_PLATFORM_LINUX when 85 // using the Cygwin build environment. 86 #if defined(__CYGWIN__) 87 #define EA_PLATFORM_CYGWIN 1 88 #define EA_PLATFORM_DESKTOP 1 89 #endif 90 91 // MinGW 92 // This is a pseudo-platform which will be defined along with EA_PLATFORM_WINDOWS when 93 // using the MinGW Windows build environment. 94 #if defined(__MINGW32__) || defined(__MINGW64__) 95 #define EA_PLATFORM_MINGW 1 96 #define EA_PLATFORM_DESKTOP 1 97 #endif 98 99 #if defined(EA_PLATFORM_PS4) || defined(__ORBIS__) || defined(EA_PLATFORM_KETTLE) 100 // PlayStation 4 101 // Orbis was Sony's code-name for the platform, which is now obsolete. 102 // Kettle was an EA-specific code-name for the platform, which is now obsolete. 103 #if defined(EA_PLATFORM_PS4) 104 #undef EA_PLATFORM_PS4 105 #endif 106 #define EA_PLATFORM_PS4 1 107 108 // Backward compatibility: 109 #if defined(EA_PLATFORM_KETTLE) 110 #undef EA_PLATFORM_KETTLE 111 #endif 112 // End backward compatbility 113 114 #define EA_PLATFORM_KETTLE 1 115 #define EA_PLATFORM_NAME "PS4" 116 #define EA_SYSTEM_LITTLE_ENDIAN 1 117 #define EA_PLATFORM_DESCRIPTION "PS4 on x64" 118 #define EA_PLATFORM_CONSOLE 1 119 #define EA_PLATFORM_SONY 1 120 #define EA_PLATFORM_POSIX 1 121 // #define EA_POSIX_THREADS_AVAILABLE 1 // POSIX threading API is available but discouraged. Sony indicated use of the scePthreads* API is preferred. 122 #define EA_PROCESSOR_X86_64 1 123 #if defined(__GNUC__) || defined(__clang__) 124 #define EA_ASM_STYLE_ATT 1 125 #endif 126 127 128 #elif defined(EA_PLATFORM_XBOXONE) || defined(_DURANGO) || defined(EA_PLATFORM_CAPILANO) || (defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_GAMES || WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE)) 129 // XBox One 130 // Durango was Microsoft's code-name for the platform, which is now obsolete. 131 // Microsoft uses _DURANGO instead of some variation of _XBOX, though it's not natively defined by the compiler. 132 // Capilano was an EA-specific code-name for the platform, which is now obsolete. 133 #if defined(EA_PLATFORM_XBOXONE) 134 #undef EA_PLATFORM_XBOXONE 135 #endif 136 #define EA_PLATFORM_XBOXONE 1 137 138 // Backward compatibility: 139 #if defined(EA_PLATFORM_CAPILANO) 140 #undef EA_PLATFORM_CAPILANO 141 #endif 142 #define EA_PLATFORM_CAPILANO 1 143 #if defined(EA_PLATFORM_CAPILANO_XDK) && !defined(EA_PLATFORM_XBOXONE_XDK) 144 #define EA_PLATFORM_XBOXONE_XDK 1 145 #endif 146 #if defined(EA_PLATFORM_CAPILANO_ADK) && !defined(EA_PLATFORM_XBOXONE_ADK) 147 #define EA_PLATFORM_XBOXONE_ADK 1 148 #endif 149 // End backward compatibility 150 151 #if !defined(_DURANGO) 152 #define _DURANGO 153 #endif 154 #define EA_PLATFORM_NAME "XBox One" 155 //#define EA_PROCESSOR_X86 Currently our policy is that we don't define this, even though x64 is something of a superset of x86. 156 #define EA_PROCESSOR_X86_64 1 157 #define EA_SYSTEM_LITTLE_ENDIAN 1 158 #define EA_PLATFORM_DESCRIPTION "XBox One on x64" 159 #define EA_ASM_STYLE_INTEL 1 160 #define EA_PLATFORM_CONSOLE 1 161 #define EA_PLATFORM_MICROSOFT 1 162 163 // WINAPI_FAMILY defines - mirrored from winapifamily.h 164 #define EA_WINAPI_FAMILY_APP 1000 165 #define EA_WINAPI_FAMILY_DESKTOP_APP 1001 166 #define EA_WINAPI_FAMILY_PHONE_APP 1002 167 #define EA_WINAPI_FAMILY_TV_APP 1003 168 #define EA_WINAPI_FAMILY_TV_TITLE 1004 169 #define EA_WINAPI_FAMILY_GAMES 1006 170 171 #if defined(WINAPI_FAMILY) 172 #include <winapifamily.h> 173 #if WINAPI_FAMILY == WINAPI_FAMILY_TV_TITLE 174 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_TV_TITLE 175 #elif WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP 176 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP 177 #elif WINAPI_FAMILY == WINAPI_FAMILY_GAMES 178 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_GAMES 179 #else 180 #error Unsupported WINAPI_FAMILY 181 #endif 182 #else 183 #error WINAPI_FAMILY should always be defined on Capilano. 184 #endif 185 186 // Macro to determine if a partition is enabled. 187 #define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition) 188 189 #if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_DESKTOP_APP 190 #define EA_WINAPI_PARTITION_CORE 1 191 #define EA_WINAPI_PARTITION_DESKTOP 1 192 #define EA_WINAPI_PARTITION_APP 1 193 #define EA_WINAPI_PARTITION_PC_APP 0 194 #define EA_WIANPI_PARTITION_PHONE 0 195 #define EA_WINAPI_PARTITION_TV_APP 0 196 #define EA_WINAPI_PARTITION_TV_TITLE 0 197 #define EA_WINAPI_PARTITION_GAMES 0 198 #elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_TV_TITLE 199 #define EA_WINAPI_PARTITION_CORE 1 200 #define EA_WINAPI_PARTITION_DESKTOP 0 201 #define EA_WINAPI_PARTITION_APP 0 202 #define EA_WINAPI_PARTITION_PC_APP 0 203 #define EA_WIANPI_PARTITION_PHONE 0 204 #define EA_WINAPI_PARTITION_TV_APP 0 205 #define EA_WINAPI_PARTITION_TV_TITLE 1 206 #define EA_WINAPI_PARTITION_GAMES 0 207 #elif EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_GAMES 208 #define EA_WINAPI_PARTITION_CORE 1 209 #define EA_WINAPI_PARTITION_DESKTOP 0 210 #define EA_WINAPI_PARTITION_APP 0 211 #define EA_WINAPI_PARTITION_PC_APP 0 212 #define EA_WIANPI_PARTITION_PHONE 0 213 #define EA_WINAPI_PARTITION_TV_APP 0 214 #define EA_WINAPI_PARTITION_TV_TITLE 0 215 #define EA_WINAPI_PARTITION_GAMES 1 216 #else 217 #error Unsupported WINAPI_FAMILY 218 #endif 219 220 221 // Larrabee // This part to be removed once __LRB__ is supported by the Larrabee compiler in 2009. 222 #elif defined(EA_PLATFORM_LRB) || defined(__LRB__) || (defined(__EDG__) && defined(__ICC) && defined(__x86_64__)) 223 #undef EA_PLATFORM_LRB 224 #define EA_PLATFORM_LRB 1 225 #define EA_PLATFORM_NAME "Larrabee" 226 #define EA_PLATFORM_DESCRIPTION "Larrabee on LRB1" 227 #define EA_PROCESSOR_X86_64 1 228 #if defined(BYTE_ORDER) && (BYTE_ORDER == 4321) 229 #define EA_SYSTEM_BIG_ENDIAN 1 230 #else 231 #define EA_SYSTEM_LITTLE_ENDIAN 1 232 #endif 233 #define EA_PROCESSOR_LRB 1 234 #define EA_PROCESSOR_LRB1 1 // Larrabee version 1 235 #define EA_ASM_STYLE_ATT 1 // Both types of asm style 236 #define EA_ASM_STYLE_INTEL 1 // are supported. 237 #define EA_PLATFORM_DESKTOP 1 238 239 // Android (Google phone OS) 240 #elif defined(EA_PLATFORM_ANDROID) || defined(__ANDROID__) 241 #undef EA_PLATFORM_ANDROID 242 #define EA_PLATFORM_ANDROID 1 243 #define EA_PLATFORM_LINUX 1 244 #define EA_PLATFORM_UNIX 1 245 #define EA_PLATFORM_POSIX 1 246 #define EA_PLATFORM_NAME "Android" 247 #define EA_ASM_STYLE_ATT 1 248 #if defined(__arm__) 249 #define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi" 250 #define EA_PROCESSOR_ARM32 1 251 #define EA_PLATFORM_DESCRIPTION "Android on ARM" 252 #elif defined(__aarch64__) 253 #define EA_PROCESSOR_ARM64 1 254 #define EA_PLATFORM_DESCRIPTION "Android on ARM64" 255 #elif defined(__i386__) 256 #define EA_PROCESSOR_X86 1 257 #define EA_PLATFORM_DESCRIPTION "Android on x86" 258 #elif defined(__x86_64) 259 #define EA_PROCESSOR_X86_64 1 260 #define EA_PLATFORM_DESCRIPTION "Android on x64" 261 #else 262 #error Unknown processor 263 #endif 264 #if !defined(EA_SYSTEM_BIG_ENDIAN) && !defined(EA_SYSTEM_LITTLE_ENDIAN) 265 #define EA_SYSTEM_LITTLE_ENDIAN 1 266 #endif 267 #define EA_PLATFORM_MOBILE 1 268 269 // Samsung SMART TV - a Linux-based smart TV 270 #elif defined(EA_PLATFORM_SAMSUNG_TV) 271 #undef EA_PLATFORM_SAMSUNG_TV 272 #define EA_PLATFORM_SAMSUNG_TV 1 273 #define EA_PLATFORM_LINUX 1 274 #define EA_PLATFORM_UNIX 1 275 #define EA_PLATFORM_POSIX 1 276 #define EA_PLATFORM_NAME "SamsungTV" 277 #define EA_PLATFORM_DESCRIPTION "Samsung SMART TV on ARM" 278 #define EA_ASM_STYLE_ATT 1 279 #define EA_SYSTEM_LITTLE_ENDIAN 1 280 #define EA_PROCESSOR_ARM32 1 281 #define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi" 282 #define EA_PROCESSOR_ARM7 1 283 284 #elif defined(__APPLE__) && __APPLE__ 285 #include <TargetConditionals.h> 286 287 // Apple family of operating systems. 288 #define EA_PLATFORM_APPLE 289 #define EA_PLATFORM_POSIX 1 290 291 // iPhone 292 // TARGET_OS_IPHONE will be undefined on an unknown compiler, and will be defined on gcc. 293 #if defined(EA_PLATFORM_IPHONE) || defined(__IPHONE__) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR) 294 #undef EA_PLATFORM_IPHONE 295 #define EA_PLATFORM_IPHONE 1 296 #define EA_PLATFORM_NAME "iPhone" 297 #define EA_ASM_STYLE_ATT 1 298 #define EA_POSIX_THREADS_AVAILABLE 1 299 #if defined(__arm__) 300 #define EA_ABI_ARM_APPLE 1 301 #define EA_PROCESSOR_ARM32 1 302 #define EA_SYSTEM_LITTLE_ENDIAN 1 303 #define EA_PLATFORM_DESCRIPTION "iPhone on ARM" 304 #elif defined(__aarch64__) || defined(__AARCH64) 305 #define EA_ABI_ARM64_APPLE 1 306 #define EA_PROCESSOR_ARM64 1 307 #define EA_SYSTEM_LITTLE_ENDIAN 1 308 #define EA_PLATFORM_DESCRIPTION "iPhone on ARM64" 309 #elif defined(__i386__) 310 #define EA_PLATFORM_IPHONE_SIMULATOR 1 311 #define EA_PROCESSOR_X86 1 312 #define EA_SYSTEM_LITTLE_ENDIAN 1 313 #define EA_PLATFORM_DESCRIPTION "iPhone simulator on x86" 314 #elif defined(__x86_64) || defined(__amd64) 315 #define EA_PROCESSOR_X86_64 1 316 #define EA_SYSTEM_LITTLE_ENDIAN 1 317 #define EA_PLATFORM_DESCRIPTION "iPhone simulator on x64" 318 #else 319 #error Unknown processor 320 #endif 321 #define EA_PLATFORM_MOBILE 1 322 323 // Macintosh OSX 324 // TARGET_OS_MAC is defined by the Metrowerks and older AppleC compilers. 325 // Howerver, TARGET_OS_MAC is defined to be 1 in all cases. 326 // __i386__ and __intel__ are defined by the GCC compiler. 327 // __dest_os is defined by the Metrowerks compiler. 328 // __MACH__ is defined by the Metrowerks and GCC compilers. 329 // powerc and __powerc are defined by the Metrowerks and GCC compilers. 330 #elif defined(EA_PLATFORM_OSX) || defined(__MACH__) || (defined(__MSL__) && (__dest_os == __mac_os_x)) 331 #undef EA_PLATFORM_OSX 332 #define EA_PLATFORM_OSX 1 333 #define EA_PLATFORM_UNIX 1 334 #define EA_PLATFORM_POSIX 1 335 //#define EA_PLATFORM_BSD 1 We don't currently define this. OSX has some BSD history but a lot of the API is different. 336 #define EA_PLATFORM_NAME "OSX" 337 #if defined(__i386__) || defined(__intel__) 338 #define EA_PROCESSOR_X86 1 339 #define EA_SYSTEM_LITTLE_ENDIAN 1 340 #define EA_PLATFORM_DESCRIPTION "OSX on x86" 341 #elif defined(__x86_64) || defined(__amd64) 342 #define EA_PROCESSOR_X86_64 1 343 #define EA_SYSTEM_LITTLE_ENDIAN 1 344 #define EA_PLATFORM_DESCRIPTION "OSX on x64" 345 #elif defined(__arm__) 346 #define EA_ABI_ARM_APPLE 1 347 #define EA_PROCESSOR_ARM32 1 348 #define EA_SYSTEM_LITTLE_ENDIAN 1 349 #define EA_PLATFORM_DESCRIPTION "OSX on ARM" 350 #elif defined(__aarch64__) || defined(__AARCH64) 351 #define EA_ABI_ARM64_APPLE 1 352 #define EA_PROCESSOR_ARM64 1 353 #define EA_SYSTEM_LITTLE_ENDIAN 1 354 #define EA_PLATFORM_DESCRIPTION "OSX on ARM64" 355 #elif defined(__POWERPC64__) || defined(__powerpc64__) 356 #define EA_PROCESSOR_POWERPC 1 357 #define EA_PROCESSOR_POWERPC_64 1 358 #define EA_SYSTEM_BIG_ENDIAN 1 359 #define EA_PLATFORM_DESCRIPTION "OSX on PowerPC 64" 360 #elif defined(__POWERPC__) || defined(__powerpc__) 361 #define EA_PROCESSOR_POWERPC 1 362 #define EA_PROCESSOR_POWERPC_32 1 363 #define EA_SYSTEM_BIG_ENDIAN 1 364 #define EA_PLATFORM_DESCRIPTION "OSX on PowerPC" 365 #else 366 #error Unknown processor 367 #endif 368 #if defined(__GNUC__) 369 #define EA_ASM_STYLE_ATT 1 370 #else 371 #define EA_ASM_STYLE_MOTOROLA 1 372 #endif 373 #define EA_PLATFORM_DESKTOP 1 374 #else 375 #error Unknown Apple Platform 376 #endif 377 378 // Linux 379 // __linux and __linux__ are defined by the GCC and Borland compiler. 380 // __i386__ and __intel__ are defined by the GCC compiler. 381 // __i386__ is defined by the Metrowerks compiler. 382 // _M_IX86 is defined by the Borland compiler. 383 // __sparc__ is defined by the GCC compiler. 384 // __powerpc__ is defined by the GCC compiler. 385 // __ARM_EABI__ is defined by GCC on an ARM v6l (Raspberry Pi 1) 386 // __ARM_ARCH_7A__ is defined by GCC on an ARM v7l (Raspberry Pi 2) 387 #elif defined(EA_PLATFORM_LINUX) || (defined(__linux) || defined(__linux__)) 388 #undef EA_PLATFORM_LINUX 389 #define EA_PLATFORM_LINUX 1 390 #define EA_PLATFORM_UNIX 1 391 #define EA_PLATFORM_POSIX 1 392 #define EA_PLATFORM_NAME "Linux" 393 #if defined(__i386__) || defined(__intel__) || defined(_M_IX86) 394 #define EA_PROCESSOR_X86 1 395 #define EA_SYSTEM_LITTLE_ENDIAN 1 396 #define EA_PLATFORM_DESCRIPTION "Linux on x86" 397 #elif defined(__ARM_ARCH_7A__) || defined(__ARM_EABI__) 398 #define EA_ABI_ARM_LINUX 1 399 #define EA_PROCESSOR_ARM32 1 400 #define EA_PLATFORM_DESCRIPTION "Linux on ARM 6/7 32-bits" 401 #elif defined(__aarch64__) || defined(__AARCH64) 402 #define EA_PROCESSOR_ARM64 1 403 #define EA_PLATFORM_DESCRIPTION "Linux on ARM64" 404 #elif defined(__x86_64__) 405 #define EA_PROCESSOR_X86_64 1 406 #define EA_SYSTEM_LITTLE_ENDIAN 1 407 #define EA_PLATFORM_DESCRIPTION "Linux on x64" 408 #elif defined(__powerpc64__) 409 #define EA_PROCESSOR_POWERPC 1 410 #define EA_PROCESSOR_POWERPC_64 1 411 #define EA_SYSTEM_BIG_ENDIAN 1 412 #define EA_PLATFORM_DESCRIPTION "Linux on PowerPC 64" 413 #elif defined(__powerpc__) 414 #define EA_PROCESSOR_POWERPC 1 415 #define EA_PROCESSOR_POWERPC_32 1 416 #define EA_SYSTEM_BIG_ENDIAN 1 417 #define EA_PLATFORM_DESCRIPTION "Linux on PowerPC" 418 #else 419 #error Unknown processor 420 #error Unknown endianness 421 #endif 422 #if defined(__GNUC__) 423 #define EA_ASM_STYLE_ATT 1 424 #endif 425 #define EA_PLATFORM_DESKTOP 1 426 427 428 #elif defined(EA_PLATFORM_BSD) || (defined(__BSD__) || defined(__FreeBSD__) || defined(__DragonFly__)) 429 #undef EA_PLATFORM_BSD 430 #define EA_PLATFORM_BSD 1 431 #define EA_PLATFORM_UNIX 1 432 #define EA_PLATFORM_POSIX 1 // BSD's posix complaince is not identical to Linux's 433 #define EA_PLATFORM_NAME "BSD Unix" 434 #if defined(__i386__) || defined(__intel__) 435 #define EA_PROCESSOR_X86 1 436 #define EA_SYSTEM_LITTLE_ENDIAN 1 437 #define EA_PLATFORM_DESCRIPTION "BSD on x86" 438 #elif defined(__x86_64__) 439 #define EA_PROCESSOR_X86_64 1 440 #define EA_SYSTEM_LITTLE_ENDIAN 1 441 #define EA_PLATFORM_DESCRIPTION "BSD on x64" 442 #elif defined(__powerpc64__) 443 #define EA_PROCESSOR_POWERPC 1 444 #define EA_PROCESSOR_POWERPC_64 1 445 #define EA_SYSTEM_BIG_ENDIAN 1 446 #define EA_PLATFORM_DESCRIPTION "BSD on PowerPC 64" 447 #elif defined(__powerpc__) 448 #define EA_PROCESSOR_POWERPC 1 449 #define EA_PROCESSOR_POWERPC_32 1 450 #define EA_SYSTEM_BIG_ENDIAN 1 451 #define EA_PLATFORM_DESCRIPTION "BSD on PowerPC" 452 #elif defined(__arm__) 453 #define EA_ABI_ARM_LINUX 1 // a.k.a. "ARM eabi" 454 #define EA_PROCESSOR_ARM32 1 455 #define EA_SYSTEM_LITTLE_ENDIAN 1 456 #define EA_PLATFORM_DESCRIPTION "BSD on ARM" 457 #else 458 #error Unknown processor 459 #error Unknown endianness 460 #endif 461 #if !defined(EA_PLATFORM_FREEBSD) && defined(__FreeBSD__) 462 #define EA_PLATFORM_FREEBSD 1 // This is a variation of BSD. 463 #endif 464 #if defined(__GNUC__) 465 #define EA_ASM_STYLE_ATT 1 466 #endif 467 #define EA_PLATFORM_DESKTOP 1 468 469 470 #elif defined(EA_PLATFORM_WINDOWS_PHONE) 471 #undef EA_PLATFORM_WINDOWS_PHONE 472 #define EA_PLATFORM_WINDOWS_PHONE 1 473 #define EA_PLATFORM_NAME "Windows Phone" 474 #if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__) 475 #define EA_PROCESSOR_X86_64 1 476 #define EA_SYSTEM_LITTLE_ENDIAN 1 477 #define EA_PLATFORM_DESCRIPTION "Windows Phone on x64" 478 #elif defined(_M_IX86) || defined(_X86_) 479 #define EA_PROCESSOR_X86 1 480 #define EA_SYSTEM_LITTLE_ENDIAN 1 481 #define EA_PLATFORM_DESCRIPTION "Windows Phone on X86" 482 #elif defined(_M_ARM) 483 #define EA_ABI_ARM_WINCE 1 484 #define EA_PROCESSOR_ARM32 1 485 #define EA_SYSTEM_LITTLE_ENDIAN 1 486 #define EA_PLATFORM_DESCRIPTION "Windows Phone on ARM" 487 #else //Possibly other Windows Phone variants 488 #error Unknown processor 489 #error Unknown endianness 490 #endif 491 #define EA_PLATFORM_MICROSOFT 1 492 493 // WINAPI_FAMILY defines - mirrored from winapifamily.h 494 #define EA_WINAPI_FAMILY_APP 1 495 #define EA_WINAPI_FAMILY_DESKTOP_APP 2 496 #define EA_WINAPI_FAMILY_PHONE_APP 3 497 498 #if defined(WINAPI_FAMILY) 499 #include <winapifamily.h> 500 #if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP 501 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_PHONE_APP 502 #else 503 #error Unsupported WINAPI_FAMILY for Windows Phone 504 #endif 505 #else 506 #error WINAPI_FAMILY should always be defined on Windows Phone. 507 #endif 508 509 // Macro to determine if a partition is enabled. 510 #define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition) 511 512 // Enable the appropriate partitions for the current family 513 #if EA_WINAPI_FAMILY == EA_WINAPI_FAMILY_PHONE_APP 514 # define EA_WINAPI_PARTITION_CORE 1 515 # define EA_WINAPI_PARTITION_PHONE 1 516 # define EA_WINAPI_PARTITION_APP 1 517 #else 518 # error Unsupported WINAPI_FAMILY for Windows Phone 519 #endif 520 521 522 // Windows 523 // _WIN32 is defined by the VC++, Intel and GCC compilers. 524 // _WIN64 is defined by the VC++, Intel and GCC compilers. 525 // __WIN32__ is defined by the Borland compiler. 526 // __INTEL__ is defined by the Metrowerks compiler. 527 // _M_IX86, _M_AMD64 and _M_IA64 are defined by the VC++, Intel, and Borland compilers. 528 // _X86_, _AMD64_, and _IA64_ are defined by the Metrowerks compiler. 529 // _M_ARM is defined by the VC++ compiler. 530 #elif (defined(EA_PLATFORM_WINDOWS) || (defined(_WIN32) || defined(__WIN32__) || defined(_WIN64))) && !defined(CS_UNDEFINED_STRING) 531 #undef EA_PLATFORM_WINDOWS 532 #define EA_PLATFORM_WINDOWS 1 533 #define EA_PLATFORM_NAME "Windows" 534 #ifdef _WIN64 // VC++ defines both _WIN32 and _WIN64 when compiling for Win64. 535 #define EA_PLATFORM_WIN64 1 536 #else 537 #define EA_PLATFORM_WIN32 1 538 #endif 539 #if defined(_M_AMD64) || defined(_AMD64_) || defined(__x86_64__) 540 #define EA_PROCESSOR_X86_64 1 541 #define EA_SYSTEM_LITTLE_ENDIAN 1 542 #define EA_PLATFORM_DESCRIPTION "Windows on x64" 543 #elif defined(_M_IX86) || defined(_X86_) 544 #define EA_PROCESSOR_X86 1 545 #define EA_SYSTEM_LITTLE_ENDIAN 1 546 #define EA_PLATFORM_DESCRIPTION "Windows on X86" 547 #elif defined(_M_IA64) || defined(_IA64_) 548 #define EA_PROCESSOR_IA64 1 549 #define EA_SYSTEM_LITTLE_ENDIAN 1 550 #define EA_PLATFORM_DESCRIPTION "Windows on IA-64" 551 #elif defined(_M_ARM) 552 #define EA_ABI_ARM_WINCE 1 553 #define EA_PROCESSOR_ARM32 1 554 #define EA_SYSTEM_LITTLE_ENDIAN 1 555 #define EA_PLATFORM_DESCRIPTION "Windows on ARM" 556 #else //Possibly other Windows CE variants 557 #error Unknown processor 558 #error Unknown endianness 559 #endif 560 #if defined(__GNUC__) 561 #define EA_ASM_STYLE_ATT 1 562 #elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__ICL) 563 #define EA_ASM_STYLE_INTEL 1 564 #endif 565 #define EA_PLATFORM_DESKTOP 1 566 #define EA_PLATFORM_MICROSOFT 1 567 568 // WINAPI_FAMILY defines to support Windows 8 Metro Apps - mirroring winapifamily.h in the Windows 8 SDK 569 #define EA_WINAPI_FAMILY_APP 1000 570 #define EA_WINAPI_FAMILY_DESKTOP_APP 1001 571 572 #if defined(WINAPI_FAMILY) 573 #if defined(_MSC_VER) 574 #pragma warning(push, 0) 575 #endif 576 #include <winapifamily.h> 577 #if defined(_MSC_VER) 578 #pragma warning(pop) 579 #endif 580 #if WINAPI_FAMILY == WINAPI_FAMILY_DESKTOP_APP 581 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP 582 #elif WINAPI_FAMILY == WINAPI_FAMILY_APP 583 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_APP 584 #else 585 #error Unsupported WINAPI_FAMILY 586 #endif 587 #else 588 #define EA_WINAPI_FAMILY EA_WINAPI_FAMILY_DESKTOP_APP 589 #endif 590 591 #define EA_WINAPI_PARTITION_DESKTOP 1 592 #define EA_WINAPI_PARTITION_APP 1 593 594 #define EA_WINAPI_FAMILY_PARTITION(Partition) (Partition) 595 596 // EA_PLATFORM_WINRT 597 // This is a subset of Windows which is used for tablets and the "Metro" (restricted) Windows user interface. 598 // WinRT doesn't doesn't have access to the Windows "desktop" API, but WinRT can nevertheless run on 599 // desktop computers in addition to tablets. The Windows Phone API is a subset of WinRT and is not included 600 // in it due to it being only a part of the API. 601 #if (defined(EA_PLATFORM_WINDOWS) && !EA_WINAPI_FAMILY_PARTITION(EA_WINAPI_PARTITION_DESKTOP)) 602 #define EA_PLATFORM_WINRT 1 603 #endif 604 605 // Sun (Solaris) 606 // __SUNPRO_CC is defined by the Sun compiler. 607 // __sun is defined by the GCC compiler. 608 // __i386 is defined by the Sun and GCC compilers. 609 // __sparc is defined by the Sun and GCC compilers. 610 #else 611 #error Unknown platform 612 #error Unknown processor 613 #error Unknown endianness 614 #endif 615 616 #ifndef EA_PROCESSOR_ARM 617 #if defined(EA_PROCESSOR_ARM32) || defined(EA_PROCESSOR_ARM64) || defined(EA_PROCESSOR_ARM7) 618 #define EA_PROCESSOR_ARM 619 #endif 620 #endif 621 622 // EA_PLATFORM_PTR_SIZE 623 // Platform pointer size; same as sizeof(void*). 624 // This is not the same as sizeof(int), as int is usually 32 bits on 625 // even 64 bit platforms. 626 // 627 // _WIN64 is defined by Win64 compilers, such as VC++. 628 // _M_IA64 is defined by VC++ and Intel compilers for IA64 processors. 629 // __LP64__ is defined by HP compilers for the LP64 standard. 630 // _LP64 is defined by the GCC and Sun compilers for the LP64 standard. 631 // __ia64__ is defined by the GCC compiler for IA64 processors. 632 // __arch64__ is defined by the Sparc compiler for 64 bit processors. 633 // __mips64__ is defined by the GCC compiler for MIPS processors. 634 // __powerpc64__ is defined by the GCC compiler for PowerPC processors. 635 // __64BIT__ is defined by the AIX compiler for 64 bit processors. 636 // __sizeof_ptr is defined by the ARM compiler (armcc, armcpp). 637 // 638 #ifndef EA_PLATFORM_PTR_SIZE 639 #if defined(__WORDSIZE) // Defined by some variations of GCC. 640 #define EA_PLATFORM_PTR_SIZE ((__WORDSIZE) / 8) 641 #elif defined(_WIN64) || defined(__LP64__) || defined(_LP64) || defined(_M_IA64) || defined(__ia64__) || defined(__arch64__) || defined(__aarch64__) || defined(__mips64__) || defined(__64BIT__) || defined(__Ptr_Is_64) 642 #define EA_PLATFORM_PTR_SIZE 8 643 #elif defined(__CC_ARM) && (__sizeof_ptr == 8) 644 #define EA_PLATFORM_PTR_SIZE 8 645 #else 646 #define EA_PLATFORM_PTR_SIZE 4 647 #endif 648 #endif 649 650 651 652 // EA_PLATFORM_WORD_SIZE 653 // This defines the size of a machine word. This will be the same as 654 // the size of registers on the machine but not necessarily the same 655 // as the size of pointers on the machine. A number of 64 bit platforms 656 // have 64 bit registers but 32 bit pointers. 657 // 658 #ifndef EA_PLATFORM_WORD_SIZE 659 #define EA_PLATFORM_WORD_SIZE EA_PLATFORM_PTR_SIZE 660 #endif 661 662 // EA_PLATFORM_MIN_MALLOC_ALIGNMENT 663 // This defines the minimal alignment that the platform's malloc 664 // implementation will return. This should be used when writing custom 665 // allocators to ensure that the alignment matches that of malloc 666 #ifndef EA_PLATFORM_MIN_MALLOC_ALIGNMENT 667 #if defined(EA_PLATFORM_APPLE) 668 #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 16 669 #elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_ARM) 670 #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8 671 #elif defined(EA_PLATFORM_ANDROID) && defined(EA_PROCESSOR_X86_64) 672 #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT 8 673 #else 674 #define EA_PLATFORM_MIN_MALLOC_ALIGNMENT (EA_PLATFORM_PTR_SIZE * 2) 675 #endif 676 #endif 677 678 679 // EA_MISALIGNED_SUPPORT_LEVEL 680 // Specifies if the processor can read and write built-in types that aren't 681 // naturally aligned. 682 // 0 - not supported. Likely causes an exception. 683 // 1 - supported but slow. 684 // 2 - supported and fast. 685 // 686 #ifndef EA_MISALIGNED_SUPPORT_LEVEL 687 #if defined(EA_PROCESSOR_X86_64) 688 #define EA_MISALIGNED_SUPPORT_LEVEL 2 689 #else 690 #define EA_MISALIGNED_SUPPORT_LEVEL 0 691 #endif 692 #endif 693 694 // Macro to determine if a Windows API partition is enabled. Always false on non Microsoft platforms. 695 #if !defined(EA_WINAPI_FAMILY_PARTITION) 696 #define EA_WINAPI_FAMILY_PARTITION(Partition) (0) 697 #endif 698 699 700 // EA_CACHE_LINE_SIZE 701 // Specifies the cache line size broken down by compile target. 702 // This the expected best guess values for the targets that we can make at compilation time. 703 704 #ifndef EA_CACHE_LINE_SIZE 705 #if defined(EA_PROCESSOR_X86) 706 #define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value. 707 #elif defined(EA_PROCESSOR_X86_64) 708 #define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value 709 #elif defined(EA_PROCESSOR_ARM32) 710 #define EA_CACHE_LINE_SIZE 32 // This varies between implementations and is usually 32 or 64. 711 #elif defined(EA_PROCESSOR_ARM64) 712 #define EA_CACHE_LINE_SIZE 64 // Cache line Cortex-A8 (64 bytes) http://shervinemami.info/armAssembly.html however this remains to be mostly an assumption at this stage 713 #elif (EA_PLATFORM_WORD_SIZE == 4) 714 #define EA_CACHE_LINE_SIZE 32 // This is the minimum possible value 715 #else 716 #define EA_CACHE_LINE_SIZE 64 // This is the minimum possible value 717 #endif 718 #endif 719 720 721 #endif // INCLUDED_eaplatform_H 722 723 724 725 726 727 728 729 730 731