1 /** 2 Based on Ia32/ProcessorBind.h file, original notice: 3 4 Processor or Compiler specific defines and types for IA-32 architecture. 5 6 Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved. 7 This program and the accompanying materials 8 are licensed and made available under the terms and conditions of the BSD License 9 which accompanies this distribution. The full text of the license may be found at 10 http://opensource.org/licenses/bsd-license.php 11 12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 14 **/ 15 module uefi.ia32.bind; 16 17 version (X86) 18 { 19 public: 20 extern (C): 21 22 /// void 23 alias VOID = void; 24 25 /// 8-byte unsigned value 26 alias UINT64 = ulong; 27 28 /// 4-byte unsigned value 29 alias UINT32 = uint; 30 31 /// 2-byte unsigned value 32 alias UINT16 = ushort; 33 34 /// 1-byte unsigned value 35 alias UINT8 = ubyte; 36 37 /// 8-byte signed value 38 alias INT64 = long; 39 40 /// 4-byte signed value 41 alias INT32 = int; 42 43 /// 2-byte signed value 44 alias INT16 = short; 45 46 /// 1-byte signed value 47 alias INT8 = byte; 48 49 /// 1-byte character 50 alias CHAR8 = char; 51 52 /// 2-byte Character. Unless otherwise specified all strings are stored in the 53 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards. 54 alias CHAR16 = wchar; 55 56 /// Logical Boolean. 1-byte value containing 0 for FALSE or a 1 for TRUE. Other 57 /// values are undefined. 58 alias BOOLEAN = ubyte; 59 60 /// Unsigned value of native width. (4 bytes on supported 32-bit processor instructions, 61 /// 8 bytes on supported 64-bit processor instructions) 62 alias UINTN = UINT32; 63 64 /// Signed value of native width. (4 bytes on supported 32-bit processor instructions, 65 /// 8 bytes on supported 64-bit processor instructions) 66 alias INTN = INT32; 67 68 /// A value of native width with the highest bit set. 69 enum MAX_BIT = 0x8000_0000; 70 71 /// A value of native width with the two highest bits set. 72 enum MAX_2_BITS = 0xC000_0000; 73 74 /// Maximum legal x64 address 75 enum MAX_ADDRESS = 0xFFFF_FFFF; 76 77 /// Maximum legal x64 INTN and UINTN values. 78 enum MAX_INTN = INTN.max; 79 /// ditto 80 enum MAX_UINTN = UINTN.max; 81 82 /// The stack alignment required for x64 83 enum CPU_STACK_ALIGNMENT = 4; 84 85 /** 86 Return the pointer to the first instruction of a function given a function pointer. 87 On IA-32 CPU architectures, these two pointer values are the same, 88 so the implementation of this macro is very simple. 89 90 Params: 91 FunctionPointer = A pointer to a function. 92 93 Returns: The pointer to the first instruction of a function given a function pointer. 94 95 **/ 96 void* FUNCTION_ENTRY_POINT(T)(T fptr) if (is(T == function)) 97 { 98 return cast(void*)(fptr); 99 } 100 }