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

📄 params.c

📁 一个用在mips体系结构中的操作系统
💻 C
📖 第 1 页 / 共 4 页
字号:
	 machines.machine[machNo].NumDiskCtrls[n] = 1; /* default */       }     }   }   ParamRegisterPerMachine("PARAM(DISK.NumUnitsPerController)",                           (char *)&dummyMachine.NumUnitsPerController,                           MachineNumUnitsPerController, PARAM_INT);   for (machNo = 0; machNo < MAX_MACHINES; machNo++) {     /* default */     SET_INITIALIZED(param[paramCount-1], machNo);     machines.machine[machNo].NumUnitsPerController = DEV_DISK_MAX_UNIT;   }   ParamRegisterPerMachine("PARAM(DISK.Model)",                           (char *)&dummyMachine.DiskModel,                           MachineDiskModel, PARAM_STRING);   ParamRegisterPerMachine("PARAM(DISK.HP.Scaling)",                           (char *)&dummyMachine.HPDiskScaling,                           MachineHPDiskScaling, PARAM_INT);   ParamRegisterPerMachine("PARAM(DISK.Fixed.Latency)",                           (char *)&dummyMachine.FixedDiskDelay,                           MachineFixedDiskDelay, PARAM_INT);   /*    * CONSOLE parameters    */   ParamRegisterPerMachine("PARAM(CONSOLE.Count)",                           (char *)&dummyMachine.NumConsoles,                           MachineNumConsoles, PARAM_INT);   /*     * ETHERNET parameters    */   ParamRegisterPerMachine("PARAM(ETHERNET.Count)",                           (char *)&dummyMachine.NumEtherControllers,                           MachineNumEtherControllers, PARAM_INT);   /*     * CLOCK parameters    */   ParamRegisterPerMachine("PARAM(CLOCK.Count)",                           (char *)&dummyMachine.NumClocks,                           MachineNumClocks, PARAM_INT);   /*     * remaining paramters     */   ParamRegisterPerMachine("PARAM(HIVE.NumCells)",                           (char *)&dummyMachine.NumCells,                           MachineNumCells, PARAM_INT);#endif   /*--------------------------    * All-machine parameters    *--------------------------*/   /*    * Machine parameters     */   ParamRegister("PARAM(MACHINE.Count)", (char *)&machines.NumMachines, PARAM_INT);   /*    * CPU parameters     */   ParamRegister("PARAM(CPU.Clock)", (char *)&machines.CpuClock, PARAM_INT);   ParamRegister("PARAM(CPU.ISA)",   (char *)&machines.CpuISA,    PARAM_STRING);   ParamRegister("PARAM(CPU.Model)", (char *)&machines.CpuModel,  PARAM_STRING);   ParamRegister("PARAM(TLB.Org)", (char *)&machines.TlbOrg, PARAM_STRING);   ParamRegister("PARAM(CPU.IntrClockFrequency)", (char*)&machines.IntrClockFrequency,PARAM_INT);   /*    * CACHE parameters     */   ParamRegister("PARAM(CACHE.Model)", (char *)&machines.CacheModel, PARAM_STRING);   ParamRegister("PARAM(CACHE.2Level.ISize)",   (char *)&machines.ICacheSizeSpecified,                  PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.ILine)",   (char *)&machines.ICacheLineSize,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.IAssoc)",  (char *)&machines.ICacheAssoc,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.IInclusion)",  (char *)&machines.ICacheInclusion,                 PARAM_BOOLEAN);   ParamRegister("PARAM(CACHE.2Level.DSize)",   (char *)&machines.DCacheSizeSpecified,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.DLine)",   (char *)&machines.DCacheLineSize,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.DAssoc)",  (char *)&machines.DCacheAssoc,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.L2Size)",  (char *)&machines.SCacheSizeSpecified,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.L2Line)",  (char *)&machines.SCacheLineSize,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.L2Assoc)", (char *)&machines.SCacheAssoc,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.L2HitTime)",                  (char *)&machines.SCacheHitTimeSpecified, PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.WriteBufferSize)", (char *)&machines.WriteBufferSize,                 PARAM_INT);   ParamRegister("PARAM(CACHE.2Level.UpgradesOnUP)", (char *)&machines.UpgradesOnUP,                 PARAM_BOOLEAN);   ParamRegister("PARAM(CACHE.2Level.NAKRetryTime)",                  (char *)&machines.NAKRetryTime, PARAM_INT);   /*     * MEMSYS parameters     */   ParamRegister("PARAM(MEMSYS.Model)", (char *)&machines.MemSysModel,                 PARAM_STRING);   ParamRegister("PARAM(MEMSYS.Perfect.Latency)",                  (char *)&machines.PerfectMemLatencySpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.BusUma.BusBW)", (char *)&machines.BusBW,                  PARAM_INT);   ParamRegister("PARAM(MEMSYS.BusUma.MemCycleTime)",                  (char *)&machines.MemCycleTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.BusUma.DirtyPenalty)",                  (char *)&machines.DirtyPenaltySpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.BusUma.UpgradeTime)",                   (char *)&machines.UpgradeTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.BusTime)",                  (char *)&machines.NumaBusTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.PILocalDCTime)",                  (char *)&machines.NumaPILocalDCTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.PIRemoteDCTime)",                  (char *)&machines.NumaPIRemoteDCTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.NILocalDCTime)",                  (char *)&machines.NumaNILocalDCTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.NIRemoteDCTime)",                  (char *)&machines.NumaNIRemoteDCTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.MemTime)",                  (char *)&machines.NumaMemTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.NetTime)",                  (char *)&machines.NumaNetTimeSpecified, PARAM_INT);   ParamRegister("PARAM(MEMSYS.Numa.StripeSize)",                  (char *)&machines.NumaStripeSize, PARAM_INT);#ifdef USE_FLASHLITE#ifndef SOLO   ParamRegister("PARAM(MEMSYS.FLASH.FlashAddrMap)",                  (char *)NULL, PARAM_STRING);   ParamRegister("PARAM(MEMSYS.FLASH.RoundRobinStripe)",                  (char *)NULL, PARAM_INT);#endif#endif   ParamRegister("PARAM(VISUAL.Port)", (char *)&VisualPort, PARAM_INT);   ParamRegister("PARAM(VISUAL.SamplePeriod)",                  (char *)&VisualSamplePeriod, PARAM_INT);   /* With the exception of PARAM(FILES.SaveOldCPULogs), none of the     * FILES, DISK, CONSOLE, ETHERNET, or other miscellaneous parameters    * are used in solo */   /*     * FILES parameters    */   ParamRegister("PARAM(FILES.SaveOldCPULogs)", (char *)&SimErrorKeepLogs,                  PARAM_BOOLEAN);#ifndef SOLO   ParamRegister("PARAM(FILES.CptDir)", (char *)&cptSaveDir, PARAM_STRING);   ParamRegister("PARAM(FILES.CptTag)", (char *)&CheckpointID, PARAM_STRING);   ParamRegister("PARAM(FILES.CptCompress)", (char *)&CheckpointCompress,                  PARAM_BOOLEAN);   ParamRegister("PARAM(FILES.FPROMFile)", (char *)&FPromFile, PARAM_STRING);      ParamRegister("PARAM(FILES.MemFileDir)", (char*)&MemFileDir, PARAM_STRING);   ParamRegister("PARAM(FILES.DevFileDir)", (char*)&DevFileDir, PARAM_STRING);   /*    * CONSOLE parameters    */   ParamRegister("PARAM(CONSOLE.Port)",  (char *)&ConsolePort, PARAM_INT);   ParamRegister("PARAM(CONSOLE.SlaveTimeOut)", (char *)&SlaveConsoleTimeOut, PARAM_INT);   /*     * ETHERNET parameters    */   ParamRegister("PARAM(ETHERNET.Model)", (char *)&machines.EthernetModel, PARAM_STRING);   ParamRegister("PARAM(ETHERNET.EtherSim.Active)", (char *)&RestoreEthernet,                  PARAM_BOOLEAN);   ParamRegister("PARAM(ETHERNET.EtherSim.Address)", (char*)&EtherAddress,                  PARAM_STRING);   ParamRegister("PARAM(ETHERNET.EtherSim.Hostname)", (char*)&EthersimHostname,                  PARAM_STRING);   ParamRegister("PARAM(ETHERNET.EtherSim.Port)", (char *)&EtherSendPort, PARAM_INT);   ParamRegister("PARAM(DEBUG.Port)", (char *)&DebugPort, PARAM_INT);   ParamRegister("PARAM(DEBUG.LoopOnError)",(char*)&loopOnError,PARAM_BOOLEAN);   ParamRegister("PARAM(STATS.FalseSharing)", (char *)&FalseSharing, PARAM_BOOLEAN);   /*     * remaining paramters (MIPS-only)    */#if defined(SIM_MIPS32) || defined(SIM_MIPS64)   ParamRegister("PARAM(MAGIC.SIPSLatency)", (char *)&machines.SIPSLatencySpecified,                 PARAM_INT);   ParamRegister("PARAM(MAGIC.IPILatency)", (char *)&machines.IPILatencySpecified,                 PARAM_INT);   ParamRegister("PARAM(MAGIC.InitialTime)", (char *)&machines.InitialTimeSpecified,                 PARAM_INT);   ParamRegister("PARAM(FPROM.PROMSize)", (char *)&machines.FPROMSize, PARAM_INT);   ParamRegister("PARAM(FPROM.RAMSize)", (char *)&machines.FRAMSize, PARAM_INT);   ParamRegister("PARAM(FPROM.UseFL)", (char *)&FPromUseFL, PARAM_BOOLEAN);   ParamRegister("PARAM(MIGREP.Trigger)", (char *)&migRepTriggerThreshold, PARAM_INT);   ParamRegister("PARAM(MIGREP.Reset)", (char *)&migRepResetInterval, PARAM_INT);   ParamRegister("PARAM(MIGREP.Enable)", (char *)&migRepEnableCounting, PARAM_BOOLEAN);   ParamRegister("PARAM(MIGREP.MaxKern)", (char *)&migRepMaxKern, PARAM_INT);   ParamRegister("PARAM(MIGREP.SampleCount)", (char *)&migRepSampleCount, PARAM_INT);   ParamRegister("PARAM(MIGREP.IntrCount)", (char *)&migRepPendIntr, PARAM_INT);   ParamRegister("PARAM(MIGREP.IntrHot)", (char *)&migRepIntrHot, PARAM_BOOLEAN);   ParamRegister("PARAM(MIGREP.ZeroOnWrite)", (char *)&migRepZeroOnWrite, PARAM_BOOLEAN);   ParamRegister("PARAM(MIGREP.4BitCounters)", (char *)&migRep4BitCounters, PARAM_BOOLEAN);#endif #ifdef VCS_FAKE   ParamRegister("PARAM(MISC.VCSFake)", (char *)&VcsFakeType, PARAM_INT);   ParamRegister("PARAM(MISC.VCSFake.FileName)", (char *)&VcsFakeFilename, PARAM_STRING);#endif#endif /* !SOLO */   Tcl_TraceVar(TCLInterp, "PARAM",                TCL_TRACE_READS | TCL_TRACE_WRITES | TCL_GLOBAL_ONLY,                 ParamAccess, NULL); }/***************************************************************** * Param Register (all-machine params) *****************************************************************/void ParamRegister(char *varName, char *addr, int type){   int newEntry;   Tcl_HashEntry *entryPtr;   char *stringMem;   entryPtr = Tcl_CreateHashEntry(&entries, varName, &newEntry);      ASSERT(newEntry);   ASSERT(entryPtr);   if ((type == PARAM_STRING) && (addr) && (*addr)) {      char **temp = (char**)addr;      *temp = SaveString(*temp);   }   /* Hack: since LL isn't supported in this version of Tcl, we don't      allow direct linking -- we can only register and lookup LL values */   if (type == PARAM_LL) {     ASSERT(addr == NULL);   }   param[paramCount].initialized = ParamGrabbed(varName);   /* Don't make CPU.Model read-only, since it is ok to specify and have      the command line overide */   if (!strcmp(varName, "PARAM(CPU.Model)")) {      param[paramCount].readOnly = FALSE;   } else {      param[paramCount].readOnly = ParamGrabbed(varName);   }   param[paramCount].type = type;   param[paramCount].bitField = FALSE;   param[paramCount].accessFunc = (AccessFunc)NULL;   param[paramCount].modifiedPerMachine = 0;   stringMem = param[paramCount].name = SaveString(varName);   /* Create a hash from variable name to its structure */   Tcl_SetHashValue(entryPtr, &param[paramCount++]);   /*    * Warning: Tcl_LinkVar modifies and then restores the variable    * name, we use the malloced copy of the name in case varName    * was a read-only const passed to ParamRegister().    */   if (addr != NULL) {      if (Tcl_LinkVar(TCLInterp, stringMem, addr, type) != TCL_OK) {         CPUWarning("ParamRegister: Tcl_LinkVar call failed\n");         ASSERT(0);      }   }}/***************************************************************** * Param Register (per-machine params) *****************************************************************/static void ParamRegisterPerMachine(char *varName, char *addr,                        AccessFunc accessFunc, int type){   int newEntry;   Tcl_HashEntry *entryPtr;   char *stringMem;   entryPtr = Tcl_CreateHashEntry(&entries, varName, &newEntry);      ASSERT(newEntry);   ASSERT(entryPtr);   ASSERT(accessFunc);   if ((type == PARAM_STRING) && (addr) && (*addr)) {      char **temp = (char**)addr;      *temp = SaveString(*temp);   }   /* Hack: since LL isn't supported in this version of Tcl, we don't      allow direct linking -- we can only register and lookup LL values */   if (type == PARAM_LL) {     ASSERT(addr == NULL);   }   if (ParamGrabbed(varName)) {      param[paramCount].initialized = BITFIELD_TRUE;      param[paramCount].readOnly = BITFIELD_TRUE;   } else {      param[paramCount].initialized = FALSE;      param[paramCount].readOnly = FALSE;   }   param[paramCount].type = type;   param[paramCount].bitField = TRUE;   param[paramCount].accessFunc = accessFunc;   param[paramCount].modifiedPerMachine = 0;   stringMem = param[paramCount].name = SaveString(varName);   /* Create a hash from variable name to its structure */   Tcl_SetHashValue(entryPtr, &param[paramCount++]);   /*    * Warning: Tcl_LinkVar modifies and then restores the variable    * name, we use the malloced copy of the name in case varName    * was a read-only const passed to ParamRegister().    */   if (addr != NULL) {      if (Tcl_LinkVar(TCLInterp, stringMem, addr, type) != TCL_OK) {         CPUWarning("ParamRegister: Tcl_LinkVar call failed\n");         ASSERT(0);      }   }}

⌨️ 快捷键说明

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