Ejemplo n.º 1
0
  //--------------------------------------------------------------------------------
  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));

  }
Ejemplo n.º 2
0
  //-----------------------------------------------------------------------
  int BspProxyImpl::bspPutWrapper(struct lua_State * state){

    int n = lua_gettop(state);
    assert(n == 1);

    BspPut bspPut;

    bspPut.arch(LuaUtils::getIntFromTable(state, "arch"))
          .logicAddr(LuaUtils::getIntFromTable(state, "logicAddr"))
          .offset(LuaUtils::getIntFromTable(state, "offset"))
          .nBytes(LuaUtils::getIntFromTable(state, "nBytes"))
          .superstep(LuaUtils::getIntFromTable(state, "superstep"));

    lua_pushstring(state, "memArea");
    lua_gettable(state, -2);
    bspPut.writeInMem(lua_tostring(state,-1));
    lua_pop(state, 1);

    BspProxyImpl::singleInstance->drmaManager_->addPendingPut(bspPut);
    return 0;

  }