//----------------------------------------------------------------------- void DrmaManager::bspPut(int pid, const void * src, void * dst, int offset, int nBytes){ assert(0 <= pid < baseProcess_->getTotalNumProcs()); int logicDst = findLastRegistration(dst); Registration & reg = getRegistration(logicDst); if (offset + nBytes > reg.size()){ cerr << "[ERROR] DrmaManager::BspPut->Invalid bounds on operation" << endl; throw InvalidBoundsOnDrmaOperationException(); } BspPut bspPut; bspPut.logicAddr(logicDst) .offset(offset) .nBytes(nBytes) .superstep(baseProcess_->superstep()) .arch(dstArch); bspPut.writeInMem(src); if (pid != baseProcess_->getMyPid()){ stubPool_->bspPut(pid, bspPut); } else{ addPendingPut(bspPut); } /** ---------------- RYC ------------- */ // cerr << "[RYC] DrmaManager::bspPut->sendingData OK" << endl; }
//-------------------------------------------------------------------------------- void BspProxyStubPool::bspPut(const int & taskPid, BspPut & bspPut){ int initialStackSize = lua_gettop(clientSideState); lua_getglobal(clientSideState, getTaskId(taskPid).c_str()); lua_pushstring(clientSideState, "bspPut"); lua_gettable(clientSideState, -2); lua_getglobal(clientSideState, getTaskId(taskPid).c_str()); lua_newtable(clientSideState); LuaUtils::setFieldOnTable(clientSideState, "arch", bspPut.arch(), -1); LuaUtils::setFieldOnTable(clientSideState, "logicAddr", bspPut.logicAddr(), -1); LuaUtils::setFieldOnTable(clientSideState, "offset", bspPut.offset(), -1); LuaUtils::setFieldOnTable(clientSideState, "nBytes", bspPut.nBytes(), -1); LuaUtils::setFieldOnTable(clientSideState, "superstep", bspPut.superstep(), -1); lua_pushstring(clientSideState, "memArea"); const char * memArea = (char *) bspPut.memArea(); lua_pushlstring(clientSideState, memArea, bspPut.nBytes()); lua_settable(clientSideState, -3); if (lua_pcall(clientSideState, 2, 0, 0) != 0){ cerr << "[ERROR] ToTask: " << taskPid << " BspProxyStubPool::bspPut->Lua error: " << lua_tostring(clientSideState, -1) << endl; lua_pop(clientSideState, 1); } lua_pop(clientSideState, 1);//removes proxy from stack assert(initialStackSize == lua_gettop(clientSideState)); }