static bool init_iosystem(void) { int i; for (i=0; i<IO_NUM_BASEPOOL; i++) IO_basePool[i].iotype = IO_USE_NULLIO; IO_defaultBase.iotype = IO_USE_PORTIO; IO_defaultBase.addr = 0L; IO_defaultBase.size = 0x10000L; if (IO_POOL_INITLOCK() == false) { err_print("%s: fail to initialize the lock of IO_basePool!\n", __FUNCTION__); return false; } #if defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM) || defined(DMP_DOS_BC) return true; #elif defined(USE_WINIO2) || defined(USE_WINIO3) if (!InitializeWinIo()) { err_print("%s: fail to initialize WinIO!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PCIDEBUG) if (getdllstatus() != DLLSTATUS_NOERROR) { err_print("%s: fail to initialize PCIDEBUG!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PHYMEM) if (LoadPhyMemDriver() == FALSE) { err_print("%s: fail to initialize PHYMEM!\n", __FUNCTION__); return false; } return true; #elif defined(DMP_LINUX) if (iopl(3) != 0) { err_print("%s: fail to set iopl(level=3) (%d)!\n", __FUNCTION__, errno); return false; } if ((IO_mmioFD = open("/dev/mem", O_RDWR | O_SYNC)) == -1) err_print("%s: fail to open /dev/mem (%d)!\n", __FUNCTION__, errno); return true; #endif }
static bool init_iosystem(void) { int i; for (i=0; i<IO_NUM_BASEPOOL; i++) IO_basePool[i].iotype = IO_USE_NULLIO; // TODO: IO_defaultBase shouldn't be used in WinXP or Linux Kernel Modes // #if defined(DMP_OS_KERNEL) // IO_defaultBase.iotype = IO_USE_NULLIO; // #else IO_defaultBase.iotype = IO_USE_PORTIO; IO_defaultBase.addr = 0L; IO_defaultBase.size = 0x10000L; #if defined(DMP_DOS_DJGPP) || defined(DMP_DOS_WATCOM) || defined(DMP_DOS_BC) return true; #elif defined(USE_WINIO2) || defined(USE_WINIO3) if (!InitializeWinIo()) { err_print((char*)"%s: fail to initialize WinIO!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PCIDEBUG) if (getdllstatus() != DLLSTATUS_NOERROR) { err_print((char*)"%s: fail to initialize PCIDEBUG!\n", __FUNCTION__); return false; } return true; #elif defined(USE_PHYMEM) if (LoadPhyMemDriver() == FALSE) { err_print((char*)"%s: fail to initialize PHYMEM!\n", __FUNCTION__); return false; } return true; #elif defined(DMP_LINUX) if (iopl(3) != 0) { err_print((char*)"%s: fail to set iopl(3)!\n", __FUNCTION__); return false; } return true; #endif }