Example #1
0
// Calculate the sum of an array of 4byte numbers
static int rifs_checksum(void *ptr, long len)
{
	int			*data = (int *)ptr;
	long		mdriver_count = 0;
	int 		sum;
	unsigned	max;

	// The checksum may take a while for large images, so we want to poll the mini-driver
	max = (lsp.mdriver.size > 0) ? mdriver_cksum_max : len;
	
	sum = 0;
	while(len > 0)
	{
		sum += *data++;
		len -= 4;
		mdriver_count += 4;
		if(mdriver_count >= max) 
		{
			// Poll the mini-driver when we reach the limit
			mdriver_check();
			mdriver_count = 0;	
		}
	}
	return(sum);
}
Example #2
0
void
copy_memory(paddr32_t dst, paddr32_t src, size_t len) {
	uint8_t		*d;
	uint8_t		*s;
	unsigned	max;
	unsigned	amount;

	max = (lsp.mdriver.size > 0) ? mdriver_max : len;
	for( ;; ) {
		mdriver_check();
		amount = (len > max) ? max : len;

		// We make the assumption that the destination is going to
		// be in the one-to-one mapping area.
		d = MAKE_1TO1_PTR(dst);
		s = startup_memory_map(amount, src, PROT_READ);
		memmove(d, s, amount);
		startup_memory_unmap(s);
		len -= amount;
		if(len == 0) break;
		src += amount;
		dst += amount;
	}	
}
Example #3
0
void
(mdriver_init)(void) {
	mdriver_ptr = SYSPAGE_ENTRY(mdriver);
	mdriver_num = _syspage_ptr->mdriver.entry_size / sizeof(*mdriver_ptr);
	mdriver_check();
}