1// 2// Copyright (C) 2001-2021 The Bochs Project 3// 4// This library is free software; you can redistribute it and/or 5// modify it under the terms of the GNU Lesser General Public 6// License as published by the Free Software Foundation; either 7// version 2 of the License, or (at your option) any later version. 8// 9// This library is distributed in the hope that it will be useful, 10// but WITHOUT ANY WARRANTY; without even the implied warranty of 11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12// Lesser General Public License for more details. 13// 14// You should have received a copy of the GNU Lesser General Public 15// License along with this library; if not, write to the Free Software 16// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 17// 18 19// 20// config.h.in is distributed in the source TAR file. When you run 21// the configure script, it generates config.h with some changes 22// according to your build environment. For example, in config.h.in, 23// SIZEOF_UNSIGNED_CHAR is set to 0. When configure produces config.h 24// it will change "0" to the detected value for your system. 25// 26// config.h contains ONLY preprocessor #defines and a few typedefs. 27// It must be included by both C and C++ files, so it must not 28// contain anything language dependent such as a class declaration. 29// 30 31#ifndef _BX_CONFIG_H_ 32#define _BX_CONFIG_H_ 1 33 34/////////////////////////////////////////////////////////////////// 35// USER CONFIGURABLE OPTIONS : EDIT ONLY OPTIONS IN THIS SECTION // 36/////////////////////////////////////////////////////////////////// 37 38 39#if 1 40// quit_sim is defined in gui/siminterface.h 41#define BX_EXIT(x) SIM->quit_sim (x) 42#else 43// provide the real main and the usual exit. 44#define BX_EXIT(x) ::exit(x) 45#endif 46 47// if simulating Linux, this provides a few more debugging options 48// such as tracing all system calls. 49#define BX_DEBUG_LINUX 0 50 51// adds support for the GNU readline library in the debugger command 52// prompt. 53#define HAVE_LIBREADLINE 0 54#define HAVE_READLINE_HISTORY_H 0 55 56// Define to 1 if you have <locale.h> 57#define HAVE_LOCALE_H 0 58 59// I rebuilt the code which provides timers to IO devices. 60// Setting this to 1 will introduce a little code which 61// will panic out if cases which shouldn't happen occur. 62// Set this to 0 for optimal performance. 63#define BX_TIMER_DEBUG 0 64 65// Settable A20 line. For efficiency, you can disable 66// having a settable A20 line, eliminating conditional 67// code for every physical memory access. You'll have 68// to tell your software not to mess with the A20 line, 69// and accept it as always being on if you change this. 70// 1 = use settable A20 line. (normal) 71// 0 = A20 is like the rest of the address lines 72 73#define BX_SUPPORT_A20 1 74 75// Processor Instructions Per Second 76// To find out what value to use for the 'ips' directive 77// in your '.bochsrc' file, set BX_SHOW_IPS to 1, and 78// run the software in bochs you plan to use most. Bochs 79// will print out periodic IPS ratings. This will change 80// based on the processor mode at the time, and various 81// other factors. You'll get a reasonable estimate though. 82// When you're done, reset BX_SHOW_IPS to 0, do a 83// 'make all-clean', then 'make' again. 84 85#define BX_SHOW_IPS 0 86 87 88#define MSVC_TARGET 0 89#if defined(_MSC_VER) && defined(MSVC_TARGET) 90#if defined(_M_X64) && (MSVC_TARGET != 64) 91#error Bochs not configured for MSVC WIN64 92#elif !defined(_M_X64) && (MSVC_TARGET != 32) 93#error Bochs not configured for MSVC WIN32 94#endif 95#endif 96 97#if (BX_SHOW_IPS) && (defined(__MINGW32__) || defined(_MSC_VER)) 98#define SIGALRM 14 99#endif 100 101// Compile in support for DMA & FLOPPY IO. You'll need this 102// if you plan to use the floppy drive emulation. But if 103// you're environment doesn't require it, you can change 104// it to 0. 105 106#define BX_DMA_FLOPPY_IO 1 107 108// Default number of Megs of memory to emulate. The 109// 'megs:' directive in the '.bochsrc' file overrides this, 110// allowing per-run settings. 111 112#define BX_DEFAULT_MEM_MEGS 32 113 114// CPU level emulation. Default level is set in the configure script. 115// BX_CPU_LEVEL defines the CPU level to emulate. 116#define BX_CPU_LEVEL 0 117 118// emulate x86-64 instruction set? 119#define BX_SUPPORT_X86_64 0 120 121// emulate long physical address (>32 bit) 122#define BX_PHY_ADDRESS_LONG 0 123 124#define BX_HAVE_SLEEP 0 125#define BX_HAVE_MSLEEP 0 126#define BX_HAVE_USLEEP 0 127#define BX_HAVE_NANOSLEEP 0 128#define BX_HAVE_ABORT 0 129#define BX_HAVE_SOCKLEN_T 0 130#define BX_HAVE_SOCKADDR_IN_SIN_LEN 0 131#define BX_HAVE_GETTIMEOFDAY 0 132#if defined(WIN32) 133#define BX_HAVE_REALTIME_USEC 1 134#else 135#define BX_HAVE_REALTIME_USEC (BX_HAVE_GETTIMEOFDAY) 136#endif 137#define BX_HAVE_MKSTEMP 0 138#define BX_HAVE_SYS_MMAN_H 0 139#define BX_HAVE_XPM_H 0 140#define BX_HAVE_XRANDR_H 0 141#define BX_HAVE_TIMELOCAL 0 142#define BX_HAVE_GMTIME 0 143#define BX_HAVE_MKTIME 0 144#define BX_HAVE_TMPFILE64 0 145#define BX_HAVE_FSEEK64 0 146#define BX_HAVE_FSEEKO64 0 147#define BX_HAVE_NET_IF_H 0 148#define BX_HAVE___BUILTIN_BSWAP32 0 149#define BX_HAVE___BUILTIN_BSWAP64 0 150#define BX_HAVE_SSIZE_T 0 151 152// This turns on Roland Mainz's idle hack. Presently it is specific to the X11 153// and term gui. If people try to enable it elsewhere, give a compile error 154// after the gui definition so that they don't waste their time trying. 155#define BX_USE_IDLE_HACK 0 156 157// Minimum Emulated IPS. 158// This is used in the realtime PIT as well as for checking the 159// IPS value set in the config file. 160#define BX_MIN_IPS 1000000 161 162// Minimum and maximum values for SMP quantum variable. Defines 163// how many instructions each CPU could execute in one 164// shot (one cpu_loop call) 165#define BX_SMP_QUANTUM_MIN 1 166#define BX_SMP_QUANTUM_MAX 32 167 168// Use Static Member Funtions to eliminate 'this' pointer passing 169// If you want the efficiency of 'C', you can make all the 170// members of the C++ CPU class to be static. 171// This defaults to 1 since it should improve performance, but when 172// SMP mode is enabled, it will be turned off by configure. 173#define BX_USE_CPU_SMF 1 174 175#define BX_USE_MEM_SMF 1 176 177// Use static member functions in IO DEVice emulation modules. 178// For efficiency, use C like functions for IO handling, 179// and declare a device instance at compile time, 180// instead of using 'new' and storing the pointer. This 181// eliminates some overhead, especially for high-use IO 182// devices like the disk drive. 183// 1 = Use static member efficiency (normal) 184// 0 = Use nonstatic member functions (use only if you need 185// multiple instances of a device class 186 187#define BX_USE_HD_SMF 1 // Hard drive 188#define BX_USE_BIOS_SMF 1 // BIOS 189#define BX_USE_CMOS_SMF 1 // CMOS 190#define BX_USE_DMA_SMF 1 // DMA 191#define BX_USE_FD_SMF 1 // Floppy 192#define BX_USE_KEY_SMF 1 // Keyboard 193#define BX_USE_PAR_SMF 1 // Parallel 194#define BX_USE_PIC_SMF 1 // PIC 195#define BX_USE_PIT_SMF 1 // PIT 196#define BX_USE_SER_SMF 1 // Serial 197#define BX_USE_UM_SMF 1 // Unmapped 198#define BX_USE_VGA_SMF 1 // VGA 199#define BX_USE_SB16_SMF 1 // SB 16 soundcard 200#define BX_USE_ES1370_SMF 1 // ES1370 soundcard 201#define BX_USE_DEV_SMF 1 // System Devices (port92) 202#define BX_USE_PCI_SMF 1 // PCI 203#define BX_USE_P2I_SMF 1 // PCI-to-ISA bridge 204#define BX_USE_PIDE_SMF 1 // PCI-IDE 205#define BX_USE_PCIDEV_SMF 1 // PCI-DEV 206#define BX_USE_USB_UHCI_SMF 1 // USB UHCI hub 207#define BX_USE_USB_OHCI_SMF 1 // USB OHCI hub 208#define BX_USE_USB_EHCI_SMF 1 // USB EHCI hub 209#define BX_USE_USB_XHCI_SMF 1 // USB xHCI hub 210#define BX_USE_PCIPNIC_SMF 1 // PCI pseudo NIC 211#define BX_USE_EFI_SMF 1 // External FPU IRQ 212#define BX_USE_GAMEPORT_SMF 1 // Gameport 213#define BX_USE_CIRRUS_SMF 1 // SVGA Cirrus 214#define BX_USE_BUSM_SMF 1 // Bus Mouse 215#define BX_USE_ACPI_SMF 1 // ACPI 216 217#define BX_PLUGINS 0 218#define BX_HAVE_LTDL 0 219#define BX_HAVE_DLFCN_H 0 220 221#if BX_PLUGINS && \ 222 ( !BX_USE_HD_SMF || !BX_USE_BIOS_SMF || !BX_USE_CMOS_SMF \ 223 || !BX_USE_DMA_SMF || !BX_USE_FD_SMF || !BX_USE_KEY_SMF \ 224 || !BX_USE_PAR_SMF || !BX_USE_PIC_SMF || !BX_USE_PIT_SMF \ 225 || !BX_USE_SER_SMF || !BX_USE_UM_SMF || !BX_USE_VGA_SMF \ 226 || !BX_USE_SB16_SMF || !BX_USE_ES1370_SMF || !BX_USE_DEV_SMF \ 227 || !BX_USE_PCI_SMF || !BX_USE_P2I_SMF || !BX_USE_USB_UHCI_SMF \ 228 || !BX_USE_USB_OHCI_SMF || !BX_USE_USB_EHCI_SMF || !BX_USE_USB_XHCI_SMF \ 229 || !BX_USE_PCIPNIC_SMF || !BX_USE_PIDE_SMF || !BX_USE_ACPI_SMF \ 230 || !BX_USE_EFI_SMF || !BX_USE_GAMEPORT_SMF || !BX_USE_PCIDEV_SMF \ 231 || !BX_USE_CIRRUS_SMF) 232#error You must use SMF to have plugins 233#endif 234 235#define USE_RAW_SERIAL 0 236 237// This option enables RAM file backing for large guest memory with a smaller 238// amount host memory, without causing a panic when host memory is exhausted. 239#define BX_LARGE_RAMFILE 0 240 241// This option defines the number of supported ATA channels. 242// There are up to two drives per ATA channel. 243#define BX_MAX_ATA_CHANNEL 4 244 245#if (BX_MAX_ATA_CHANNEL>4 || BX_MAX_ATA_CHANNEL<1) 246 #error "BX_MAX_ATA_CHANNEL should be between 1 and 4" 247#endif 248 249// ================================================================= 250// BEGIN: OPTIONAL DEBUGGER SECTION 251// 252// These options are only used if you compile in support for the 253// native command line debugging environment. Typically, the debugger 254// is not used, and this section can be ignored. 255// ================================================================= 256 257// Compile in support for virtual/linear/physical breakpoints. 258// Enable only those you need. Recommend using only linear 259// breakpoints, unless you need others. Less supported means 260// slightly faster execution time. 261#define BX_DBG_MAX_VIR_BPOINTS 16 262#define BX_DBG_MAX_LIN_BPOINTS 16 263#define BX_DBG_MAX_PHY_BPOINTS 16 264 265#define BX_DBG_MAX_WATCHPONTS 16 266 267// max file pathname size for debugger commands 268#define BX_MAX_PATH 256 269// max nesting level for debug scripts including other scripts 270#define BX_INFILE_DEPTH 10 271// use this command to include (nest) debug scripts 272#define BX_INCLUDE_CMD "source" 273 274// Make a call to command line debugger extensions. If set to 1, 275// a call is made. An external routine has a chance to process 276// the command. If it does, than the debugger ignores the command. 277#define BX_DBG_EXTENSIONS 0 278 279// ================================================================= 280// END: OPTIONAL DEBUGGER SECTION 281// ================================================================= 282 283////////////////////////////////////////////////////////////////////// 284// END OF USER CONFIGURABLE OPTIONS : DON'T EDIT ANYTHING BELOW !!! // 285// THIS IS GENERATED BY THE ./configure SCRIPT // 286////////////////////////////////////////////////////////////////////// 287 288 289#define BX_WITH_X11 0 290#define BX_WITH_WIN32 0 291#define BX_WITH_MACOS 0 292#define BX_WITH_CARBON 0 293#define BX_WITH_NOGUI 0 294#define BX_WITH_TERM 0 295#define BX_WITH_RFB 0 296#define BX_WITH_VNCSRV 0 297#define BX_WITH_AMIGAOS 0 298#define BX_WITH_SDL 0 299#define BX_WITH_SDL2 0 300#define BX_WITH_WX 0 301 302// BX_USE_TEXTCONFIG should be set to 1 unless Bochs is compiled 303// for wxWidgets only. 304#define BX_USE_TEXTCONFIG 1 305 306// BX_USE_GUI should be set to 1 for all guis with VGA console support 307// for 'textconfig'. 308#define BX_USE_GUI_CONSOLE 0 309 310// BX_USE_WIN32CONFIG should be set to 1 on WIN32 for the guis 311// "win32", "sdl" and "sdl2" only. 312#if BX_USE_TEXTCONFIG && defined(WIN32) && (BX_WITH_WIN32 || BX_WITH_SDL || BX_WITH_SDL2) 313 #define BX_USE_WIN32CONFIG 1 314#else 315 #define BX_USE_WIN32CONFIG 0 316#endif 317 318// set to 1 if wxMSW is a unicode version 319#define WX_MSW_UNICODE 0 320// set to GDK major version for wxGTK 321#define WX_GDK_VERSION 0 322 323// A certain functions must NOT be fastcall even if compiled with fastcall 324// option, and those are callbacks from Windows which are defined either 325// as cdecl or stdcall. The entry point main() also has to remain cdecl. 326#ifndef CDECL 327#if defined(_MSC_VER) 328 #define CDECL __cdecl 329#else 330 #define CDECL 331#endif 332#endif 333 334// add special export symbols for win32 DLL building. The main code must 335// have __declspec(dllexport) on variables, functions, or classes that the 336// plugins can access. The plugins should #define PLUGGABLE which will 337// activate the __declspec(dllimport) instead. 338#if (defined(WIN32) || defined(__CYGWIN__)) && !defined(BXIMAGE) 339# if BX_PLUGINS && defined(BX_PLUGGABLE) 340// #warning I will import DLL symbols from Bochs main program. 341# define BOCHSAPI __declspec(dllimport) 342# elif BX_PLUGINS 343// #warning I will export DLL symbols. 344# define BOCHSAPI __declspec(dllexport) 345# endif 346#endif 347#ifndef BOCHSAPI 348# define BOCHSAPI 349#endif 350 351#if defined(__CYGWIN__) 352// Make BOCHSAPI_CYGONLY exactly the same as BOCHSAPI. This symbol 353// will be used for any cases where Cygwin requires a special tag 354// but VC++ does not. 355#define BOCHSAPI_CYGONLY BOCHSAPI 356#else 357// define the symbol to be empty 358#define BOCHSAPI_CYGONLY /*empty*/ 359#endif 360 361#if defined(_MSC_VER) 362// Make BOCHSAPI_MSVCONLY exactly the same as BOCHSAPI. This symbol 363// will be used for any cases where VC++ requires a special tag 364// but Cygwin does not. 365#define BOCHSAPI_MSVCONLY BOCHSAPI 366#else 367// define the symbol to be empty 368#define BOCHSAPI_MSVCONLY /*empty*/ 369#endif 370 371#define BX_DEFAULT_CONFIG_INTERFACE "defined_by_configure" 372#define BX_DEFAULT_DISPLAY_LIBRARY "defined_by_configure" 373 374// Roland Mainz's idle hack is presently specific to X11. If people try to 375// enable it elsewhere, give a compile error so that they don't waste their 376// time trying. 377#if (BX_USE_IDLE_HACK && !BX_WITH_X11 && !BX_WITH_TERM) 378# error IDLE_HACK will only work with the X11 or term gui. Correct configure args and retry. 379#endif 380 381#define WORDS_BIGENDIAN 0 382 383#define SIZEOF_UNSIGNED_CHAR 0 384#define SIZEOF_UNSIGNED_SHORT 0 385#define SIZEOF_UNSIGNED_INT 0 386#define SIZEOF_UNSIGNED_LONG 0 387#define SIZEOF_UNSIGNED_LONG_LONG 0 388#define SIZEOF_INT_P 0 389 390#define BX_64BIT_CONSTANTS_USE_LL 1 391#if BX_64BIT_CONSTANTS_USE_LL 392// doesn't work on Microsoft Visual C++, maybe others 393#define BX_CONST64(x) (x##LL) 394#elif defined(_MSC_VER) 395#define BX_CONST64(x) (x##I64) 396#else 397#define BX_CONST64(x) (x) 398#endif 399 400#if defined(WIN32) 401 typedef unsigned char Bit8u; 402 typedef signed char Bit8s; 403 typedef unsigned short Bit16u; 404 typedef signed short Bit16s; 405 typedef unsigned int Bit32u; 406 typedef signed int Bit32s; 407#ifdef __GNUC__ 408 typedef unsigned long long Bit64u; 409 typedef signed long long Bit64s; 410#include <sys/types.h> 411#include <unistd.h> 412#else 413 typedef unsigned __int64 Bit64u; 414 typedef signed __int64 Bit64s; 415#endif 416#elif BX_WITH_MACOS 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 typedef unsigned long long Bit64u; 424 typedef signed long long Bit64s; 425#else 426 427// Unix like platforms 428 429#if SIZEOF_UNSIGNED_CHAR != 1 430# error "sizeof (unsigned char) != 1" 431#else 432 typedef unsigned char Bit8u; 433 typedef signed char Bit8s; 434#endif 435 436#if SIZEOF_UNSIGNED_SHORT != 2 437# error "sizeof (unsigned short) != 2" 438#else 439 typedef unsigned short Bit16u; 440 typedef signed short Bit16s; 441#endif 442 443#if SIZEOF_UNSIGNED_INT == 4 444 typedef unsigned int Bit32u; 445 typedef signed int Bit32s; 446#elif SIZEOF_UNSIGNED_LONG == 4 447 typedef unsigned long Bit32u; 448 typedef signed long Bit32s; 449#else 450# error "can't find sizeof(type) of 4 bytes!" 451#endif 452 453#if SIZEOF_UNSIGNED_LONG == 8 454 typedef unsigned long Bit64u; 455 typedef signed long Bit64s; 456#elif SIZEOF_UNSIGNED_LONG_LONG == 8 457 typedef unsigned long long Bit64u; 458 typedef signed long long Bit64s; 459#else 460# error "can't find data type of 8 bytes" 461#endif 462 463#endif 464 465#define GET32L(val64) ((Bit32u)(((Bit64u)(val64)) & 0xFFFFFFFF)) 466#define GET32H(val64) ((Bit32u)(((Bit64u)(val64)) >> 32)) 467 468// now that Bit32u and Bit64u exist, defined bx_address 469#if BX_SUPPORT_X86_64 470typedef Bit64u bx_address; 471#else 472typedef Bit32u bx_address; 473#endif 474 475// define physical and linear address types 476typedef bx_address bx_lin_address; 477 478#if BX_SUPPORT_X86_64 479#define BX_LIN_ADDRESS_WIDTH 48 480#else 481#define BX_LIN_ADDRESS_WIDTH 32 482#endif 483 484#if BX_PHY_ADDRESS_LONG 485typedef Bit64u bx_phy_address; 486#if BX_CPU_LEVEL == 5 487 #define BX_PHY_ADDRESS_WIDTH 36 488#else 489 #define BX_PHY_ADDRESS_WIDTH 40 490#endif 491#else 492typedef Bit32u bx_phy_address; 493#define BX_PHY_ADDRESS_WIDTH 32 494#endif 495 496// small sanity check 497#if BX_PHY_ADDRESS_LONG 498 #if (BX_PHY_ADDRESS_WIDTH <= 32) 499 #error "BX_PHY_ADDRESS_LONG implies emulated physical address width > 32 bit" 500 #endif 501#endif 502 503#define BX_PHY_ADDRESS_MASK ((((Bit64u)(1)) << BX_PHY_ADDRESS_WIDTH) - 1) 504 505#define BX_PHY_ADDRESS_RESERVED_BITS (~BX_PHY_ADDRESS_MASK) 506 507// technically, in an 8 bit signed the real minimum is -128, not -127. 508// But if you decide to negate -128 you tend to get -128 again, so it's 509// better not to use the absolute maximum in the signed range. 510#define BX_MAX_BIT64U ( (Bit64u) -1 ) 511#define BX_MIN_BIT64U ( 0 ) 512#define BX_MAX_BIT64S ( ((Bit64u) -1) >> 1 ) 513#define BX_MIN_BIT64S ( (Bit64s)(1ULL << 63) ) 514#define BX_MAX_BIT32U ( (Bit32u) -1 ) 515#define BX_MIN_BIT32U ( 0 ) 516#define BX_MAX_BIT32S ( ((Bit32u) -1) >> 1 ) 517#define BX_MIN_BIT32S ( (Bit32s)(1U << 31) ) 518#define BX_MAX_BIT16U ( (Bit16u) -1 ) 519#define BX_MIN_BIT16U ( 0 ) 520#define BX_MAX_BIT16S ( ((Bit16u) -1) >> 1 ) 521#define BX_MIN_BIT16S ( (Bit16s)-(((Bit16u) -1) >> 1) - 1) 522#define BX_MAX_BIT8U ( (Bit8u) -1 ) 523#define BX_MIN_BIT8U ( 0 ) 524#define BX_MAX_BIT8S ( ((Bit8u) -1) >> 1 ) 525#define BX_MIN_BIT8S ( (Bit8s)-(((Bit8u) -1) >> 1) - 1) 526 527 528// create an unsigned integer type that is the same size as a pointer. 529// You can typecast a pointer to a bx_pr_equiv_t without losing any 530// bits (and without getting the compiler excited). 531#if SIZEOF_INT_P == 4 532 typedef Bit32u bx_ptr_equiv_t; 533#elif SIZEOF_INT_P == 8 534 typedef Bit64u bx_ptr_equiv_t; 535#else 536# error "could not define bx_ptr_equiv_t to size of int*" 537#endif 538 539#if BX_WITH_MACOS 540# define bx_ptr_t char * 541#else 542# define bx_ptr_t void * 543#endif 544 545#if defined(WIN32) 546# define BX_LITTLE_ENDIAN 547#elif BX_WITH_MACOS 548# define BX_BIG_ENDIAN 549#else 550#if WORDS_BIGENDIAN 551# define BX_BIG_ENDIAN 552#else 553# define BX_LITTLE_ENDIAN 554#endif 555#endif // defined(WIN32) 556 557// for now only term.cc requires a GUI sighandler. 558#define BX_GUI_SIGHANDLER (BX_WITH_TERM) 559 560#define HAVE_SIGACTION 1 561 562// Use BX_CPP_INLINE for all C++ inline functions. 563#define BX_CPP_INLINE inline 564 565#ifdef __GNUC__ 566 567// Some helpful compiler hints for compilers that allow them; GCC for now. 568// 569// BX_CPP_AlignN(n): 570// Align a construct on an n-byte boundary. 571// 572// BX_CPP_AttrPrintf(formatArg, firstArg): 573// This function takes printf-like arguments, so the compiler can check 574// the consistency of the format string and the matching arguments. 575// 'formatArg' is the parameter number (starting from 1) of the format 576// string argument. 'firstArg' is the parameter number of the 1st argument 577// to check against the string argument. NOTE: For non-static member 578// functions, the this-ptr is argument number 1 but is invisible on 579// the function prototype declaration - but you still have to count it. 580// 581// BX_CPP_AttrNoReturn(): 582// This function never returns. The compiler can optimize-out following 583// code accordingly. 584 585#define BX_CPP_AlignN(n) __attribute__ ((aligned (n))) 586#define BX_CPP_AttrPrintf(formatArg, firstArg) \ 587 __attribute__ ((format (printf, formatArg, firstArg))) 588#define BX_CPP_AttrNoReturn() __attribute__ ((noreturn)) 589 590#ifndef likely 591#define likely(x) __builtin_expect(!!(x), 1) 592#endif 593 594#ifndef unlikely 595#define unlikely(x) __builtin_expect(!!(x), 0) 596#endif 597 598#else 599 600#define BX_CPP_AlignN(n) /* Not supported. */ 601#define BX_CPP_AttrPrintf(formatArg, firstArg) /* Not supported. */ 602#define BX_CPP_AttrNoReturn() /* Not supported. */ 603 604#ifndef likely 605#define likely(x) (x) 606#endif 607 608#ifndef unlikely 609#define unlikely(x) (x) 610#endif 611 612#endif 613 614#define BX_GDBSTUB 0 615#define BX_DEBUGGER 0 616#define BX_DEBUGGER_GUI 0 617 618#define BX_INSTRUMENTATION 0 619 620// enable BX_DEBUG/BX_ERROR/BX_INFO messages 621#define BX_NO_LOGGING 0 622 623// enable BX_ASSERT checks 624#define BX_ASSERT_ENABLE 0 625 626// enable statistics collection 627#define BX_ENABLE_STATISTICS 0 628 629#define BX_SUPPORT_ALIGNMENT_CHECK 0 630#define BX_SUPPORT_FPU 0 631#define BX_SUPPORT_3DNOW 0 632#define BX_SUPPORT_PKEYS 0 633#define BX_SUPPORT_CET 0 634#define BX_SUPPORT_MONITOR_MWAIT 0 635#define BX_SUPPORT_PERFMON 0 636#define BX_SUPPORT_MEMTYPE 0 637#define BX_SUPPORT_SVM 0 638#define BX_SUPPORT_VMX 0 639#define BX_SUPPORT_AVX 0 640#define BX_SUPPORT_EVEX 0 641 642#if BX_SUPPORT_SVM && BX_SUPPORT_X86_64 == 0 643 #error "SVM require x86-64 support" 644#endif 645 646#if BX_SUPPORT_VMX >= 2 && BX_SUPPORT_X86_64 == 0 647 #error "VMX=2 require x86-64 support" 648#endif 649 650#if BX_SUPPORT_AVX && BX_SUPPORT_X86_64 == 0 651 #error "AVX require x86-64 support" 652#endif 653 654#if BX_SUPPORT_EVEX && BX_SUPPORT_AVX == 0 655 #error "EVEX and AVX-512 support require AVX to be compiled in" 656#endif 657 658#define BX_SUPPORT_REPEAT_SPEEDUPS 0 659#define BX_SUPPORT_HANDLERS_CHAINING_SPEEDUPS 0 660#define BX_ENABLE_TRACE_LINKING 0 661 662#if (BX_DEBUGGER || BX_GDBSTUB) && BX_SUPPORT_HANDLERS_CHAINING_SPEEDUPS 663 #error "Handler-chaining-speedups are not supported together with internal debugger or gdb-stub!" 664#endif 665 666#if BX_SUPPORT_3DNOW 667 #define BX_CPU_VENDOR_INTEL 0 668#else 669 #define BX_CPU_VENDOR_INTEL 1 670#endif 671 672// Maximum CPUID vendor and brand string lengths 673#define BX_CPUID_VENDOR_LEN 12 674#define BX_CPUID_BRAND_LEN 48 675 676#define BX_CONFIGURE_MSRS 0 677 678#if (BX_SUPPORT_ALIGNMENT_CHECK && BX_CPU_LEVEL < 4) 679 #error Alignment exception check is not supported in i386 ! 680#endif 681 682#if (BX_CONFIGURE_MSRS && BX_CPU_LEVEL < 5) 683 #error MSRs are supported only with CPU level >= 5 ! 684#endif 685 686#if (!BX_SUPPORT_FPU && BX_CPU_LEVEL > 4) 687 #error With CPU level > 4, you must enable FPU support ! 688#endif 689 690#if (BX_SUPPORT_FPU && BX_CPU_LEVEL < 3) 691 #error "FPU cannot be compiled without cpu level >= 3 !" 692#endif 693 694#if (BX_CPU_LEVEL<6 && BX_SUPPORT_VMX) 695 #error "VMX only supported with CPU_LEVEL >= 6 !" 696#endif 697 698#if BX_SUPPORT_X86_64 699// Sanity checks to ensure that you cannot accidently use conflicting options. 700 701#if BX_CPU_LEVEL < 6 702 #error "X86-64 requires cpu level 6 or greater !" 703#endif 704#endif 705 706// We have tested the following combinations: 707// * processors=1, bootstrap=0, ioapic_id=1 (uniprocessor system) 708// * processors=2, bootstrap=0, ioapic_id=2 709// * processors=4, bootstrap=0, ioapic_id=4 710// * processors=8, bootstrap=0, ioapic_id=8 711#define BX_SUPPORT_SMP 0 712#define BX_BOOTSTRAP_PROCESSOR 0 713 714// For P6 and Pentium family processors the local APIC ID feild is 4 bits 715// APIC_MAX_ID indicate broadcast so it can't be used as valid APIC ID 716#define BX_MAX_SMP_THREADS_SUPPORTED 0xfe /* leave APIC ID for I/O APIC */ 717 718// include in APIC models, required for a multiprocessor system. 719#if BX_SUPPORT_SMP || BX_CPU_LEVEL >= 5 720 #define BX_SUPPORT_APIC 1 721#else 722 #define BX_SUPPORT_APIC 0 723#endif 724 725#define BX_HAVE_GETENV 0 726#define BX_HAVE_SETENV 0 727#define BX_HAVE_SELECT 0 728#define BX_HAVE_SNPRINTF 0 729#define BX_HAVE_VSNPRINTF 0 730#define BX_HAVE_STRTOULL 0 731#define BX_HAVE_STRTOUQ 0 732#define BX_HAVE_STRDUP 0 733#define BX_HAVE_STRREV 0 734#define BX_HAVE_STRICMP 0 735#define BX_HAVE_STRCASECMP 0 736 737// used in term gui 738#define BX_HAVE_COLOR_SET 0 739#define BX_HAVE_MVHLINE 0 740#define BX_HAVE_MVVLINE 0 741 742 743// set if your compiler does not understand __attribute__ after a struct 744#define BX_NO_ATTRIBUTES 0 745#if BX_NO_ATTRIBUTES 746#define GCC_ATTRIBUTE(x) /* attribute not supported */ 747#else 748#define GCC_ATTRIBUTE __attribute__ 749#endif 750 751// set to use fast function calls 752#define BX_FAST_FUNC_CALL 0 753 754// On gcc2.95+ x86 only 755#if BX_FAST_FUNC_CALL && defined(__i386__) && defined(__GNUC__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)) 756#if BX_USE_CPU_SMF == 1 757# define BX_CPP_AttrRegparmN(X) __attribute__((regparm(X))) 758#else 759// FIXME: BX_FAST_FUNC_CALL doesn't work with BX_USE_CPU_SMF = 0 760# define BX_CPP_AttrRegparmN(X) /* Not defined */ 761#endif 762#else 763# define BX_CPP_AttrRegparmN(X) /* Not defined */ 764#endif 765 766// set if you do have <set>, used in bx_debug/dbg_main.c 767#define BX_HAVE_SET 0 768 769// set if you do have <set.h>, used in bx_debug/dbg_main.c 770#define BX_HAVE_SET_H 0 771 772// set if you do have <map>, used in bx_debug/dbg_main.c 773#define BX_HAVE_MAP 0 774 775// set if you do have <map.h>, used in bx_debug/dbg_main.c 776#define BX_HAVE_MAP_H 0 777 778// Support x86 hardware debugger registers and facilities. 779// These are the debug facilities offered by the x86 architecture, 780// not the optional built-in debugger. 781#define BX_X86_DEBUGGER 0 782 783// limited i440FX PCI support 784#define BX_SUPPORT_PCI 0 785 786// Experimental host PCI device mapping 787#define BX_SUPPORT_PCIDEV 0 788 789#if (BX_SUPPORT_PCIDEV && !BX_SUPPORT_PCI) 790 #error To enable PCI host device mapping, you must also enable PCI 791#endif 792 793// CLGD54XX emulation 794#define BX_SUPPORT_CLGD54XX 0 795 796// Experimental 3dfx Voodoo (SST-1/2) emulation 797#define BX_SUPPORT_VOODOO 0 798 799// USB host controllers 800#define BX_SUPPORT_USB_UHCI 0 801#define BX_SUPPORT_USB_OHCI 0 802#define BX_SUPPORT_USB_EHCI 0 803#define BX_SUPPORT_USB_XHCI 0 804#define BX_SUPPORT_PCIUSB \ 805 (BX_SUPPORT_USB_UHCI || BX_SUPPORT_USB_OHCI || BX_SUPPORT_USB_EHCI || BX_SUPPORT_USB_XHCI) 806 807#if (BX_SUPPORT_PCIUSB && !BX_SUPPORT_PCI) 808 #error To enable USB, you must also enable PCI 809#endif 810 811#if (BX_SUPPORT_USB_EHCI && !BX_SUPPORT_USB_UHCI) 812 #error To enable EHCI, you must also enable UHCI 813#endif 814 815// MS bus mouse support 816#define BX_SUPPORT_BUSMOUSE 0 817 818#define BX_SUPPORT_CDROM 0 819 820#if BX_SUPPORT_CDROM 821 // This is the C++ class name to use if we are supporting 822 // low-level CDROM. 823# define LOWLEVEL_CDROM cdrom_base_c 824#endif 825 826// NE2K network emulation 827#define BX_SUPPORT_NE2K 0 828 829// Pseudo PCI NIC 830#define BX_SUPPORT_PCIPNIC 0 831 832#if (BX_SUPPORT_PCIPNIC && !BX_SUPPORT_PCI) 833 #error To enable the PCI pseudo NIC, you must also enable PCI 834#endif 835 836// Intel(R) Gigabit Ethernet 837#define BX_SUPPORT_E1000 0 838 839#if (BX_SUPPORT_E1000 && !BX_SUPPORT_PCI) 840 #error To enable the E1000 NIC, you must also enable PCI 841#endif 842 843// this enables the lowlevel stuff below if one of the NICs is present 844#define BX_NETWORKING 0 845 846// which networking modules will be enabled 847// determined by configure script 848#define BX_NETMOD_FBSD 0 849#define BX_NETMOD_LINUX 0 850#define BX_NETMOD_WIN32 0 851#define BX_NETMOD_TAP 0 852#define BX_NETMOD_TUNTAP 0 853#define BX_NETMOD_VDE 0 854#define BX_NETMOD_SLIRP 0 855#define BX_NETMOD_SOCKET 0 856 857// Soundcard and gameport support 858#define BX_SUPPORT_SB16 0 859#define BX_SUPPORT_ES1370 0 860#define BX_SUPPORT_GAMEPORT 0 861#define BX_SUPPORT_SOUNDLOW 0 862 863// which sound lowlevel modules will be enabled 864#define BX_HAVE_SOUND_ALSA 0 865#define BX_HAVE_SOUND_OSS 0 866#define BX_HAVE_SOUND_OSX 0 867#define BX_HAVE_SOUND_SDL 0 868#define BX_HAVE_SOUND_WIN 0 869 870#if BX_SUPPORT_SOUNDLOW 871// Determines which sound lowlevel driver is to be used as the default. 872// Currently the following are available: 873// alsa Output for Linux with ALSA PCM and sequencer interface 874// oss Output for Linux, to /dev/dsp and /dev/midi00 875// osx Output for MacOSX midi and wave device 876// sdl Wave output with SDL/SDL2 877// win Output for Windows midi and wave mappers 878// file Wave and midi output to file 879// dummy Dummy functions, no output 880#define BX_SOUND_LOWLEVEL_NAME "dummy" 881// resampling support 882#define BX_HAVE_LIBSAMPLERATE 0 883#define BX_HAVE_SOXR_LSR 0 884// SDL2 audio capture support (version >= 2.0.5) 885#define BX_HAVE_SDL2_AUDIO_CAPTURE 0 886#endif 887 888#if (BX_SUPPORT_ES1370 && !BX_SUPPORT_PCI) 889 #error To enable the ES1370 soundcard, you must also enable PCI 890#endif 891 892// I/O Interface to debugger 893#define BX_SUPPORT_IODEBUG 0 894 895#ifdef WIN32 896#define BX_FLOPPY0_NAME "Floppy Disk A:" 897#define BX_FLOPPY1_NAME "Floppy Disk B:" 898#else 899#define BX_FLOPPY0_NAME "Floppy Disk 0" 900#define BX_FLOPPY1_NAME "Floppy Disk 1" 901#endif 902 903#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ == 0) 904#error "gcc 4.0.0 is known to produce incorrect code which breaks Bochs emulation" 905#endif 906 907#endif // _BX_CONFIG_H 908