Ejemplo n.º 1
0
 def cont(self):   
     msg = create_avatar_message("AVATAR_RPC_HTD_RESUME_VM", {})
     expected_replies = ["AVATAR_RPC_DTH_REPLY_OK",  "AVATAR_RPC_DTH_REPLY_ERROR"]
     cv = threading.Condition()
     ref = Reference()
     
     cv.acquire()
     self._queued_commands.put((msg, expected_replies, cv, ref))
     cv.wait()
     cv.release()
     if ref.get_value().name == "AVATAR_RPC_DTH_REPLY_ERROR":
         raise AvatarRemoteError(ref.get_value().error)
Ejemplo n.º 2
0
 def execute_codelet(self, address):
     msg = create_avatar_message("AVATAR_RPC_HTD_CODELET_EXECUTE", {"address": address})
     expected_replies = ["AVATAR_RPC_DTH_REPLY_CODELET_EXECUTION_FINISHED",  "AVATAR_RPC_DTH_REPLY_ERROR"]
     cv = threading.Condition()
     ref = Reference()
     
     cv.acquire()
     self._queued_commands.put((msg, expected_replies, cv, ref))
     cv.wait()
     cv.release()
     if ref.get_value().name == "AVATAR_RPC_DTH_REPLY_ERROR":
         raise AvatarRemoteError(ref.get_value().error)
Ejemplo n.º 3
0
 def write_memory(self, address, size, value):
     msg = create_avatar_message("AVATAR_RPC_HTD_WRITE_MEMORY", {"address": address, "size": size, "value": value})
     expected_replies = ["AVATAR_RPC_DTH_REPLY_OK",  "AVATAR_RPC_DTH_REPLY_ERROR"]
     cv = threading.Condition()
     ref = Reference()
     
     cv.acquire()
     self._queued_commands.put((msg, expected_replies, cv, ref))
     cv.wait()
     cv.release()
     if ref.get_value().name == "AVATAR_RPC_DTH_REPLY_ERROR":
         raise AvatarRemoteError(ref.get_value().error)
Ejemplo n.º 4
0
 def get_register(self, register):
     msg = create_avatar_message("AVATAR_RPC_HTD_GET_REGISTER", {"register": register})
     expected_replies = ["AVATAR_RPC_DTH_REPLY_GET_REGISTER",  "AVATAR_RPC_DTH_REPLY_ERROR"]
     cv = threading.Condition()
     ref = Reference()
     
     cv.acquire()
     self._queued_commands.put((msg, expected_replies, cv, ref))
     cv.wait()
     cv.release()
     if ref.get_value().name == "AVATAR_RPC_DTH_REPLY_ERROR":
         raise AvatarRemoteError(ref.get_value().error)
     return ref.get_value().value
Ejemplo n.º 5
0
 def write_memory_untyped(self, address, data):
     assert(len(data) <= 255)
     assert(isinstance(data, bytes))
     msg = create_avatar_message("AVATAR_RPC_HTD_WRITE_UNTYPED_MEMORY", {"address": address, "data": data})
     expected_replies = ["AVATAR_RPC_DTH_REPLY_OK",  "AVATAR_RPC_DTH_REPLY_ERROR"]
     cv = threading.Condition()
     ref = Reference()
     
     cv.acquire()
     self._queued_commands.put((msg, expected_replies, cv, ref))
     cv.wait()
     cv.release()
     if ref.get_value().name == "AVATAR_RPC_DTH_REPLY_ERROR":
         raise AvatarRemoteError(ref.get_value().error)
Ejemplo n.º 6
0
 def read_memory_untyped(self, address, size):
     assert(size <= 255)
     msg = create_avatar_message("AVATAR_RPC_HTD_READ_UNTYPED_MEMORY", {"address": address, "size": size})
     expected_replies = ["AVATAR_RPC_DTH_REPLY_READ_UNTYPED_MEMORY",  "AVATAR_RPC_DTH_REPLY_ERROR"]
     cv = threading.Condition()
     ref = Reference()
     
     cv.acquire()
     self._queued_commands.put((msg, expected_replies, cv, ref))
     cv.wait()
     cv.release()
     if ref.get_value().name == "AVATAR_RPC_DTH_REPLY_ERROR":
         raise AvatarRemoteError(ref.get_value().error)
     
     return ref.get_value().data