⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 firewallhack.c

📁 一个用在mips体系结构中的操作系统
💻 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.  * *//***************************************************************** * firewallhack.c *  *****************************************************************/#include <stdio.h>#include <time.h>#include <assert.h>#include <stdlib.h>#include "mipsy.h"#include "pcache.h"#include "scache.h"#include "memstat.h"#include "memsys.h"#include "eventcallback.h"#include "cpu_interface.h"#include "cpu_state.h"#ifdef sgi#include "bstring.h"#endif#ifdef sun#include "strings.h"#endif#include "memory.h"#include "string.h"extern bool flashliteRunning;/* * Unlike the other memory systems we have, the flashlite memory system  * is currently a compile time option triggered by the USE_FLASHLITE * define. If this is not defined we provide stubs so simulator can * link without it.  */#if !defined(USE_FLASHLITE) || defined(SOLO)/* * FlashliteFirewallInit - Initalize the flashlite firewall  */voidFlashliteFirewallInit(void){     return;}voidFlashliteSetPageProt(int cell,unsigned int paddr, int rights){     return;}int FlashliteDownloadFirewall(void){}#else /* is defined(USE_FLASHLITE) */#define ERROR FLASHLITE_ERROR#define BIG_ENDIAN#include "simosinterface.h"#include "flash_interface.h"#include "mipsy_interface.h" #include "firewall.h"#include "firewallhack.h"/* * FlashliteFirewallInit - Initalize the flashlite firewall  */voidFlashliteFirewallInit(void){  /*   * If flashlite is already running we download the firewall to it;   * otherwise we will download it running init.    */  if (flashliteRunning) {    if (FlashliteDownloadFirewall() == FALSE) {      CPUWarning("Flashlite firewall download failed.\n");    }  } }int FlashliteDownloadFirewall(void){  LL faddr;  FLASHAddress faddr2, NOTALLOC;  int p, cpu;  if (!SIMFIREWALL_ON) return TRUE;#ifdef notdef  if (!FlashCellLayoutOK(CPUVec.numCPUs, SimfwData.numCells, SimfwData.cpu2cell)) {    CPUWarning("Cell layout not supported by flashlite.\n");    return FALSE;  }#endif /* notdef */  NOTALLOC.fa.node = -1;  for (p = 0; p < MEM_SIZE(0); p += FLASH_PAGE_SIZE) {    faddr = FlashAddrFromSimosAddr(0,p);    faddr2.ll = faddr;    if (faddr2.fa.node == NOTALLOC.fa.node) {       /* Must be allocated, first touch. */       continue;    }    for (cpu = 0; cpu < NUM_CPUS(0); cpu++) {       if (CPUVec.CheckFirewall(cpu, p)) {          FlashSetAccessControl(faddr, cpu, 1);       }    }  }  return TRUE;}voidFlashliteSetPageProt(int cell,unsigned int paddr, int rights){  if (!flashliteRunning)     return;  /* NOPed by jchapin since FWDIRECT now in use */  return;#ifdef notdef  if (rights == SIMFW_READWRITE) {    writeProtect = 0;  }  else {     writeProtect = 1;  }    faddr = FlashAddrFromSimosAddr(0,paddr);  for (cpu = 0; cpu < NUM_CPUS(0); cpu++) {     if (SimfwData.cpu2cell[cpu] == cell) {      FlashSetAccessControl(faddr,cpu, writeProtect);    }  }#endif /* notdef */}#endif /* is defined(USE_FLASHLITE) */

⌨️ 快捷键说明

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