📄 ms_simos.c
字号:
/* * Copyright (C) 1996-1998 by the Board of Trustees * of Leland Stanford Junior University. * * This file is part of the SimOS distribution. * See LICENSE file for terms of the license. * */#include "ms.h"#include "memref.h"#include "cpu_state.h"#include "simmisc.h"#include "remap.h"#include "machine_params.h"/******************************************************************* * Interface routines to R4000 simos * Basem A. Nayfeh ******************************************************************/boolInterruptIsPending(struct s_cpu_state *st){ CPUState *P = (CPUState *) (st->mipsyPtr); P->CP0[C0_CAUSE] = ((P->CP0[C0_CAUSE] & ~CAUSE_EXTINTBITS) | ((P->intrBitsPtr[0] << CAUSE_IPSHIFT) & CAUSE_EXTINTBITS)); if (((P->CP0[C0_CAUSE] & P->CP0[C0_SR]) & SR_IMASK) && (P->CP0[C0_SR] & SR_IEC) && !(P->CP0[C0_SR] & (SR_EXL|SR_ERL))) { return TRUE; } return FALSE;}ResultReadICache(int cpuNum, VA vAddr, PA pAddr, Inst *pInst){ return MemRefReadInst(cpuNum,vAddr,pAddr,pInst);}#define HOST_DATA_ADDR(vAddr, paddr, cpu) \ (PHYS_TO_MEMADDR(M_FROM_CPU(cpu),paddr)+(IS_REMAPPED_PADDR(paddr,cpu) ? remapVec->NodeAddr[cpu] : 0))ResultDCacheFetchShared(int cpuNum, VA vAddr, PA pAddr, int flags, char **dataPtr){ (*dataPtr) = (char *)HOST_DATA_ADDR(vAddr, pAddr, cpuNum); return SUCCESS;}ResultDCacheFetchExclusive(int cpuNum, VA vAddr, PA pAddr, int size, char **dataPtr){ /* This is bogus as is because we don't handle an SC failure */ /* See below for the old interface */ (*dataPtr) = (char *)HOST_DATA_ADDR(vAddr, pAddr, cpuNum); return SUCCESS;}#if 0ResultDCacheFetchShared(int cpuNum, VA vAddr, PA pAddr, int flags, char **dataPtr) { int mhtind; Result ret; MemRefHandle handle; int accessType; int MXSAction; if (flags & MXS_SECOND_TIME) { goto DCFSHit; } accessType = MEMREF_ACCESS_READ|MEMREF_SOURCE_DFETCH; if (flags & LL_FLAVOR) { accessType |= MEMREF_FLAVOR_LL; } handle = MemRef(cpuNum, accessType, vAddr, pAddr); if (handle != MEMREF_NOSTALL) { /* BAN: Just point the dataPtr to the handle which serves as a unique */ /* id in place of the MHT index. This will be used when calling */ /* back into MXS using DoMxsAction along with the contents of */ /* MXSAction */ (*dataPtr) = (char *) handle; MXSAction = GetMxsAction(PE[cpuNum].st);#ifdef VERBOSE_TRACE CPUPrint("M P: %2d\tA: %8x\tH: %8x\n",cpuNum,pAddr,handle);#endif return STALL; }DCFSHit: (*dataPtr) = (char *)DATA_STORAGE(vAddr, pAddr, cpuNum); return SUCCESS;}ResultDCacheFetchExclusive(int cpuNum, VA vAddr, PA pAddr, int size, char **dataPtr) { int mhtind; Result ret; MemRefHandle handle; int accessType; int MXSAction; if (size & MXS_SECOND_TIME) { goto DCFEHit; } accessType = MEMREF_ACCESS_WRITE; if (size & SC_FLAVOR) { accessType |= MEMREF_FLAVOR_SC; } handle = MemRef(cpuNum, accessType, vAddr, pAddr); if (handle != MEMREF_NOSTALL) { /* BAN: First special case the SC */ if (size & SC_FLAVOR) { (*dataPtr) = NULL; return SCFAILURE; } /* BAN: Just point the dataPtr to the handle which serves as a unique */ /* id in place of the MHT index. This will be used when calling */ /* back into MXS using DoMxsAction along with the contents of */ /* MXSAction */ (*dataPtr) = (char *) handle; MXSAction = GetMxsAction(PE[cpuNum].st);#ifdef VERBOSE_TRACE CPUPrint("M P: %2d\tA: %8x\tH: %8x\n",cpuNum,pAddr,handle);#endif return STALL; }DCFEHit: (*dataPtr) = (char *)DATA_STORAGE(vAddr, pAddr, cpuNum); return SUCCESS;}#endif /*0*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -