📄 simmisc.h
字号:
/* * 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. * *//***************************************************************** * simmisc.h * * Plethora of misc. definitions which don't fit anywhere else. * Dan Teodosiu, 07/96 * ****************************************************************/#if !defined(_SIM_MISC_H) && (defined(SIM_MIPS32) || defined(SIM_MIPS64))#define _SIM_MISC_H#include "syslimits.h"#include "simtypes.h"#include "file_formats.h"#define SIMCP0_KUSEG_ADDR 0x0#define SIMCP0_KUSEG_SIZE K0BASE#define SIMCP0_KSEG0_ADDR K0BASE#define SIMCP0_KSEG0_SIZE 0x20000000#define SIMCP0_KSEG1_ADDR K1BASE#define SIMCP0_KSEG1_SIZE 0x20000000#define SIMCP0_KSEG2_ADDR K2BASE#define SIMCP0_KSEG2_SIZE 0x40000000/* Added for R4k port */#define SIMCP0_KSEG3_ADDR 0x68000000#define SIMCP0_KSEG3_SIZE 0x10000000#define SIM_PAGE_SIZE 4096/* * BASESIMMEMADDR definitions * This is the starting address of the simulated memory for the first machine. * Each other machine's memory starts after the end of the previous one. * Use the SIM_MEM_ADDR(MachNo) to get the start address for a particular machine. */#if defined(sgi) || defined(sun) || defined(i386)/* SGI, SUN or i386 */#ifdef LARGE_SIMULATION#define BASESIMMEMADDR ((MA)0x50000000)#else#define BASESIMMEMADDR ((MA)0x40000000)#endif /* LARGE_SIMULATION */#elif defined(linux)/* Linux */#define BASESIMMEMADDR ((MA)0x50000000)#elif defined(__alpha)/* Alpha */#define BASESIMMEMADDR ((MA)0x200000000)#endif #ifndef LANGUAGE_ASSEMBLY/* * Macro for converting a KSEG0 address into an access to the * simulated memory. */extern int IsValidPA(int machNo, PA paddr);extern MA PhysToMemAddr(int machNo, PA paddr);extern PA MemToPhysAddr(int machNo, MA maddr);#ifdef IRIX6_4#define PHYS_TO_MEMADDR(_m, _x) PhysToMemAddr((_m), (_x))#define MEMADDR_TO_PHYS(_m, _x) MemToPhysAddr((_m), (_x))#define IS_VALID_PA(_m, _x) IsValidPA((_m), (_x))#define IS_VALID_MA(_m, _x) ((((MA)(_x)) >= SIM_MEM_ADDR(_m)) && \ (((MA)(_x)) < (SIM_MEM_ADDR(_m) + MEM_SIZE(_m))))#else#define PHYS_TO_MEMADDR(_m, _x) ((MA)(SIM_MEM_ADDR(_m) + (PA)(_x)))#define MEMADDR_TO_PHYS(_m, _x) ((PA)((MA)(_x) - SIM_MEM_ADDR(_m)))#define IS_VALID_PA(_m, _x) (((MA)(_x)) < ((MA)MEM_SIZE(_m)))#define IS_VALID_MA(_m, _x) ((((MA)(_x)) >= SIM_MEM_ADDR(_m)) && \ (((MA)(_x)) < (SIM_MEM_ADDR(_m) + MEM_SIZE(_m))))#endif#define K0_TO_MEMADDR(_m, _x) (PHYS_TO_MEMADDR((_m),K0_TO_PHYS((VA)(_x))))#define MEMADDR_TO_K0(_m, _x) ((VA)PHYS_TO_K0((PA)MEMADDR_TO_PHYS((_m),(_x))))/* * Macro to test whether Flashlite is being used. */#define USE_MAGIC() (memsysVec.type == FLASHLITE)/* * Macros to test for various options. */#define DEBUG_INTR() (sim_misc.debug_intr)/* * Miscellaneous definitions */#define MAXBOOTARGS 32 /* max. args to kernel */#define KNAME_MAX 64 /* max. kernel name length */#define MAXBOOTARGBYTES 256 /* max. length of boot command line *//* This is probably not needed any longer and should be removed */#define SLAVELOOP_CONTINUE 0x4015/* offset (starting from the beginning of a cell's memory range) of * page which is used for passing bootline arguments to the kernel. * NOTE: currently, kernels are compiled so that they leave 5 free * pages at the beginning of the cell's memory range. The 5 pages are * used as follows: * - page 0: remap area * - page 1: OSPC area (fake for 32-bit SimOS) * - page 2: bootline arguments * - page 3,4: unused */#ifdef IRIX6_4#define ARGZONE_OFFS 0x00034000 #else#define ARGZONE_OFFS 0x00002000 /* third page */#endif/* Name of file containing FPROM image */extern char* FPromFile;typedef struct Header {union header { FILHDR coffHeader; Elf32_Ehdr elfHeader; Elf64_Ehdr elf64Header;} hb;} HeaderBuf;/* * This data structure holds several not necessarily related pieces * of information. The reasons for this being a single data structure * are historical. */typedef struct SimMisc { CPUType enterThisCPU; /* notify the simulator to switch to this CPU type */ CPUType myCPUType; void* launchAddr[SIM_MAXCPUS]; /* launch address for slaves */ int launchArg[SIM_MAXCPUS][4]; /* launch args (A0-A3) for slaves */ char* fprom[SIM_MAXCPUS]; /* fprom */ char* fram[SIM_MAXCPUS]; /* fram */ char* incoherentPages; /* array indicating incoherent pages -- lost in low-level recovery */ int debug_intr; /* debug interrupts? */} SimMisc;extern SimMisc sim_misc;extern void SimMiscInit(int debug_intr);extern void SimPromEnter(void);extern void SimulatorEnter(CPUType simulator, int restoreCkpt, int swtch);extern void SimulatorSwitch(CPUType oldSimulator, CPUType newSimulator);typedef void (*aout_entryfunc)(int, char**, char**);typedef void (*bdload_sectionfilter)(char* startaddr, unsigned nbytes);extern int LaunchSlave(int cpu, VA pc, Reg a0, Reg a1, Reg a2, Reg a3);extern int ResetCPUs(int firstcpu, int lastcpu);extern void SimHalt(void);#endif /* !LANGUAGE_ASSEMBLY */#endif /* _SIM_MISC_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -