cache.cc

来自「一个mips虚拟机非常好代码,使用C++来编写的,希望大家多学学,」· CC 代码 · 共 25 行

CC
25
字号
#include <assert.hh>#include "koala.hh"#include "instr.hh"intKoala::decode_cache(Instr instr){    // CP0 is usable in kernel more or when the CU bit in SR is set.    if (!(mode & kmode) && !bit(cp0[SR], SR_CU0))	process_coprocessor_unusable(0);    VA va = sign_extend<VA>(offset(instr), 16) + gpr[base(instr)];    PA pa = translate_vaddr(va, cache_op);    if (pa != bad_pa) {	if (bit(instr, 16)) {	    // Control data cache.	    control_dcache(va, pa, bits(instr, 20, 18), bit(instr, 17));	}	else {	    // Control instruction cache.	    control_icache(va, pa, bits(instr, 20, 18), bit(instr, 17));	}    }    return nothing_special;}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?