Home | History | Annotate | Download | only in Ebc
      1 /** @file
      2   Processor or compiler specific defines and types for EBC.
      3 
      4   We currently only have one EBC compiler so there may be some Intel compiler
      5   specific functions in this file.
      6 
      7 Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
      8 This program and the accompanying materials are licensed and made available under
      9 the terms and conditions of the BSD License that accompanies this distribution.
     10 The full text of the license may be found at
     11 http://opensource.org/licenses/bsd-license.php.
     12 
     13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
     14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
     15 
     16 **/
     17 
     18 #ifndef __PROCESSOR_BIND_H__
     19 #define __PROCESSOR_BIND_H__
     20 
     21 ///
     22 /// Define the processor type so other code can make processor based choices
     23 ///
     24 #define MDE_CPU_EBC
     25 
     26 //
     27 // Native integer types
     28 //
     29 
     30 ///
     31 /// 1-byte signed value
     32 ///
     33 typedef signed char           INT8;
     34 ///
     35 /// Logical Boolean.  1-byte value containing 0 for FALSE or a 1 for TRUE.  Other
     36 /// values are undefined.
     37 ///
     38 typedef unsigned char         BOOLEAN;
     39 ///
     40 /// 1-byte unsigned value.
     41 ///
     42 typedef unsigned char         UINT8;
     43 ///
     44 /// 1-byte Character.
     45 ///
     46 typedef char                  CHAR8;
     47 ///
     48 /// 2-byte signed value.
     49 ///
     50 typedef short                 INT16;
     51 ///
     52 /// 2-byte unsigned value.
     53 ///
     54 typedef unsigned short        UINT16;
     55 ///
     56 /// 2-byte Character.  Unless otherwise specified all strings are stored in the
     57 /// UTF-16 encoding format as defined by Unicode 2.1 and ISO/IEC 10646 standards.
     58 ///
     59 typedef unsigned short        CHAR16;
     60 ///
     61 /// 4-byte signed value.
     62 ///
     63 typedef int                   INT32;
     64 ///
     65 /// 4-byte unsigned value.
     66 ///
     67 typedef unsigned int          UINT32;
     68 ///
     69 /// 8-byte signed value.
     70 ///
     71 typedef __int64               INT64;
     72 ///
     73 /// 8-byte unsigned value.
     74 ///
     75 typedef unsigned __int64      UINT64;
     76 
     77 ///
     78 /// Signed value of native width.  (4 bytes on supported 32-bit processor instructions,
     79 /// 8 bytes on supported 64-bit processor instructions)
     80 /// "long" type scales to the processor native size with EBC compiler
     81 ///
     82 typedef long                  INTN;
     83 ///
     84 /// The unsigned value of native width.  (4 bytes on supported 32-bit processor instructions;
     85 /// 8 bytes on supported 64-bit processor instructions)
     86 /// "long" type scales to the processor native size with the EBC compiler.
     87 ///
     88 typedef unsigned long         UINTN;
     89 
     90 ///
     91 /// A value of native width with the highest bit set.
     92 /// Scalable macro to set the most significant bit in a natural number.
     93 ///
     94 #define MAX_BIT     (1ULL << (sizeof (INTN) * 8 - 1))
     95 ///
     96 /// A value of native width with the two highest bits set.
     97 /// Scalable macro to set the most 2 significant bits in a natural number.
     98 ///
     99 #define MAX_2_BITS  (3ULL << (sizeof (INTN) * 8 - 2))
    100 
    101 ///
    102 /// Maximum legal EBC address
    103 ///
    104 #define MAX_ADDRESS   ((UINTN) ~0)
    105 
    106 ///
    107 /// Maximum legal EBC INTN and UINTN values.
    108 ///
    109 #define MAX_UINTN  ((UINTN) ~0)
    110 #define MAX_INTN   ((INTN)~MAX_BIT)
    111 
    112 ///
    113 /// The stack alignment required for EBC
    114 ///
    115 #define CPU_STACK_ALIGNMENT   sizeof(UINTN)
    116 
    117 ///
    118 /// Modifier to ensure that all protocol member functions and EFI intrinsics
    119 /// use the correct C calling convention. All protocol member functions and
    120 /// EFI intrinsics are required to modify their member functions with EFIAPI.
    121 ///
    122 #ifdef EFIAPI
    123   ///
    124   /// If EFIAPI is already defined, then we use that definition.
    125   ///
    126 #else
    127 #define EFIAPI
    128 #endif
    129 
    130 /**
    131   Return the pointer to the first instruction of a function given a function pointer.
    132   On EBC architectures, these two pointer values are the same,
    133   so the implementation of this macro is very simple.
    134 
    135   @param  FunctionPointer   A pointer to a function.
    136 
    137   @return The pointer to the first instruction of a function given a function pointer.
    138 **/
    139 #define FUNCTION_ENTRY_POINT(FunctionPointer) (VOID *)(UINTN)(FunctionPointer)
    140 
    141 #ifndef __USER_LABEL_PREFIX__
    142 #define __USER_LABEL_PREFIX__
    143 #endif
    144 
    145 #endif
    146 
    147