All pastes #988330 Raw Edit

Untitled

public text v1 · immutable
#988330 ·published 2008-04-17 14:12 UTC
rendered paste body
/**
 * Search memory for a 32-bit pattern match on a 32-bit boundary
 *
 * @v start             Start address of region to search
 * @v len		Length of region, in bytes
 * @v pattern           Pattern to search for
 * @v mask              Mask of which bits in the pattern we care about
 * @ret found           First address at which pattern is found
 *
 *
 * The mask is used to indicate that we care about only part of the
 * pattern matching.  For example, suppose we wanted to search the
 * region for words of the form
 *
 *   0xabcdXXXX
 *
 * where X indicates that we don't care about that digit (i.e. that we
 * would want to match on 0xabcd0000, or 0xabcd1234, or 0xabcdffff,
 * etc.).  We would then call memsearch() as
 *
 *   memsearch ( start, len, 0xabcd0000, 0xffff0000 );
 */
uint32_t * memsearch ( uint32_t *start, size_t len,
		       uint32_t pattern, uint32_t mask ) {

}