FreeBSD/sys/i386/i386/i686_mem.c
/*
 * Try to satisfy the given range request by manipulating the fixed
 * MTRRs that cover low memory.
 *
 * Note that we try to be generous here; we'll bloat the range out to
 * the next higher/lower boundary to avoid the consumer having to know
 * too much about the mechanisms here.
 *
 * XXX note that this will have to be updated when we start supporting
 * "busy" ranges.
 */
Try to satisfy the given range request by manipulating the fixed
MTRRs that cover low memory.

Note that we try to be generous here; we'll bloat the range out to
the next higher/lower boundary to avoid the consumer having to know
too much about the mechanisms here.

XXX note that this will have to be updated when we start supporting
"busy" ranges.
Try to satisfy the given range request by manipulating the fixed MTRRs that cover low memory . Note that we try to be generous here ; we ' ll bloat the range out to the next higher / lower boundary to avoid the consumer having to know too much about the mechanisms here . XXX note that this will have to be updated when we start supporting " busy " ranges .
static int
i686_mrsetlow(struct mem_range_softc *sc, struct mem_range_desc *mrd, int *arg)
{
	struct mem_range_desc *first_md, *last_md, *curr_md;
	if (((first_md = i686_mtrrfixsearch(sc, mrd->mr_base)) == NULL) ||
	    ((last_md = i686_mtrrfixsearch(sc, mrd->mr_base + mrd->mr_len - 1)) == NULL))
		return (EINVAL);
	if (!(mrd->mr_flags & MDF_FORCE))
		for (curr_md = first_md; curr_md <= last_md; curr_md++) {
			if ((curr_md->mr_flags & MDF_ATTRMASK) == MDF_UNKNOWN)
				return (EACCES);
		}
	for (curr_md = first_md; curr_md <= last_md; curr_md++) {
		curr_md->mr_flags = mrcopyflags(curr_md->mr_flags &
		    ~MDF_FIRMWARE, mrd->mr_flags);
		bcopy(mrd->mr_owner, curr_md->mr_owner, sizeof(mrd->mr_owner));
	}
	return (0);
}
static int i686_mrsetlow ( struct mem_range_softc * sc , struct mem_range_desc * mrd , int * arg ) { struct mem_range_desc * first_md , * last_md , * curr_md ; if ( ( ( first_md = i686_mtrrfixsearch ( sc , mrd -> mr_base ) ) == NULL ) || ( ( last_md = i686_mtrrfixsearch ( sc , mrd -> mr_base + mrd -> mr_len - 1 ) ) == NULL ) ) return ( EINVAL ) ; if ( ! ( mrd -> mr_flags & MDF_FORCE ) ) for ( curr_md = first_md ; curr_md <= last_md ; curr_md ++ ) { if ( ( curr_md -> mr_flags & MDF_ATTRMASK ) == MDF_UNKNOWN ) return ( EACCES ) ; } for ( curr_md = first_md ; curr_md <= last_md ; curr_md ++ ) { curr_md -> mr_flags = mrcopyflags ( curr_md -> mr_flags & ~ MDF_FIRMWARE , mrd -> mr_flags ) ; bcopy ( mrd -> mr_owner , curr_md -> mr_owner , sizeof ( mrd -> mr_owner ) ) ; } return ( 0 ) ; }
Try to satisfy the given range request by manipulating the fixed
 MTRRs that cover low memory.
Try to satisfy the given range request by manipulating the fixed MTRRs that cover low memory .
/* Range check. */ /* Check that we aren't doing something risky. */ /* Set flags, clear set-by-firmware flag. */