Home | History | Annotate | Download | only in bochs
      1 //  Copyright (C) 2001  MandrakeSoft S.A.
      2 //
      3 //    MandrakeSoft S.A.
      4 //    43, rue d'Aboukir
      5 //    75002 Paris - France
      6 //    http://www.linux-mandrake.com/
      7 //    http://www.mandrakesoft.com/
      8 //
      9 //  This library is free software; you can redistribute it and/or
     10 //  modify it under the terms of the GNU Lesser General Public
     11 //  License as published by the Free Software Foundation; either
     12 //  version 2 of the License, or (at your option) any later version.
     13 //
     14 //  This library is distributed in the hope that it will be useful,
     15 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
     16 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     17 //  Lesser General Public License for more details.
     18 //
     19 //  You should have received a copy of the GNU Lesser General Public
     20 //  License along with this library; if not, write to the Free Software
     21 //  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA
     22 
     23 //
     24 // config.h.in is distributed in the source TAR file.  When you run
     25 // the configure script, it generates config.h with some changes
     26 // according to your build environment.  For example, in config.h.in,
     27 // SIZEOF_UNSIGNED_CHAR is set to 0.  When configure produces config.h
     28 // it will change "0" to the detected value for your system.
     29 //
     30 // config.h contains ONLY preprocessor #defines and a few typedefs.
     31 // It must be included by both C and C++ files, so it must not
     32 // contain anything language dependent such as a class declaration.
     33 //
     34 
     35 #ifndef _BX_CONFIG_H_
     36 #define _BX_CONFIG_H_ 1
     37 
     38 ///////////////////////////////////////////////////////////////////
     39 // USER CONFIGURABLE OPTIONS : EDIT ONLY OPTIONS IN THIS SECTION //
     40 ///////////////////////////////////////////////////////////////////
     41 
     42 
     43 #if 1
     44 // quit_sim is defined in gui/siminterface.h
     45 #define BX_EXIT(x)  SIM->quit_sim (x)
     46 #else
     47 // provide the real main and the usual exit.
     48 #define BX_EXIT(x)  ::exit(x)
     49 #endif
     50 
     51 // We have tested the following combinations:
     52 //  * processors=1, bootstrap=0, ioapic_id=1   (uniprocessor system)
     53 //  * processors=2, bootstrap=0, ioapic_id=2
     54 //  * processors=4, bootstrap=0, ioapic_id=4
     55 #define BX_SUPPORT_SMP 0
     56 #define BX_BOOTSTRAP_PROCESSOR 0
     57 #define BX_MAX_SMP_THREADS_SUPPORTED 8
     58 
     59 // include in APIC models, required for a multiprocessor system.
     60 #define BX_SUPPORT_APIC 0
     61 
     62 #if (BX_SUPPORT_SMP && !BX_SUPPORT_APIC)
     63   #error For multiprocessor simulation, BX_SUPPORT_APIC is required.
     64 #endif
     65 
     66 // if simulating Linux, this provides a few more debugging options
     67 // such as tracing all system calls.
     68 #define BX_DEBUG_LINUX 0
     69 
     70 // adds support for the GNU readline library in the debugger command
     71 // prompt.
     72 #define HAVE_LIBREADLINE 0
     73 #define HAVE_READLINE_HISTORY_H 0
     74 
     75 // Define to 1 if you have <locale.h>
     76 #define HAVE_LOCALE_H 0
     77 
     78 // I rebuilt the code which provides timers to IO devices.
     79 // Setting this to 1 will introduce a little code which
     80 // will panic out if cases which shouldn't happen occur.
     81 // Set this to 0 for optimal performance.
     82 #define BX_TIMER_DEBUG 0
     83 
     84 // Settable A20 line.  For efficiency, you can disable
     85 // having a settable A20 line, eliminating conditional
     86 // code for every physical memory access.  You'll have
     87 // to tell your software not to mess with the A20 line,
     88 // and accept it as always being on if you change this.
     89 //   1 = use settable A20 line. (normal)
     90 //   0 = A20 is like the rest of the address lines
     91 
     92 #define BX_SUPPORT_A20 1
     93 
     94 // Processor Instructions Per Second
     95 // To find out what value to use for the 'ips' directive
     96 // in your '.bochsrc' file, set BX_SHOW_IPS to 1, and
     97 // run the software in bochs you plan to use most.  Bochs
     98 // will print out periodic IPS ratings.  This will change
     99 // based on the processor mode at the time, and various
    100 // other factors.  You'll get a reasonable estimate though.
    101 // When you're done, reset BX_SHOW_IPS to 0, do a
    102 // 'make all-clean', then 'make' again.
    103 
    104 #define BX_SHOW_IPS         0
    105 
    106 
    107 #if (BX_SHOW_IPS) && (defined(__MINGW32__) || defined(_MSC_VER))
    108 #define        SIGALRM         14
    109 #endif
    110 
    111 // Compile in support for DMA & FLOPPY IO.  You'll need this
    112 // if you plan to use the floppy drive emulation.  But if
    113 // you're environment doesn't require it, you can change
    114 // it to 0.
    115 
    116 #define BX_DMA_FLOPPY_IO 1
    117 
    118 // Default number of Megs of memory to emulate.  The
    119 // 'megs:' directive in the '.bochsrc' file overrides this,
    120 // allowing per-run settings.
    121 
    122 #define BX_DEFAULT_MEM_MEGS 32
    123 
    124 // CPU level emulation.  Default level is set in
    125 // the configure script.  BX_CPU_LEVEL defines the CPU level
    126 // to emulate.  BX_CPU_LEVEL_HACKED is a hack to define the
    127 // level of some instructions, so they can be tested before
    128 // the rest of the emulation is up to that level.
    129 
    130 #define BX_CPU_LEVEL 0
    131 #define BX_CPU_LEVEL_HACKED 0
    132 
    133 // emulate x86-64 instruction set?
    134 #define BX_SUPPORT_X86_64 0
    135 
    136 // emulate long physical address (>32 bit)
    137 #define BX_PHY_ADDRESS_LONG 0
    138 
    139 #define BX_HAVE_SLEEP 0
    140 #define BX_HAVE_MSLEEP 0
    141 #define BX_HAVE_USLEEP 0
    142 #define BX_HAVE_NANOSLEEP 0
    143 #define BX_HAVE_ABORT 0
    144 #define BX_HAVE_SOCKLEN_T 0
    145 #define BX_HAVE_SOCKADDR_IN_SIN_LEN 0
    146 #define BX_HAVE_GETTIMEOFDAY 0
    147 #if defined(WIN32)
    148 #define BX_HAVE_REALTIME_USEC 1
    149 #else
    150 #define BX_HAVE_REALTIME_USEC (BX_HAVE_GETTIMEOFDAY)
    151 #endif
    152 #define BX_HAVE_MKSTEMP 0
    153 #define BX_HAVE_SYS_MMAN_H 0
    154 #define BX_HAVE_XPM_H 0
    155 #define BX_HAVE_TIMELOCAL 0
    156 #define BX_HAVE_GMTIME 0
    157 #define BX_HAVE_MKTIME 0
    158 #define BX_HAVE_NET_IF_H 0
    159 
    160 // This turns on Roland Mainz's idle hack.  Presently it is specific to the X11
    161 // and term gui. If people try to enable it elsewhere, give a compile error
    162 // after the gui definition so that they don't waste their time trying.
    163 #define BX_USE_IDLE_HACK 0
    164 
    165 // Minimum Emulated IPS.
    166 // This is used in the realtime PIT as well as for checking the
    167 // IPS value set in the config file.
    168 #define BX_MIN_IPS 200000
    169 
    170 // Minimum and maximum values for SMP quantum variable. Defines
    171 // how many instructions each CPU could execute execute in one
    172 // shot (one cpu_loop call)
    173 #define BX_SMP_QUANTUM_MIN  1
    174 #define BX_SMP_QUANTUM_MAX 16
    175 
    176 // Use Static Member Funtions to eliminate 'this' pointer passing
    177 // If you want the efficiency of 'C', you can make all the
    178 // members of the C++ CPU class to be static.
    179 // This defaults to 1 since it should improve performance, but when
    180 // SMP mode is enabled, it will be turned off by configure.
    181 #define BX_USE_CPU_SMF 1
    182 
    183 #define BX_USE_MEM_SMF 1
    184 
    185 // Use static member functions in IO DEVice emulation modules.
    186 // For efficiency, use C like functions for IO handling,
    187 // and declare a device instance at compile time,
    188 // instead of using 'new' and storing the pointer.  This
    189 // eliminates some overhead, especially for high-use IO
    190 // devices like the disk drive.
    191 //   1 = Use static member efficiency (normal)
    192 //   0 = Use nonstatic member functions (use only if you need
    193 //       multiple instances of a device class
    194 
    195 #define BX_USE_HD_SMF       1  // Hard drive
    196 #define BX_USE_BIOS_SMF     1  // BIOS
    197 #define BX_USE_CMOS_SMF     1  // CMOS
    198 #define BX_USE_DMA_SMF      1  // DMA
    199 #define BX_USE_FD_SMF       1  // Floppy
    200 #define BX_USE_KEY_SMF      1  // Keyboard
    201 #define BX_USE_PAR_SMF      1  // Parallel
    202 #define BX_USE_PIC_SMF      1  // PIC
    203 #define BX_USE_PIT_SMF      1  // PIT
    204 #define BX_USE_SER_SMF      1  // Serial
    205 #define BX_USE_UM_SMF       1  // Unmapped
    206 #define BX_USE_VGA_SMF      1  // VGA
    207 #define BX_USE_SB16_SMF     1  // Sound (SB 16)
    208 #define BX_USE_DEV_SMF      1  // System Devices (port92)
    209 #define BX_USE_PCI_SMF      1  // PCI
    210 #define BX_USE_P2I_SMF      1  // PCI-to-ISA bridge
    211 #define BX_USE_PIDE_SMF     1  // PCI-IDE
    212 #define BX_USE_PCIVGA_SMF   1  // PCI-VGA
    213 #define BX_USE_PCIDEV_SMF   1  // PCI-DEV
    214 #define BX_USE_USB_UHCI_SMF 1  // USB UHCI hub
    215 #define BX_USE_USB_OHCI_SMF 1  // USB OHCI hub
    216 #define BX_USE_PCIPNIC_SMF  1  // PCI pseudo NIC
    217 #define BX_USE_NE2K_SMF     1  // NE2K
    218 #define BX_USE_EFI_SMF      1  // External FPU IRQ
    219 #define BX_USE_GAMEPORT_SMF 1  // Gameport
    220 #define BX_USE_CIRRUS_SMF   1  // SVGA Cirrus
    221 #define BX_USE_BUSM_SMF     1  // Bus Mouse
    222 #define BX_USE_ACPI_SMF     1  // ACPI
    223 
    224 #define BX_PLUGINS  0
    225 #define BX_HAVE_DLFCN_H 0
    226 
    227 #if BX_PLUGINS && \
    228   (   !BX_USE_HD_SMF || !BX_USE_BIOS_SMF || !BX_USE_CMOS_SMF \
    229    || !BX_USE_DMA_SMF || !BX_USE_FD_SMF || !BX_USE_KEY_SMF \
    230    || !BX_USE_PAR_SMF || !BX_USE_PIC_SMF || !BX_USE_PIT_SMF \
    231    || !BX_USE_SER_SMF || !BX_USE_UM_SMF || !BX_USE_VGA_SMF \
    232    || !BX_USE_SB16_SMF || !BX_USE_DEV_SMF || !BX_USE_PCI_SMF \
    233    || !BX_USE_P2I_SMF || !BX_USE_PCIVGA_SMF || !BX_USE_USB_UHCI_SMF \
    234    || !BX_USE_USB_OHCI_SMF || !BX_USE_PCIPNIC_SMF || !BX_USE_PIDE_SMF \
    235    || !BX_USE_ACPI_SMF || !BX_USE_NE2K_SMF || !BX_USE_EFI_SMF \
    236    || !BX_USE_GAMEPORT_SMF || !BX_USE_PCIDEV_SMF || !BX_USE_CIRRUS_SMF)
    237 #error You must use SMF to have plugins
    238 #endif
    239 
    240 #define BX_SUPPORT_SB16     0
    241 #define BX_SUPPORT_GAMEPORT 0
    242 
    243 #if BX_SUPPORT_SB16
    244 // Use virtual methods for the sound output functions
    245 #define BX_USE_SOUND_VIRTUAL  1
    246 // Determines which sound output class is to be used.
    247 // Currently the following are available:
    248 //    bx_sound_linux_c      Output for Linux, to /dev/dsp and /dev/midi00
    249 //    bx_sound_windows_c    Output for Windows midi and wave mappers
    250 //    bx_sound_output_c     Dummy functions, no output
    251 #define BX_SOUND_OUTPUT_C  bx_sound_output_c
    252 // Use ALSA sound interface on Linux
    253 #define BX_HAVE_ALSASOUND  0
    254 #endif
    255 
    256 #define USE_RAW_SERIAL 0
    257 
    258 // This enables writing to port 0xe9 and the output
    259 // is sent to the console.  Reading from port 0xe9
    260 // will return 0xe9 to let you know this is available.
    261 // Leave this 0 unless you have a reason to use it.
    262 #define BX_PORT_E9_HACK 0
    263 
    264 #define BX_GDBSTUB 0
    265 
    266 // This option enables compressed (zlib) hd support
    267 #define BX_COMPRESSED_HD_SUPPORT 0
    268 #define BX_HAVE_ZLIB 0
    269 
    270 #if BX_COMPRESSED_HD_SUPPORT && !BX_HAVE_ZLIB
    271   #error You must have zlib to enable compressed hd support
    272 #endif
    273 
    274 // This option defines the number of supported ATA channels.
    275 // There are up to two drives per ATA channel.
    276 #define BX_MAX_ATA_CHANNEL 4
    277 
    278 #if (BX_MAX_ATA_CHANNEL>4 || BX_MAX_ATA_CHANNEL<1)
    279   #error "BX_MAX_ATA_CHANNEL should be between 1 and 4"
    280 #endif
    281 
    282 // =================================================================
    283 // BEGIN: OPTIONAL DEBUGGER SECTION
    284 //
    285 // These options are only used if you compile in support for the
    286 // native command line debugging environment.  Typically, the debugger
    287 // is not used, and this section can be ignored.
    288 // =================================================================
    289 
    290 // Compile in support for virtual/linear/physical breakpoints.
    291 // Enable only those you need. Recommend using only linear
    292 // breakpoints, unless you need others. Less supported means
    293 // slightly faster execution time.
    294 #define BX_DBG_MAX_VIR_BPOINTS 16
    295 #define BX_DBG_MAX_LIN_BPOINTS 16
    296 #define BX_DBG_MAX_PHY_BPOINTS 16
    297 
    298 #define BX_DBG_MAX_WATCHPONTS  16
    299 
    300 // max file pathname size for debugger commands
    301 #define BX_MAX_PATH     256
    302 // max nesting level for debug scripts including other scripts
    303 #define BX_INFILE_DEPTH  10
    304 // use this command to include (nest) debug scripts
    305 #define BX_INCLUDE_CMD   "source"
    306 
    307 // Make a call to command line debugger extensions.  If set to 1,
    308 // a call is made.  An external routine has a chance to process
    309 // the command.  If it does, than the debugger ignores the command.
    310 #define BX_DBG_EXTENSIONS 0
    311 
    312 // =================================================================
    313 // END: OPTIONAL DEBUGGER SECTION
    314 // =================================================================
    315 
    316 //////////////////////////////////////////////////////////////////////
    317 // END OF USER CONFIGURABLE OPTIONS : DON'T EDIT ANYTHING BELOW !!! //
    318 // THIS IS GENERATED BY THE ./configure SCRIPT                      //
    319 //////////////////////////////////////////////////////////////////////
    320 
    321 
    322 #define BX_WITH_X11 0
    323 #define BX_WITH_BEOS 0
    324 #define BX_WITH_WIN32 0
    325 #define BX_WITH_MACOS 0
    326 #define BX_WITH_CARBON 0
    327 #define BX_WITH_NOGUI 0
    328 #define BX_WITH_TERM 0
    329 #define BX_WITH_RFB 0
    330 #define BX_WITH_AMIGAOS 0
    331 #define BX_WITH_SDL 0
    332 #define BX_WITH_SVGA 0
    333 #define BX_WITH_WX 0
    334 
    335 // BX_USE_TEXTCONFIG should be set to 1 unless Bochs is compiled
    336 // for wxWidgets only.
    337 #define BX_USE_TEXTCONFIG 1
    338 
    339 // A certain functions must NOT be fastcall even if compiled with fastcall
    340 // option, and those are callbacks from Windows which are defined either 
    341 // as cdecl or stdcall. The entry point main() also has to remain cdecl.
    342 #ifndef CDECL
    343 #if defined(_MSC_VER)
    344   #define CDECL __cdecl
    345 #else
    346   #define CDECL
    347 #endif
    348 #endif
    349 
    350 // add special export symbols for win32 DLL building.  The main code must
    351 // have __declspec(dllexport) on variables, functions, or classes that the
    352 // plugins can access.  The plugins should #define PLUGGABLE which will
    353 // activate the __declspec(dllimport) instead.
    354 #if defined(WIN32) || defined(__CYGWIN__)
    355 #  if BX_PLUGINS && defined(BX_PLUGGABLE)
    356 //   #warning I will import DLL symbols from Bochs main program.
    357 #    define BOCHSAPI __declspec(dllimport)
    358 #  elif BX_PLUGINS
    359 //   #warning I will export DLL symbols.
    360 #    define BOCHSAPI __declspec(dllexport)
    361 #  endif
    362 #endif
    363 #ifndef BOCHSAPI
    364 #  define BOCHSAPI
    365 #endif
    366 
    367 #if defined(__CYGWIN__)
    368 // Make BOCHSAPI_CYGONLY exactly the same as BOCHSAPI.  This symbol
    369 // will be used for any cases where Cygwin requires a special tag
    370 // but VC++ does not.
    371 #define BOCHSAPI_CYGONLY BOCHSAPI
    372 #else
    373 // define the symbol to be empty
    374 #define BOCHSAPI_CYGONLY /*empty*/
    375 #endif
    376 
    377 #if defined(_MSC_VER)
    378 // Make BOCHSAPI_MSVCONLY exactly the same as BOCHSAPI.  This symbol
    379 // will be used for any cases where VC++ requires a special tag
    380 // but Cygwin does not.
    381 #define BOCHSAPI_MSVCONLY BOCHSAPI
    382 #else
    383 // define the symbol to be empty
    384 #define BOCHSAPI_MSVCONLY /*empty*/
    385 #endif
    386 
    387 #define BX_DEFAULT_CONFIG_INTERFACE "defined_by_configure"
    388 #define BX_DEFAULT_DISPLAY_LIBRARY "defined_by_configure"
    389 
    390 // Roland Mainz's idle hack is presently specific to X11. If people try to
    391 // enable it elsewhere, give a compile error so that they don't waste their
    392 // time trying.
    393 #if (BX_USE_IDLE_HACK && !BX_WITH_X11 && !BX_WITH_TERM)
    394 #  error IDLE_HACK will only work with the X11 or term gui. Correct configure args and retry.
    395 #endif
    396 
    397 #define WORDS_BIGENDIAN 0
    398 
    399 #define SIZEOF_UNSIGNED_CHAR      0
    400 #define SIZEOF_UNSIGNED_SHORT     0
    401 #define SIZEOF_UNSIGNED_INT       0
    402 #define SIZEOF_UNSIGNED_LONG      0
    403 #define SIZEOF_UNSIGNED_LONG_LONG 0
    404 #define SIZEOF_INT_P              0
    405 
    406 #define BX_64BIT_CONSTANTS_USE_LL 1
    407 #if BX_64BIT_CONSTANTS_USE_LL
    408 // doesn't work on Microsoft Visual C++, maybe others
    409 #define BX_CONST64(x)  (x##LL)
    410 #elif defined(_MSC_VER)
    411 #define BX_CONST64(x)  (x##I64)
    412 #else
    413 #define BX_CONST64(x)  (x)
    414 #endif
    415 
    416 #if defined(WIN32)
    417   typedef unsigned char      Bit8u;
    418   typedef   signed char      Bit8s;
    419   typedef unsigned short     Bit16u;
    420   typedef   signed short     Bit16s;
    421   typedef unsigned int       Bit32u;
    422   typedef   signed int       Bit32s;
    423 #ifdef __MINGW32__
    424   typedef unsigned long long Bit64u;
    425   typedef   signed long long Bit64s;
    426 #include <sys/types.h>
    427 #else
    428   typedef unsigned __int64   Bit64u;
    429   typedef   signed __int64   Bit64s;
    430 #endif
    431 #elif BX_WITH_MACOS
    432   typedef unsigned char      Bit8u;
    433   typedef   signed char      Bit8s;
    434   typedef unsigned short     Bit16u;
    435   typedef   signed short     Bit16s;
    436   typedef unsigned int       Bit32u;
    437   typedef   signed int       Bit32s;
    438   typedef unsigned long long Bit64u;
    439   typedef   signed long long Bit64s;
    440 #else
    441 
    442 // Unix like platforms
    443 
    444 #if SIZEOF_UNSIGNED_CHAR != 1
    445 #  error "sizeof (unsigned char) != 1"
    446 #else
    447   typedef unsigned char Bit8u;
    448   typedef   signed char Bit8s;
    449 #endif
    450 
    451 #if SIZEOF_UNSIGNED_SHORT != 2
    452 #  error "sizeof (unsigned short) != 2"
    453 #else
    454   typedef unsigned short Bit16u;
    455   typedef   signed short Bit16s;
    456 #endif
    457 
    458 #if SIZEOF_UNSIGNED_INT == 4
    459   typedef unsigned int Bit32u;
    460   typedef   signed int Bit32s;
    461 #elif SIZEOF_UNSIGNED_LONG == 4
    462   typedef unsigned long Bit32u;
    463   typedef   signed long Bit32s;
    464 #else
    465 #  error "can't find sizeof(type) of 4 bytes!"
    466 #endif
    467 
    468 #if SIZEOF_UNSIGNED_LONG == 8
    469   typedef unsigned long Bit64u;
    470   typedef   signed long Bit64s;
    471 #elif SIZEOF_UNSIGNED_LONG_LONG == 8
    472   typedef unsigned long long Bit64u;
    473   typedef   signed long long Bit64s;
    474 #else
    475 #  error "can't find data type of 8 bytes"
    476 #endif
    477 
    478 #endif
    479 
    480 #define GET32L(val64) ((Bit32u)(((Bit64u)(val64)) & 0xFFFFFFFF))
    481 #define GET32H(val64) ((Bit32u)(((Bit64u)(val64)) >> 32))
    482 
    483 // now that Bit32u and Bit64u exist, defined bx_address
    484 #if BX_SUPPORT_X86_64
    485 typedef Bit64u bx_address;
    486 #else
    487 typedef Bit32u bx_address;
    488 #endif
    489 
    490 // define physical and linear address types
    491 typedef bx_address bx_lin_address;
    492 
    493 #if BX_SUPPORT_X86_64
    494 #define BX_LIN_ADDRESS_WIDTH 48
    495 #else
    496 #define BX_LIN_ADDRESS_WIDTH 32
    497 #endif
    498 
    499 #if BX_PHY_ADDRESS_LONG
    500 typedef Bit64u bx_phy_address;
    501 #define BX_PHY_ADDRESS_WIDTH 40
    502 #else
    503 typedef Bit32u bx_phy_address;
    504 #define BX_PHY_ADDRESS_WIDTH 32
    505 #endif
    506 
    507 // small sanity check
    508 #if BX_PHY_ADDRESS_LONG
    509   #if (BX_PHY_ADDRESS_WIDTH <= 32)
    510     #error "BX_PHY_ADDRESS_LONG implies emulated physical address width > 32 bit"
    511   #endif
    512 #endif
    513 
    514 #define BX_PHY_ADDRESS_MASK ((((Bit64u)(1)) << BX_PHY_ADDRESS_WIDTH) - 1)
    515 
    516 #define BX_PHY_ADDRESS_RESERVED_BITS \
    517       (~BX_PHY_ADDRESS_MASK & BX_CONST64(0xfffffffffffff))
    518 
    519 // technically, in an 8 bit signed the real minimum is -128, not -127.
    520 // But if you decide to negate -128 you tend to get -128 again, so it's
    521 // better not to use the absolute maximum in the signed range.
    522 #define BX_MAX_BIT64U ( (Bit64u) -1           )
    523 #define BX_MIN_BIT64U ( 0                     )
    524 #define BX_MAX_BIT64S ( ((Bit64u) -1) >> 1    )
    525 #define BX_MIN_BIT64S ( (Bit64s)-(((Bit64u) -1) >> 1) )
    526 #define BX_MAX_BIT32U ( (Bit32u) -1           )
    527 #define BX_MIN_BIT32U ( 0                     )
    528 #define BX_MAX_BIT32S ( ((Bit32u) -1) >> 1    )
    529 #define BX_MIN_BIT32S ( (Bit32s)-(((Bit32u) -1) >> 1) )
    530 #define BX_MAX_BIT16U ( (Bit16u) -1           )
    531 #define BX_MIN_BIT16U ( 0                     )
    532 #define BX_MAX_BIT16S ( ((Bit16u) -1) >> 1    )
    533 #define BX_MIN_BIT16S ( (Bit16s)-(((Bit16u) -1) >> 1) )
    534 #define BX_MAX_BIT8U  ( (Bit8u) -1            )
    535 #define BX_MIN_BIT8U  ( 0                     )
    536 #define BX_MAX_BIT8S  ( ((Bit8u) -1) >> 1     )
    537 #define BX_MIN_BIT8S  ( (Bit8s)-(((Bit8u) -1) >> 1)  )
    538 
    539 
    540 // create an unsigned integer type that is the same size as a pointer.
    541 // You can typecast a pointer to a bx_pr_equiv_t without losing any
    542 // bits (and without getting the compiler excited).
    543 #if SIZEOF_INT_P == 4
    544   typedef Bit32u bx_ptr_equiv_t;
    545 #elif SIZEOF_INT_P == 8
    546   typedef Bit64u bx_ptr_equiv_t;
    547 #else
    548 #  error "could not define bx_ptr_equiv_t to size of int*"
    549 #endif
    550 
    551 // Use a boolean type that will not conflict with the builtin type
    552 // on any system.
    553 typedef Bit32u bx_bool;
    554 
    555 #if BX_WITH_MACOS
    556 #  define bx_ptr_t char *
    557 #else
    558 #  define bx_ptr_t void *
    559 #endif
    560 
    561 #if defined(WIN32)
    562 #  define BX_LITTLE_ENDIAN
    563 #elif BX_WITH_MACOS
    564 #  define BX_BIG_ENDIAN
    565 #else
    566 #if WORDS_BIGENDIAN
    567 #  define BX_BIG_ENDIAN
    568 #else
    569 #  define BX_LITTLE_ENDIAN
    570 #endif
    571 #endif // defined(WIN32)
    572 
    573 
    574 #if BX_SUPPORT_X86_64
    575 #ifdef BX_LITTLE_ENDIAN
    576 typedef
    577   struct {
    578          Bit64u lo;
    579          Bit64u hi;
    580          } Bit128u;
    581 typedef
    582   struct {
    583          Bit64u lo;
    584          Bit64s hi;
    585          } Bit128s;
    586 #else   // must be Big Endian
    587 typedef
    588   struct {
    589          Bit64u hi;
    590          Bit64u lo;
    591          } Bit128u;
    592 typedef
    593   struct {
    594          Bit64s hi;
    595          Bit64u lo;
    596          } Bit128s;
    597 #endif
    598 #endif  // #if BX_SUPPORT_X86_64
    599 
    600 
    601 // for now only term.cc requires a GUI sighandler.
    602 #define BX_GUI_SIGHANDLER (BX_WITH_TERM)
    603 
    604 #define HAVE_SIGACTION 1
    605 
    606 // configure will change the definition of "inline" to the value
    607 // that the C compiler allows.  It tests the following keywords to
    608 // see if any is permitted: inline, __inline__, __inline.  If none
    609 // is permitted, it defines inline to be empty.
    610 #define inline inline
    611 
    612 // inline functions in headers that are compiled with C compiler
    613 // (e.g. fpu code) are declared with BX_C_INLINE macro.  Note that
    614 // the word "inline" itself may now be redefined by the above #define.
    615 // Many compilers are known to work with "static inline".  If the
    616 // compiler can put the function inline, it does so and never creates
    617 // a symbol for the function.  If optimization is off, or inline is
    618 // defined to be empty, the static keyword causes the function to create
    619 // a symbol that's visible only to that .c file.  Each .c file that
    620 // includes the header will produde another local version of the
    621 // BX_C_INLINE function (not ideal).  However without "static" you can
    622 // duplicate symbol problems which are even worse.
    623 #define BX_C_INLINE static inline
    624 
    625 // Use BX_CPP_INLINE for all C++ inline functions.  Note that the
    626 // word "inline" itself may now be redefined by the above #define.
    627 #define BX_CPP_INLINE inline
    628 
    629 #ifdef __GNUC__
    630 
    631 // Some helpful compiler hints for compilers that allow them; GCC for now.
    632 //
    633 // BX_CPP_AlignN(n):
    634 //   Align a construct on an n-byte boundary.
    635 //
    636 // BX_CPP_AttrPrintf(formatArg, firstArg):
    637 //   This function takes printf-like arguments, so the compiler can check
    638 //   the consistency of the format string and the matching arguments.
    639 //   'formatArg' is the parameter number (starting from 1) of the format
    640 //   string argument.  'firstArg' is the parameter number of the 1st argument
    641 //   to check against the string argument.  NOTE: For non-static member
    642 //   functions, the this-ptr is argument number 1 but is invisible on
    643 //   the function prototype declaration - but you still have to count it.
    644 //
    645 // BX_CPP_AttrNoReturn():
    646 //   This function never returns.  The compiler can optimize-out following
    647 //   code accordingly.
    648 
    649 #define BX_CPP_AlignN(n) __attribute__ ((aligned (n)))
    650 #define BX_CPP_AttrPrintf(formatArg, firstArg) \
    651                           __attribute__ ((format (printf, formatArg, firstArg)))
    652 #define BX_CPP_AttrNoReturn() __attribute__ ((noreturn))
    653 
    654 #else
    655 
    656 #define BX_CPP_AlignN(n) /* Not supported. */
    657 #define BX_CPP_AttrPrintf(formatArg, firstArg)  /* Not supported. */
    658 #define BX_CPP_AttrNoReturn() /* Not supported. */
    659 
    660 #endif
    661 
    662 #define BX_DEBUGGER     0
    663 #define BX_DISASM       0
    664 #define BX_DEBUGGER_GUI 0
    665 
    666 #if (BX_DEBUGGER == 1) && (BX_DISASM == 0)
    667   #error Dissembler is required for BX_DEBUGGER !
    668 #endif
    669 
    670 #define BX_PROVIDE_CPU_MEMORY    1
    671 #define BX_PROVIDE_DEVICE_MODELS 1
    672 
    673 #define BX_PROVIDE_MAIN       1
    674 
    675 #define BX_INSTRUMENTATION    0
    676 
    677 // enable BX_DEBUG/BX_ERROR/BX_INFO messages
    678 #define BX_NO_LOGGING 0
    679 
    680 // enable BX_ASSERT checks
    681 #define BX_ASSERT_ENABLE 0
    682 
    683 // limited i440FX PCI support
    684 #define BX_SUPPORT_PCI 0
    685 
    686 // Bochs VBE display interface
    687 #define BX_SUPPORT_VBE 0
    688 
    689 // CLGD54XX emulation
    690 #define BX_SUPPORT_CLGD54XX 0
    691 
    692 // ACPI controller
    693 #define BX_SUPPORT_ACPI 0
    694 
    695 #if (BX_SUPPORT_ACPI && !BX_SUPPORT_PCI)
    696   #error To enable ACPI support, you must also enable PCI
    697 #endif
    698 
    699 // Experimental VGA on PCI
    700 #define BX_SUPPORT_PCIVGA 0
    701 
    702 // Experimental host PCI device mapping
    703 #define BX_SUPPORT_PCIDEV 0
    704 
    705 #if (BX_SUPPORT_PCIDEV && !BX_SUPPORT_PCI)
    706   #error To enable PCI host device mapping, you must also enable PCI
    707 #endif
    708 
    709 // limited USB on PCI
    710 #define BX_SUPPORT_USB_UHCI 0
    711 #define BX_SUPPORT_USB_OHCI 0
    712 #define BX_SUPPORT_PCIUSB (BX_SUPPORT_USB_UHCI || BX_SUPPORT_USB_OHCI)
    713 
    714 #if (BX_SUPPORT_PCIUSB && !BX_SUPPORT_PCI)
    715   #error To enable USB, you must also enable PCI
    716 #endif
    717 
    718 // Experimental bus mouse support
    719 #define BX_SUPPORT_BUSMOUSE 0
    720 
    721 #define BX_SUPPORT_ALIGNMENT_CHECK 0
    722 #define BX_SUPPORT_FPU 0
    723 #define BX_SUPPORT_MMX 0
    724 #define BX_SUPPORT_3DNOW 0
    725 #define BX_SUPPORT_SSE 0
    726 #define BX_SUPPORT_SSE_EXTENSION 0
    727 #define BX_SUPPORT_SSE4A 0
    728 #define BX_SUPPORT_SSE5A 0
    729 #define BX_SUPPORT_DAZ 0
    730 #define BX_SUPPORT_MISALIGNED_SSE 0
    731 #define BX_SUPPORT_SEP 0
    732 #define BX_SUPPORT_VME 0
    733 #define BX_SUPPORT_POPCNT 0
    734 #define BX_SUPPORT_MONITOR_MWAIT 0
    735 #define BX_SUPPORT_XSAVE 0
    736 #define BX_SUPPORT_AES 0
    737 #define BX_SUPPORT_MOVBE 0
    738 #define BX_SUPPORT_VMX 0
    739 
    740 #define BX_SUPPORT_MTRR 0
    741 #define BX_SUPPORT_LARGE_PAGES 0
    742 #define BX_SUPPORT_GLOBAL_PAGES 0
    743 #define BX_SUPPORT_PAE 0
    744 #define BX_SUPPORT_1G_PAGES 0
    745 
    746 #define BX_SupportRepeatSpeedups 0
    747 #define BX_SupportHostAsms 0
    748 
    749 #define BX_SUPPORT_ICACHE 0
    750 #define BX_SUPPORT_TRACE_CACHE 0
    751 
    752 #if (BX_SUPPORT_TRACE_CACHE && BX_SUPPORT_ICACHE==0)
    753   #error Trace cache optimization cannot be compiled without iCache!
    754 #endif
    755 
    756 #if BX_SUPPORT_3DNOW
    757   #define BX_CPU_VENDOR_INTEL 0
    758 #else
    759   #define BX_CPU_VENDOR_INTEL 1
    760 #endif
    761 
    762 // Maximum CPUID vendor and brand string lengths
    763 #define BX_CPUID_VENDOR_LEN 12
    764 #define BX_CPUID_BRAND_LEN  48
    765 
    766 // if 1, don't do gpf on MSRs that we don't implement
    767 #define BX_IGNORE_BAD_MSR 0
    768 
    769 #define BX_CONFIGURE_MSRS 0
    770 
    771 // CLFLUSH was introduced together with SSE2 instruction set
    772 #if BX_SUPPORT_SSE >= 2
    773   #define BX_SUPPORT_CLFLUSH 1
    774 #else
    775   #define BX_SUPPORT_CLFLUSH 0
    776 #endif
    777 
    778 #if (BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL < 4)
    779   #error Alignment exception check is not supported in i386 !
    780 #endif
    781 
    782 #if (BX_CONFIGURE_MSRS && BX_CPU_LEVEL < 5)
    783   #error MSRs are supported only with CPU level >= 5 !
    784 #endif
    785 
    786 #if (BX_SUPPORT_VME && BX_CPU_LEVEL < 5)
    787   #error With CPU level < 5, you must disable v8086 mode extensions !
    788 #endif
    789 
    790 #if (BX_SUPPORT_MMX && BX_CPU_LEVEL < 5)
    791   #error With CPU level < 5, you must disable MMX support !
    792 #endif
    793 
    794 #if (!BX_SUPPORT_FPU && BX_CPU_LEVEL > 4)
    795   #error With CPU level > 4, you must enable FPU support !
    796 #endif
    797 
    798 #if (BX_SUPPORT_MMX && !BX_SUPPORT_FPU)
    799   #error "MMX cannot be compiled without FPU support !"
    800 #endif
    801 
    802 #if (BX_SUPPORT_FPU && BX_CPU_LEVEL < 3)
    803   #error "FPU cannot be compiled without cpu level >= 3 !"
    804 #endif
    805 
    806 #if (BX_SUPPORT_3DNOW && !BX_SUPPORT_MMX)
    807   #error "3DNow! cannot be compiled without MMX support !"
    808 #endif
    809 
    810 #if (BX_SUPPORT_AES && !BX_SUPPORT_SSE)
    811   #error "AES cannot be compiled without SSE support !"
    812 #endif
    813 
    814 #if (BX_SUPPORT_XSAVE && !BX_SUPPORT_SSE)
    815   #error "XSAVE cannot be compiled without SSE support !"
    816 #endif
    817 
    818 #if (BX_SUPPORT_SSE && !BX_SUPPORT_MMX)
    819   #error "SSE cannot be compiled without FPU+MMX support !"
    820 #endif
    821 
    822 #if (BX_CPU_LEVEL<6 && BX_SUPPORT_SSE)
    823   #error "SSE is only supported with CPU_LEVEL >= 6 !"
    824 #endif
    825 
    826 #if (BX_CPU_LEVEL<6 && BX_SUPPORT_SEP)
    827   #error "SYSENTER/SYSEXIT only supported with CPU_LEVEL >= 6 !"
    828 #endif
    829 
    830 #if (BX_CPU_LEVEL<6 && BX_SUPPORT_VMX)
    831   #error "VMX only supported with CPU_LEVEL >= 6 !"
    832 #endif
    833 
    834 #if (BX_SUPPORT_VMX && !BX_SUPPORT_SEP)
    835   #error "SYSENTER/SYSEXIT is required for VMX support !"
    836 #endif
    837 
    838 #if (BX_SUPPORT_SSE < 3) || (BX_SUPPORT_SSE == 3 && BX_SUPPORT_SSE_EXTENSION == 0)
    839 #if BX_SUPPORT_MOVBE
    840   #error "MOVBE only supported with SSE3E !"
    841 #endif
    842 #endif
    843 
    844 #if (BX_CPU_LEVEL<6 && BX_SUPPORT_PAE)
    845   #error "Physical Address Extensions (PAE) only supported with CPU_LEVEL >= 6 !"
    846 #endif
    847 #if (BX_CPU_LEVEL<6 && BX_SUPPORT_GLOBAL_PAGES)
    848   #error "Page Global Extension (PGE) only supported with CPU_LEVEL >= 6 !"
    849 #endif
    850 #if (BX_CPU_LEVEL<5 && BX_SUPPORT_LARGE_PAGES)
    851   #error "Page Size Extension (PSE) only supported with CPU_LEVEL >= 5 !"
    852 #endif
    853 #if (BX_CPU_LEVEL<6 && BX_SUPPORT_MTRR)
    854   #error "MTRRs only supported with CPU_LEVEL >= 6 !"
    855 #endif
    856 
    857 #if (BX_SUPPORT_PAE && !BX_SUPPORT_LARGE_PAGES)
    858   #error "Physical Address Extensions (PAE) requires large pages support !"
    859 #endif
    860 
    861 #if (!BX_SUPPORT_X86_64 && BX_SUPPORT_1G_PAGES)
    862   #error "1G only supported with x86-64 !"
    863 #endif
    864 
    865 #if BX_SUPPORT_X86_64
    866 // Sanity checks to ensure that you cannot accidently use conflicting options.
    867 
    868 #if BX_CPU_LEVEL < 6
    869   #error "X86-64 requires cpu level 6 or greater !"
    870 #endif
    871 #if (BX_SUPPORT_SSE<2)
    872   #error "X86-64 requires SSE2 !"
    873 #endif
    874 #if !BX_SUPPORT_PAE
    875   #error "X86-64 requires Physical Address Extensions (PAE) !"
    876 #endif
    877 #if !BX_SUPPORT_GLOBAL_PAGES
    878   #error "X86-64 requires Page Global Extension (PGE) !"
    879 #endif
    880 #if !BX_SUPPORT_LARGE_PAGES
    881   #error "X86-64 requires Page Size Extension (PSE) !"
    882 #endif
    883 #endif
    884 
    885 #define BX_HAVE_GETENV 0
    886 #define BX_HAVE_SETENV 0
    887 #define BX_HAVE_SELECT 0
    888 #define BX_HAVE_SNPRINTF 0
    889 #define BX_HAVE_VSNPRINTF 0
    890 #define BX_HAVE_STRTOULL 0
    891 #define BX_HAVE_STRTOUQ 0
    892 #define BX_HAVE_STRDUP 0
    893 #define BX_HAVE_STRREV 0
    894 #define BX_HAVE_STRICMP 0
    895 #define BX_HAVE_STRCASECMP 0
    896 #define BX_HAVE_STRUCT_TIMEVAL 0
    897 
    898 // used in term gui
    899 #define BX_HAVE_COLOR_SET 0
    900 #define BX_HAVE_MVHLINE 0
    901 #define BX_HAVE_MVVLINE 0
    902 
    903 
    904 // set if your compiler does not permit an empty struct
    905 #define BX_NO_EMPTY_STRUCTS 0
    906 
    907 // set if your compiler does not understand __attribute__ after a struct
    908 #define BX_NO_ATTRIBUTES 0
    909 #if BX_NO_ATTRIBUTES
    910 #define GCC_ATTRIBUTE(x) /* attribute not supported */
    911 #else
    912 #define GCC_ATTRIBUTE __attribute__
    913 #endif
    914 
    915 // set to use fast function calls
    916 #define BX_FAST_FUNC_CALL 0
    917 
    918 // On gcc2.95+ x86 only
    919 #if BX_FAST_FUNC_CALL && defined(__i386__) && defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95))
    920 #if BX_USE_CPU_SMF == 1
    921 #  define BX_CPP_AttrRegparmN(X) __attribute__((regparm(X)))
    922 #else
    923 // FIXME: BX_FAST_FUNC_CALL doesn't work with BX_USE_CPU_SMF = 0
    924 #  define BX_CPP_AttrRegparmN(X) /* Not defined */
    925 #endif
    926 #else
    927 #  define BX_CPP_AttrRegparmN(X) /* Not defined */
    928 #endif
    929 
    930 // set if your compiler does not allow label at the end of a {} block
    931 #define BX_NO_BLANK_LABELS 0
    932 
    933 // set if you do have <hash_map>, used in bx_debug/dbg_main.c
    934 #define BX_HAVE_HASH_MAP 0
    935 
    936 // set if you do have <hash_map.h>, used in bx_debug/dbg_main.c
    937 #define BX_HAVE_HASH_MAP_H 0
    938 
    939 // set if you do have <set>, used in bx_debug/dbg_main.c
    940 #define BX_HAVE_SET 0
    941 
    942 // set if you do have <set.h>, used in bx_debug/dbg_main.c
    943 #define BX_HAVE_SET_H 0
    944 
    945 // Support x86 hardware debugger registers and facilites.
    946 // These are the debug facilites offered by the x86 architecture,
    947 // not the optional built-in debugger.
    948 #define BX_X86_DEBUGGER 0
    949 
    950 #define BX_SUPPORT_CDROM 0
    951 
    952 #if BX_SUPPORT_CDROM
    953    // This is the C++ class name to use if we are supporting
    954    // low-level CDROM.
    955 #  define LOWLEVEL_CDROM cdrom_interface
    956 #endif
    957 
    958 // NE2K network emulation
    959 #define BX_SUPPORT_NE2K 0
    960 
    961 // Pseudo PCI NIC
    962 #define BX_SUPPORT_PCIPNIC 0
    963 
    964 #if (BX_SUPPORT_PCIPNIC && !BX_SUPPORT_PCI)
    965   #error To enable the PCI pseudo NIC, you must also enable PCI
    966 #endif
    967 
    968 // this enables the lowlevel stuff below if one of the NICs is present
    969 #define BX_NETWORKING 0
    970 
    971 #define BX_ETH_NULL_LOGGING 1
    972 #define BX_ETH_FBSD_LOGGING 1
    973 
    974 // determine which NE2K packet mover modules will be enabled
    975 // (this was moved from iodev/eth.h)
    976 #define ETH_NULL  1
    977 #ifdef BX_USE_ETH_ARPBACK
    978 #  define ETH_ARPBACK 1
    979 #endif
    980 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__NetBSD_kernel__) || defined(__APPLE__)
    981 #define ETH_FBSD  1
    982 #endif
    983 #if defined(linux)
    984 #define ETH_LINUX 1
    985 #endif
    986 #if defined(WIN32)
    987 #define ETH_WIN32 1
    988 #endif
    989 
    990 // this enables Ethertap packet mover; determined by configure script
    991 #define HAVE_ETHERTAP 0
    992 
    993 // this enables TUN/TAP packet mover; determined by configure script
    994 #define HAVE_TUNTAP 0
    995 
    996 // this enables VDE packet mover; determined by configure script
    997 #define HAVE_VDE 0
    998 
    999 
   1000 // I/O Interface to debug
   1001 #define BX_SUPPORT_IODEBUG 0
   1002 
   1003 #ifdef WIN32
   1004 #define BX_FLOPPY0_NAME "Floppy Disk A:"
   1005 #define BX_FLOPPY1_NAME "Floppy Disk B:"
   1006 #else
   1007 #define BX_FLOPPY0_NAME "Floppy Disk 0"
   1008 #define BX_FLOPPY1_NAME "Floppy Disk 1"
   1009 #endif
   1010 
   1011 #endif  // _BX_CONFIG_H
   1012