N64® Functions Menu

al - Audio Library Functions
gDP - DP GBI Macros
gdSP - General GBI Macros
gSP - SP GBI Macros
gt - Turbo Microcode RDP
gu - Graphics Utilities
Math - Math Functions
nuSys - NuSystem
os - N64 Operating System
sp - Sprite Library Functions
uh - Host to Target IO
64DD - N64 Disk Drive

Nintendo® Confidential

   

osWritebackDCache osWritebackDCacheAll

Format
#include <ultra64.h>
void osWritebackDCache(void *vaddr, s32 nbytes);
void osWritebackDCacheAll(void);


What These Functions Do
They write back CPU data-cache lines to physical memory.

The MIPS R4300 CPU implements an 8-kilobyte direct-mapped data cache with a line size of 16 bytes. The cache implements a "write back" replacement policy which means that data stores are held in the cache until the entire cache line is written back, usually due to a cache miss that requires the same cache line. The cache is not coherent with respect to physical memory and thus cache lines must be explicitly written back when you want the DRAM updated with the more recent data in the data cache.

The osWritebackDCache call writes back all data cache lines that contain the region [vaddr, vaddr + nbytes). The given address vaddr must be a CPU virtual address, either direct mapped or mapped by way of the CPU TLB. If vaddr is not aligned to the a cache line boundary, and nbytes is not a multiple of the cache line size, a slightly larger region may be written back to memory.

The osWritebackDCacheAll routine writes back all cached locations to physical memory.

This routine is most frequently used in the situation where a direct memory access (DMA) device needs to read physical memory locations, but current contents associated with these memory locations are currently stored in the cache. In this case, the memory is out of date with respect to the cache, and the cache lines associated with these locations must be written back prior to performing the DMA operation.

See Also
osMapTLB
osInvalDCache
osInvalICache



Nintendo® Confidential

Warning: all information in this document is confidential and covered by a non-disclosure agreement. You are responsible for keeping this information confidential and protected. Nintendo will vigorously enforce this responsibility.


Copyright © 1998
Nintendo of America Inc. All rights reserved
Nintendo and N64 are registered trademarks of Nintendo
Last updated January 1998