📄 cache.c
字号:
/* *---------------------------------------------------------------------- * T-Kernel * * Copyright (C) 2004 by Ken Sakamura. All rights reserved. * T-Kernel is distributed under the T-License. *---------------------------------------------------------------------- * * Version: 1.01.00 * Released by T-Engine Forum(http://www.t-engine.org) at 2004/6/28. * *---------------------------------------------------------------------- *//* * cache.c (VR4131) * Cache Flush Range */#include <basic.h>#include <tk/tkernel.h>#include "cache_asm.h"/* * Cache line size (byte) */EXPORT W ICacheLineSize; /* Instruction cache */EXPORT W DCacheLineSize; /* Data cache *//* * Cache flush * Flush cache between 'laddr' and 'size' bytes areas. */EXPORT void FlushCache( VP laddr, W size ){ VP la = (VP)((UW)laddr & ~(CACHE_BLOCK_SIZE - 1)); VP end = (B*)laddr + size; /* Get cache line size */ UW cfg; Asm("mfc0 %0, $16": "=r"(cfg)); /* Read config register */ ICacheLineSize = ( (cfg & 0x20) != 0 )? 32: 16; DCacheLineSize = ( (cfg & 0x10) != 0 )? 32: 16; while ( la < end ) { FlushCacheOneBlock(la); la += CACHE_BLOCK_SIZE; if ( la >= end ) break; } return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -