void Agent::InitializeAgent() { // First allocate IORegionType at ioRegionPtr and fill with zero ioRegionType = (GuamInputOutput::IORegionType*)Store(Alloc(SIZE(GuamInputOutput::IORegionType))); for(int i = 0; i < GuamInputOutput::AgentDeviceIndex_SIZE; i++) { ioRegionType->fcbptrs[i] = 0; } // Then allocate FCB after IORegionType. for(int i = 0; i < GuamInputOutput::AgentDeviceIndex_SIZE; i++) { Agent *agent = allAgent[i]; if (agent == 0) continue; if (agent->getFCBSize() == 0) continue; agent->InitializeFCB(); } // Call Agent Initialize method to initialize fcb and state for(int i = 0; i < GuamInputOutput::AgentDeviceIndex_SIZE; i++) { Agent *agent = allAgent[i]; if (agent == 0) continue; if (agent->getFCBSize() == 0) continue; agent->Initialize(); } }