| 1 | /* $Id: options.h,v 1.22 2001-06-14 01:06:47 bird Exp $ | 
|---|
| 2 | * | 
|---|
| 3 | * Options. | 
|---|
| 4 | * | 
|---|
| 5 | * Copyright (c) 1998-1999 knut st. osmundsen | 
|---|
| 6 | * | 
|---|
| 7 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 8 | * | 
|---|
| 9 | */ | 
|---|
| 10 |  | 
|---|
| 11 | /* NOINC */ | 
|---|
| 12 | #ifndef _options_h_ | 
|---|
| 13 | #define _options_h_ | 
|---|
| 14 | /* INC */ | 
|---|
| 15 |  | 
|---|
| 16 | /******************************************************************************* | 
|---|
| 17 | *   Defined Constants And Macros                                               * | 
|---|
| 18 | *******************************************************************************/ | 
|---|
| 19 | /* fKernel */ | 
|---|
| 20 | #define KF_UNI              0x0000 | 
|---|
| 21 | #define KF_SMP              0x0001 | 
|---|
| 22 | #define KF_W4               0x0002 | 
|---|
| 23 | #define KF_REV_MASK         0x0FF0 | 
|---|
| 24 | #define KF_REV_SHIFT        4 | 
|---|
| 25 | #define KF_REV_0            0x0000 | 
|---|
| 26 | #define KF_REV_A            0x0010 | 
|---|
| 27 | #define KF_REV_B            0x0020 | 
|---|
| 28 | #define KF_REV_C            0x0030 | 
|---|
| 29 | #define KF_REV_D            0x0040 | 
|---|
| 30 | #define KF_REV_E            0x0050 | 
|---|
| 31 | #define KF_REV_F            0x0060 | 
|---|
| 32 | #define KF_REV_G            0x0070 | 
|---|
| 33 | #define KF_REV_H            0x0080 | 
|---|
| 34 | #define KF_REV_I            0x0090 | 
|---|
| 35 | #define KF_REV_J            0x00a0 | 
|---|
| 36 | #define KF_REV_K            0x00b0 | 
|---|
| 37 | #define KF_REV_L            0x00c0 | 
|---|
| 38 | #define KF_REV_M            0x00d0 | 
|---|
| 39 | #define KF_REV_N            0x00e0 | 
|---|
| 40 | #define KF_REV_O            0x00f0 | 
|---|
| 41 | #define KF_REV_P            0x0100 | 
|---|
| 42 | #define KF_REV_Q            0x0110 | 
|---|
| 43 | #define KF_REV_R            0x0120 | 
|---|
| 44 | #define KF_REV_S            0x0130 | 
|---|
| 45 | #define KF_REV_T            0x0140 | 
|---|
| 46 | #define KF_REV_U            0x0150 | 
|---|
| 47 | #define KF_REV_V            0x0160 | 
|---|
| 48 | #define KF_REV_W            0x0170 | 
|---|
| 49 | #define KF_REV_X            0x0180 | 
|---|
| 50 | #define KF_REV_Y            0x0190 | 
|---|
| 51 | #define KF_REV_Z            0x01a0 | 
|---|
| 52 | #define KF_REV_ECS          0x0900 | 
|---|
| 53 | #define KF_DEBUG            0x1000 | 
|---|
| 54 | #define KF_HAS_DEBUGTYPE    0x2000 | 
|---|
| 55 | #define KF_ALLSTRICT        0x3000 | 
|---|
| 56 | #define KF_HALFSTRICT       0x7000 | 
|---|
| 57 |  | 
|---|
| 58 | /* fPE */ | 
|---|
| 59 | #define FLAGS_PE_NOT        0x00000000UL | 
|---|
| 60 | #define FLAGS_PE_PE2LX      0x00000001UL | 
|---|
| 61 | #define FLAGS_PE_PE         0x00000002UL | 
|---|
| 62 | #define FLAGS_PE_MIXED      0x00000003UL | 
|---|
| 63 |  | 
|---|
| 64 | /* fPEOneObject */ | 
|---|
| 65 | #define FLAGS_PEOO_DISABLED 0x00000000UL | 
|---|
| 66 | #define FLAGS_PEOO_ENABLED  0x00000001UL | 
|---|
| 67 | #define FLAGS_PEOO_FORCED   0x00000002UL | 
|---|
| 68 |  | 
|---|
| 69 | /* ulInfoLevel */ | 
|---|
| 70 | #define INFOLEVEL_QUIET     0x00000000UL | 
|---|
| 71 | #define INFOLEVEL_ERROR     0x00000001UL | 
|---|
| 72 | #define INFOLEVEL_WARNING   0x00000002UL | 
|---|
| 73 | #define INFOLEVEL_INFO      0x00000003UL | 
|---|
| 74 | #define INFOLEVEL_INFOALL   0x00000004UL | 
|---|
| 75 |  | 
|---|
| 76 | /* default heapsizes */ | 
|---|
| 77 | #define CB_SWP_INIT         ((unsigned long)1024*512)      /* 512KB */ | 
|---|
| 78 | #define CB_SWP_MAX          ((unsigned long)1024*1024*16)  /*  16MB  */ | 
|---|
| 79 | #define CB_RES_INIT         ((unsigned long)1024*256)      /* 256KB */ | 
|---|
| 80 | #define CB_RES_MAX          ((unsigned long)1024*1024*10)  /*  10MB  */ | 
|---|
| 81 |  | 
|---|
| 82 | /* NOINC */ | 
|---|
| 83 | /* default assignments */ | 
|---|
| 84 | #define DEFAULT_OPTION_ASSIGMENTS                           \ | 
|---|
| 85 | {FALSE,                 /* fQuiet        */     \ | 
|---|
| 86 | OUTPUT_COM2,            /* usCom         */     \ | 
|---|
| 87 | FALSE,                  /* fLogging      */     \ | 
|---|
| 88 | KF_UNI,                 /* fKernel       */     \ | 
|---|
| 89 | ~0UL,                   /* ulBuild       */     \ | 
|---|
| 90 | (unsigned short)~0,     /* usVerMajor    */     \ | 
|---|
| 91 | (unsigned short)~0,     /* usVerMinor    */     \ | 
|---|
| 92 | FLAGS_PE_PE,            /* fPE           */     \ | 
|---|
| 93 | FLAGS_PEOO_FORCED,      /* fPEOneObject  */     \ | 
|---|
| 94 | INFOLEVEL_QUIET,        /* ulInfoLevel   */     \ | 
|---|
| 95 | FALSE,                  /* fElf          */     \ | 
|---|
| 96 | TRUE,                   /* fUNIXScript   */     \ | 
|---|
| 97 | TRUE,                   /* fREXXScript   */     \ | 
|---|
| 98 | TRUE,                   /* fJava         */     \ | 
|---|
| 99 | FALSE,                  /* fNoLoader     */     \ | 
|---|
| 100 | TRUE,                   /* fDllFixes     */     \ | 
|---|
| 101 | TRUE,                   /* fExeFixes     */     \ | 
|---|
| 102 | FALSE,                  /* fForcePreload */     \ | 
|---|
| 103 | FALSE,                  /* fApiEnh       */     \ | 
|---|
| 104 | CB_SWP_INIT,            /* cbSwpHeapInit */     \ | 
|---|
| 105 | CB_SWP_MAX,             /* cbSwpHeapMax  */     \ | 
|---|
| 106 | CB_RES_INIT,            /* cbResHeapInit */     \ | 
|---|
| 107 | CB_RES_MAX}             /* cbResHeapMax  */ | 
|---|
| 108 |  | 
|---|
| 109 | #define isAnyLoaderEnabled()        (!options.fNoLoader && \ | 
|---|
| 110 | (isPELoaderEnabled() || isELFEnabled() || isUNIXScriptEnabled() || isREXXScriptEnabled() || isJAVAEnabled())) | 
|---|
| 111 | #define isPELoaderEnabled()         (options.fPE != FLAGS_PE_NOT) | 
|---|
| 112 | #define isPELoaderDisabled()        (options.fPE == FLAGS_PE_NOT) | 
|---|
| 113 | #define isPe2LxLoaderEnabled()      (options.fPE == FLAGS_PE_PE2LX) | 
|---|
| 114 | #define isMixedPeLoaderEnabled()    (options.fPE == FLAGS_PE_MIXED) | 
|---|
| 115 | #define isPEOneObjectEnabled()      (options.fPEOneObject == FLAGS_PEOO_ENABLED) | 
|---|
| 116 | #define isPEOneObjectDisabled()     (options.fPEOneObject == FLAGS_PEOO_DISABLED) | 
|---|
| 117 | #define isPEOneObjectForced()       (options.fPEOneObject == FLAGS_PEOO_FORCED) | 
|---|
| 118 |  | 
|---|
| 119 | #define isELFDisabled()             (!options.fElf) | 
|---|
| 120 | #define isELFEnabled()              (options.fElf) | 
|---|
| 121 | #define isUNIXScriptDisabled()      (!options.fUNIXScript) | 
|---|
| 122 | #define isUNIXScriptEnabled()       (options.fUNIXScript) | 
|---|
| 123 | #define isREXXScriptDisabled()      (!options.fREXXScript) | 
|---|
| 124 | #define isREXXScriptEnabled()       (options.fREXXScript) | 
|---|
| 125 | #define isJAVADisabled()            (!options.fJava) | 
|---|
| 126 | #define isJAVAEnabled()             (options.fJava) | 
|---|
| 127 |  | 
|---|
| 128 | #define isSMPKernel()               (options.fKernel & KF_SMP) | 
|---|
| 129 | #define isUNIKernel()               (!(options.fKernel & KF_SMP)) | 
|---|
| 130 |  | 
|---|
| 131 | #define isHighMemorySupported()     (options.ulBuild >= 14000 || isSMPKernel()) | 
|---|
| 132 |  | 
|---|
| 133 | #define isDllFixesEnabled()         (options.fDllFixes) | 
|---|
| 134 | #define isDllFixesDisabled()        (!options.fDllFixes) | 
|---|
| 135 |  | 
|---|
| 136 | #define isExeFixesEnabled()         (options.fExeFixes) | 
|---|
| 137 | #define isExeFixesDisabled()        (!options.fExeFixes) | 
|---|
| 138 |  | 
|---|
| 139 | #define isForcePreloadEnabled()     (options.fForcePreload) | 
|---|
| 140 | #define isForcePreloadDisabled()    (!options.fForcePreload) | 
|---|
| 141 |  | 
|---|
| 142 | #define isApiEnhEnabled()           (options.fApiEnh) | 
|---|
| 143 | #define isApiEnhDisabled()          (!options.fApiEnh) | 
|---|
| 144 |  | 
|---|
| 145 | /* INC */ | 
|---|
| 146 |  | 
|---|
| 147 | /******************************************************************************* | 
|---|
| 148 | *   Structures and Typedefs                                                    * | 
|---|
| 149 | *******************************************************************************/ | 
|---|
| 150 | /** Option struct */ | 
|---|
| 151 | #pragma pack(4) | 
|---|
| 152 | struct options | 
|---|
| 153 | { | 
|---|
| 154 | /** @cat misc */ | 
|---|
| 155 | ULONG       fQuiet;                 /* Quiet initialization. */ | 
|---|
| 156 |  | 
|---|
| 157 | /** @cat logging options */ | 
|---|
| 158 | USHORT      usCom;                  /* Output port no. */ | 
|---|
| 159 | USHORT      fLogging;               /* Logging. */ | 
|---|
| 160 |  | 
|---|
| 161 | /** @cat kernel selection */ | 
|---|
| 162 | ULONG       fKernel;                /* Smp or uni kernel. */ | 
|---|
| 163 | ULONG       ulBuild;                /* Kernel build. */ | 
|---|
| 164 | USHORT      usVerMajor;             /* OS/2 major ver - 20 */ | 
|---|
| 165 | USHORT      usVerMinor;             /* OS/2 minor ver - 30,40 */ | 
|---|
| 166 |  | 
|---|
| 167 | /** @cat Options affecting the generated LX executables */ | 
|---|
| 168 | ULONG       fPE;                    /* Flags set the type of conversion. */ | 
|---|
| 169 | ULONG       fPEOneObject;           /* All in one object. */ | 
|---|
| 170 | ULONG       ulInfoLevel;            /* Pe2Lx InfoLevel. */ | 
|---|
| 171 |  | 
|---|
| 172 | /** @cat Options affecting the generated ELF executables */ | 
|---|
| 173 | ULONG       fElf;                   /* Elf flags. */ | 
|---|
| 174 |  | 
|---|
| 175 | /** @cat Options affecting the UNIX script executables */ | 
|---|
| 176 | ULONG       fUNIXScript;            /* UNIX script flags. */ | 
|---|
| 177 |  | 
|---|
| 178 | /** @cat Options affecting the REXX script executables */ | 
|---|
| 179 | ULONG       fREXXScript;            /* REXX script flags. */ | 
|---|
| 180 |  | 
|---|
| 181 | /** @cat Options affecting the JAVA executables */ | 
|---|
| 182 | ULONG       fJava;                  /* Java flags. */ | 
|---|
| 183 |  | 
|---|
| 184 | /** @cat Options affecting the  executables */ | 
|---|
| 185 | ULONG       fNoLoader;              /* No loader stuff. !FIXME! We should import / functions even if this flag is set!!! */ | 
|---|
| 186 |  | 
|---|
| 187 | /** @cat Options affecting the behaviour changes in the OS/2 loader */ | 
|---|
| 188 | ULONG       fDllFixes;              /* Enables the long DLL name and non .DLL extention fixes. */ | 
|---|
| 189 | ULONG       fExeFixes;              /* Enables EXE files to export entry points. */ | 
|---|
| 190 | ULONG       fForcePreload;          /* Forces the loader to preload executable images. Handy for ICAT Ring-3 debugging. */ | 
|---|
| 191 | ULONG       fApiEnh;                /* Enables the API enhancements */ | 
|---|
| 192 |  | 
|---|
| 193 | /** @cat Options affecting the heap. */ | 
|---|
| 194 | ULONG       cbSwpHeapInit;          /* Initial heapsize. */ | 
|---|
| 195 | ULONG       cbSwpHeapMax;           /* Maximum heapsize. */ | 
|---|
| 196 | ULONG       cbResHeapInit;          /* Initial residentheapsize. */ | 
|---|
| 197 | ULONG       cbResHeapMax;           /* Maxiumem residentheapsize. */ | 
|---|
| 198 | }; | 
|---|
| 199 | #pragma pack() | 
|---|
| 200 |  | 
|---|
| 201 | /******************************************************************************* | 
|---|
| 202 | *   Global Variables                                                           * | 
|---|
| 203 | *******************************************************************************/ | 
|---|
| 204 | /* NOINC */ | 
|---|
| 205 | extern struct options DATA16_GLOBAL options;    /* defined in d16globals.c */ | 
|---|
| 206 | extern char   szWin32kIni[160];                 /* defined in d16globals.c */ | 
|---|
| 207 | #ifdef RING0 | 
|---|
| 208 | #if defined(__IBMC__) || defined(__IBMCPP__) | 
|---|
| 209 | #pragma map( options , "_options"  ) | 
|---|
| 210 | #pragma map( szWin32kIni, "_szWin32kIni" ) | 
|---|
| 211 | #endif | 
|---|
| 212 | #endif | 
|---|
| 213 | /* INC */ | 
|---|
| 214 |  | 
|---|
| 215 | /* NOINC */ | 
|---|
| 216 | #endif | 
|---|
| 217 | /* INC */ | 
|---|
| 218 |  | 
|---|