writebackdcacheall.s 422 Bytes
#include <asm.h>
#include <regdef.h>
#include <R4300.h>

/*
 * void osWritebackDCacheAll(void);
 */
LEAF(osWritebackDCacheAll)
	.set	mips3
	li	t0,K0BASE
	li	t2,DCACHE_SIZE
	addu	t1,t0,t2
	subu	t1,DCACHE_LINESIZE
1:
	.set	noreorder
	cache	CACH_PD|C_IWBINV,0(t0)	# Use index writeback invalidate
	bltu	t0,t1,1b		#  on entire primary cache
	addu	t0,DCACHE_LINESIZE
	.set	reorder

	j	ra
	.set	mips0
	END(osWritebackDCacheAll)