Exemple #1
0
void EventManager::refresh()
{
	if ( m_raisingEvent > 0 )
	{
		// do not alter listing if events are being raised
		return;
	}

	// process attach/detach requests
	AssocListIter alIter = m_listEdits.begin();

	for ( ; alIter != m_listEdits.end(); ++alIter )
	{
		if ( alIter->attach == true )
		{
			_attach ( alIter->eId, alIter->receiver );
		}

		else
		{
			_detach ( alIter->eId, alIter->receiver );
		}
	}

	m_listEdits.clear();
}
Exemple #2
0
void io_ptr_interface::empty()
{
	_detach(true);

	_io_ptr    = 0;
	_io_size   = 0;
	_io_offset = 0;
}
void ObjectHierarchy::_trimBelow(SPObject *limit) {
    while ( !_hierarchy.empty() && _hierarchy.front().object != limit ) {
        SPObject *object=_hierarchy.front().object;
        sp_object_ref(object, NULL);
        _detach(_hierarchy.front());
        _hierarchy.pop_front();
        _removed_signal.emit(object);
        sp_object_unref(object, NULL);
    }
}
Exemple #4
0
void inject_ctx_deinit(inject_ctx *ctx) {
	_detach(ctx->pid);

	free(ctx->dynsym);
	free(ctx->dynstr);
	free(ctx->symtab);
	free(ctx->strtab);
	free(ctx->got);

	free(ctx);
}
Exemple #5
0
void io_ptr_interface::_copy(const io_ptr_interface& src)
{
	_detach(true);

	_io_ptr = src.ptr();
	_io_offset = src.offset();
	_io_size = src.size();

	if (src._is_attached()) {
		_io_mngr = src._get_mngr();
		_io_mngr->_attach(this);
	}
}
Exemple #6
0
bool io_ptr_interface::_copy_range(io_ptr_interface& src, dword offset, uint32_t size)
{
	dword src_offset = src.offset();
	uint32_t src_size = src.size();

	if (size == 0 || src_offset > offset || src_offset + src_size < offset + size)
		return false;

	_detach(true);

	uint32_t diff = offset - src_offset;
	_io_ptr = reinterpret_cast<uint8_t*>(src.ptr()) + diff;
	_io_offset = offset;
	_io_size = size;

	if (src._is_attached()) {
		_io_mngr = src._get_mngr();
		_io_mngr->_attach(this);
	}

	return true;
}
Exemple #7
0
static void _handle_client(struct psl *psl, struct client *client)
{
	struct mmio_event *mmio;
	struct cmd_event *cmd;
	uint8_t buffer[MAX_LINE_CHARS];
	int dw = 0;
	int eb_rd = 0;

	// Handle MMIO done
	if (client->mmio_access != NULL) {
		client->idle_cycles = PSL_IDLE_CYCLES;
		client->mmio_access = handle_mmio_done(psl->mmio, client);
	}
	// Client disconnected
	if (client->state == CLIENT_NONE)
		return;

	// Check for event from application
	cmd = (struct cmd_event *)client->mem_access;
	mmio = NULL;
	if (bytes_ready(client->fd, 1, &(client->abort))) {
		if (get_bytes(client->fd, 1, buffer, psl->timeout,
			      &(client->abort), psl->dbg_fp, psl->dbg_id,
			      client->context) < 0) {
			client_drop(client, PSL_IDLE_CYCLES, CLIENT_NONE);
			return;
		}
		switch (buffer[0]) {
		case PSLSE_DETACH:
		        debug_msg("DETACH request from client context %d on socket %d", client->context, client->fd);
		        //client_drop(client, PSL_IDLE_CYCLES, CLIENT_NONE);
		        _detach(psl, client);
			break;
		case PSLSE_ATTACH:
			_attach(psl, client);
			break;
		case PSLSE_MEM_FAILURE:
			if (client->mem_access != NULL)
				handle_aerror(psl->cmd, cmd);
			client->mem_access = NULL;
			break;
		case PSLSE_MEM_SUCCESS:
			if (client->mem_access != NULL)
				handle_mem_return(psl->cmd, cmd, client->fd);
			client->mem_access = NULL;
			debug_msg("PSL LOOP SETTING mem_access back to NULL");
			break;
		case PSLSE_MMIO_MAP:
			handle_mmio_map(psl->mmio, client);
			break;
		case PSLSE_MMIO_WRITE64:
			dw = 1;
		case PSLSE_MMIO_WRITE32:	/*fall through */
			mmio = handle_mmio(psl->mmio, client, 0, dw, 0);
			break;
		case PSLSE_MMIO_EBREAD:
                        eb_rd = 1;
		case PSLSE_MMIO_READ64: /*fall through */
			dw = 1;
		case PSLSE_MMIO_READ32:	/*fall through */
			mmio = handle_mmio(psl->mmio, client, 1, dw, eb_rd);
			break;
		default:
		  error_msg("Unexpected 0x%02x from client on socket", buffer[0], client->fd);
		}

		if (mmio)
			client->mmio_access = (void *)mmio;

		if (client->state == CLIENT_VALID)
			client->idle_cycles = PSL_IDLE_CYCLES;
	}
}