Exemplo n.º 1
0
bool
as_can_read(struct addrspace *as, vaddr_t vaddr)
{
    // see if vaddr is in a defined region (including stack and heap)
    for (int i = 0; i < NSEGS + 2; i++) {
        if (seg_contains(&as->as_segs[i], vaddr))
            return true;
    }
    return false;
}
Exemplo n.º 2
0
/**
 * Detects whether the first memory segment contains the other.
 *
 * @param[in] reg_entry the registration entry
 * @param[in] buf       starting address for the contiguous memory region
 * @param[in] len       length of the contiguous memory region
 *
 * @pre NULL != reg_entry
 * @pre NULL != buf
 * @pre len >= 0
 *
 * @return RR_SUCCESS on success
 */
static reg_return_t
reg_entry_contains(reg_entry_t *reg_entry, void *buf, size_t len)
{
    /* preconditions */
    assert(NULL != reg_entry);
    assert(NULL != buf);
    assert(len >= 0);

    return seg_contains(
               reg_entry->buf, reg_entry->len,
               buf, len);
}
Exemplo n.º 3
0
bool
as_can_write(struct addrspace *as, vaddr_t vaddr)
{
    // see if vaddr is in a defined region (including stack and heap)
    for (int i = 0; i < NSEGS + 2; i++) {
        if (seg_contains(&as->as_segs[i], vaddr)) {
            // turn off write protection when loading segments
            return as->as_loading? true : as->as_segs[i].seg_write;
        }
    }
    return false;
}
Exemplo n.º 4
0
/**
 * Detects whether the first memory segment contains the other.
 *
 * @param[in] reg_entry the registration entry
 * @param[in] buf       starting address for the contiguous memory region
 * @param[in] len       length of the contiguous memory region
 *
 * @pre NULL != reg_entry
 * @pre NULL != buf
 * @pre len >= 0
 *
 * @return RR_SUCCESS on success
 */
STATIC reg_return_t
reg_entry_contains(reg_entry_t *reg_entry, void *buf, int len)
{
#if DEBUG
    printf("[%d] reg_entry_contains(reg_entry=%p, buf=%p, len=%d)\n",
            g_state.rank, reg_entry, buf, len);
#endif

    /* preconditions */
    COMEX_ASSERT(NULL != reg_entry);
    COMEX_ASSERT(NULL != buf);
    COMEX_ASSERT(len >= 0);

    return seg_contains(
            reg_entry->buf, reg_entry->len,
            buf, len);
}
Exemplo n.º 5
0
/*
** SUPPORT ROUTINES
*/
bool
gseg_leaf_consistent(SEG *key,
					 SEG *query,
					 StrategyNumber strategy)
{
	bool		retval;

#ifdef GIST_QUERY_DEBUG
	fprintf(stderr, "leaf_consistent, %d\n", strategy);
#endif

	switch (strategy)
	{
		case RTLeftStrategyNumber:
			retval = (bool) seg_left(key, query);
			break;
		case RTOverLeftStrategyNumber:
			retval = (bool) seg_over_left(key, query);
			break;
		case RTOverlapStrategyNumber:
			retval = (bool) seg_overlap(key, query);
			break;
		case RTOverRightStrategyNumber:
			retval = (bool) seg_over_right(key, query);
			break;
		case RTRightStrategyNumber:
			retval = (bool) seg_right(key, query);
			break;
		case RTSameStrategyNumber:
			retval = (bool) seg_same(key, query);
			break;
		case RTContainsStrategyNumber:
		case RTOldContainsStrategyNumber:
			retval = (bool) seg_contains(key, query);
			break;
		case RTContainedByStrategyNumber:
		case RTOldContainedByStrategyNumber:
			retval = (bool) seg_contained(key, query);
			break;
		default:
			retval = FALSE;
	}
	return (retval);
}
Exemplo n.º 6
0
bool
seg_contained(SEG *a, SEG *b)
{
	return (seg_contains(b, a));
}
Exemplo n.º 7
0
/**
 * Detects whether the first dmapp segment contains the other.
 *
 * @param[in] first     the original registration entry
 * @param[in] second    segment to test against
 *
 * @return RR_SUCCESS on success
 */
static reg_return_t
dmapp_seg_contains(dmapp_seg_desc_t first, dmapp_seg_desc_t second)
{
    return seg_contains(first.addr, first.len, second.addr, second.len);
}