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

📄 ms.h

📁 一个用在mips体系结构中的操作系统
💻 H
📖 第 1 页 / 共 3 页
字号:
extern void opBC1F(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBC1T(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBEQL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBNEL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBLEZL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBGTZL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBLTZL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBGEZL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBLTZALL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBGEZALL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBC1FL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBC1TL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opADDI(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opADDIU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSLTI(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSLTIU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opANDI(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opORI(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opXORI(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opHCPY(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLB(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLH(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLWL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLW(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLBU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLHU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLWR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLWC1(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLDC1(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSB(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSH(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSWL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSW(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSWR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSWC1(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSDC1(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSLL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSRL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSRA(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSLLV(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSRLV(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSRAV(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opJR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opJALR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSYSCALL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBREAK(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opMULT(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opMULTU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opDIV(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opDIVU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opADD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opADDU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSUB(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSUBU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opAND(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opOR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opXOR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opNOR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSLT(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSLTU(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCPY(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCVTSW(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCVTDW(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFADDS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFSUBS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFMULS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFDIVS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFSQRTS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFABSS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFNEGS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFROUNDS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFTRUNCS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFCEILS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFFLOORS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCVTDS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCVTWS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCFS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCUNS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCEQS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCUEQS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCOLTS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCULTS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCOLES(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCULES(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCSFS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGLES(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCSEQS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGLS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCLTS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGES(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCLES(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGTS(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFADDD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFSUBD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFMULD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFDIVD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFSQRTD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFABSD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFMOVD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFNEGD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFROUNDD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFTRUNCD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFCEILD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opFFLOORD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCVTSD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCVTWD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCEQD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCUEQD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCOLTD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCULTD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCOLED(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCULED(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCSEQD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGLD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCLTD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGED(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCLED(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCNGTD(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opJRET(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCTL_FPC(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCTL_CFC(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCTL_DLY(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opCP0(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opBDOOR(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLL(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSC(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opPREF(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opLDHACK(struct s_cpu_state *st, INST *ip, THREAD *th);extern void opSDHACK(struct s_cpu_state *st, INST *ip, THREAD *th);extern	void	opsysc (struct s_cpu_state *st, THREAD *th);extern	void	opmult (struct s_cpu_state *st, INST *ip);extern	void	opmltu (struct s_cpu_state *st, INST *ip);extern	void	opdiv (struct s_cpu_state *st, INST *ip);extern	void	opdivu (struct s_cpu_state *st, INST *ip);extern	void	unstall_fetch (void *st, void *ix);extern	void	finish_call (void *st, void *ix);extern	void	finish_branch (void *st, void *ix);extern	void	update_excuse (void *st, void *ix);extern	void	reg_writeback (void *st, void *ix);extern	void	reg0_writeback (void *st, void *ix);extern	void	free_spec_inst (struct s_cpu_state *st, int inum);extern	void	ms_graduate (struct s_cpu_state *st);extern	void	ms_grad_dequeue (struct s_cpu_state *st, int inum);extern	void	ms_grad_enqueue (struct s_cpu_state *st, int inum);extern	void	ms_except (struct s_cpu_state *st);extern	void	ms_pri_dequeue (struct s_cpu_state *st, int pri);extern	void	ms_pri_enqueue (struct s_cpu_state *st, int pri);extern	void	ms_ldst_dequeue (struct s_cpu_state *st, int inum);extern	void	ms_ldst_enqueue (struct s_cpu_state *st, int inum);extern	void	ms_st_init (struct s_cpu_state *st);extern	void	ms_iwin_init (struct s_cpu_state *st);extern	void	ms_branch (struct s_cpu_state *st, THREAD *th, int likely);extern	void	prune_branch (struct s_cpu_state *st, int branch_node);extern	void	speculate_reparent (struct s_cpu_state *st,					int branch_node, int id_node);extern	void	speculate_flush (struct s_cpu_state *st, int branch_node);extern	void	CheckSquash (struct s_cpu_state *st, INST *ip);extern void	ms_fetch(struct s_cpu_state *st);extern void	free_inst(struct s_cpu_state *st, int inum);					/* The load/store buffer	*/extern void ms_lsq (struct s_cpu_state *st, int addr,				int reg, int reg2, int lstype, int inum);extern	void	ms_cycle_once (struct s_cpu_state *st);extern	void	DoMxsIntervention(struct s_cpu_state *st, int paddr, int size, 				int writebackonly);extern	int	CheckIntervention (struct s_cpu_state *st,					void *mtag, int paddr, int size);extern	void	DoMxsAction(struct s_cpu_state *st, void *mtag, int ms_action);extern	int	GetMxsAction(struct s_cpu_state *st);extern  void MxsSampleStats(struct s_cpu_state *st, int mode);extern  int MxsApproveImiss(struct s_cpu_state *st,int paddr);#ifndef MIPSY_MXSextern	void	ms_init_hash (uint *bbhash, uint *bbaddr,			struct s_clnk ***bbcoll, uint *adrhash,			struct s_clnk ***adrcoll, int hashsize, int hashprime,			struct s_coll *bbclst, int ncoll,			struct s_coll *syn_list, int nsyns);#endifextern	void	ms_cycle_loop (struct s_cpu_state *st);extern	void	init_cache (struct s_cpu_state *st);extern	void	compile_inst (uint inst, uint addr, INST *ip,				int *squashed, int *branch_shadow);extern	void set_rm (int mode);extern	void print_inst (FILE *stream, INST *ip);extern	void print_reg (FILE *stream, int r);extern	void print_reg_contents (FILE *stream, int r, void *ptr);extern	void print_stats (struct s_cpu_state *st);extern  void dump_stats (struct s_cpu_state *st);extern  void MxsPrintStatus (struct s_cpu_state *st);#ifdef BREAKPOINTextern	void	ms_break (struct s_cpu_state *st, INST *ip, char *typ);#else#define	ms_break(st,ip,typ)	abort()#endif#ifdef PROCSTATS					/* Per procedure statistics	*/extern	void	push_stats (struct s_cpu_state *st, int pc);extern	void	pop_stats (struct s_cpu_state *st);#endifextern	void	ms_bus_init (struct s_cpu_state *st);extern	void	ms_debus (void *st, void *unused);extern	void	flush_cache (struct s_cpu_state *st,			int addr, int cnt, int empty);extern	int	ms_bus_busy (void);extern	void	ldst_init (struct s_cpu_state *st);extern	int	ldst_buffer_reserve (struct s_cpu_state *st);extern	void	ldst_buffer_release (struct s_cpu_state *st);extern	int	ldst_buffer_retire (struct s_cpu_state *st, int inum);extern	void	ldst_buffer_squash (struct s_cpu_state *st, int inum);extern  void    record_ldst_stall (struct s_cpu_state *st, int inum, int stall);extern  void    record_icache_stall (struct s_cpu_state *st, int pc, int stall);extern  void    record_pipeline_stall (struct s_cpu_state *st, int pc, int stall);/* STATRECORD ROUTINES */#define MS_STALL_EVENT(_cpu, _vAddr, _pc, _stall, _type) \  ms_attribute_stall(_cpu, _vAddr, _pc, _stall, _type);extern void     ms_events_init(void);extern void     ms_attribute_stall(int cpuNum, int vAddr, int pc,                                    int stall, int stallType);#ifdef INLINE	/* See ms.c for comments on these in-lined routines	*/#define UnthreadInst(st, inum)	{					\	int	br_node = (st)->iwin_br_node [(inum)];			\	if (br_node >= 0) {						\		int	tmpi; BrTREE	*br;				\		br = &(st)->branch_tree [br_node];			\		if ((tmpi = (st)->iwin_bthread [(inum)]) >= 0)		\			(st)->iwin_thread [tmpi] = (st)->iwin_thread [(inum)]; \		else br->iwin_head_th = (st)->iwin_thread [(inum)];	\		if ((tmpi = (st)->iwin_thread [(inum)]) >= 0)		\			(st)->iwin_bthread [tmpi] = (st)->iwin_bthread [(inum)]; \		else br->iwin_tail_th = (st)->iwin_bthread [(inum)];	\		}							\	(st)->iwin_freelist [(inum)] = (st)->iwin_nextfree;		\	(st)->iwin_nextfree = (inum);					\	(st)->iwin_flags [(inum)] = 0;					\	(st)->iwin_index2 [(inum)] = 0;					\	(st)->iwin_index3 [(inum)] = 0;					\	}#define AcquireRegMap(rs, th, lreg) {					\	(rs)->reg_nmap++;						\	(rs)->reg_status |= REG_MAPPED;					\	if (((rs)->reg_status & REG_CLAIMED) &&				\	    ((th)->half_def[(lreg) >> 1] & REGNAME_CLAIM))		\		(rs)->reg_nclaims++;					\	}#ifdef PRECISE#define CheckRegFree(st, rs, reg_ix) {					\	if (((rs)->reg_status & REG_CLAIMED) && ((rs)->reg_nclaims <= 0) && \	   ((rs)->reg_ref <= 0) && (((rs)->reg_status & REG_IN_WIN) == 0) ) \		(rs)->reg_status &= ~REG_CLAIMED;			\	if ((rs)->reg_status & REG_FREED) {				\		if ((rs)->reg_status & REG_MAPPED)			\			(rs)->reg_status = REG_MAPPED;			\		else {							\			(rs)->reg_status = 0;				\			(st)->reg_freelist [(reg_ix)] = (st)->reg_nextfree; \			(st)->reg_nextfree = (reg_ix);			\			}						\		}							\	if (preg_is_special ((reg_ix)) && (((rs)->reg_status &		\			  (REG_BUSY | REG_IN_WIN | REG_MAPPED | REG_DMAP)) \						== (REG_BUSY + REG_MAPPED)) ) \			(rs)->reg_status = REG_MAPPED;			\	}#else#define CheckRegFree(st, rs, reg_ix) {					\	if (((rs)->reg_status & REG_CLAIMED) && ((rs)->reg_nclaims <= 0) && \	   ((rs)->reg_ref <= 0) && (((rs)->reg_status & REG_IN_WIN) == 0) ) \		(rs)->reg_status &= ~REG_CLAIMED;			\	if (((rs)->reg_nclaims <= 0) && ((rs)->reg_ref <= 0) &&		\	    (((rs)->reg_status & REG_IN_WIN) == 0) ) {			\		if (((rs)->reg_status &					\		    (REG_BUSY | REG_IN_WIN | REG_MAPPED | REG_DMAP))	\						== REG_BUSY) {		\			(rs)->reg_status = 0;				\			(st)->reg_freelist [(reg_ix)] = (st)->reg_nextfree; \			(st)->reg_nextfree = (reg_ix);			\			}						\		else if (preg_is_special ((reg_ix)) && (((rs)->reg_status & \			  (REG_BUSY | REG_IN_WIN | REG_MAPPED | REG_DMAP)) \						== (REG_BUSY + REG_MAPPED)) ) \			(rs)->reg_status = REG_MAPPED;			\		}							\	}#endif#define ReleaseRegMap(st, th, reg_ix, lreg) {				\	int	lreg_ix; REGSTAT *rs = &(st)->reg_rstat[(reg_ix)];	\	rs->reg_nmap--;							\	if (rs->reg_nmap == 0) {					\		rs->reg_status &= ~REG_MAPPED;				\		CheckRegFree ((st), rs, (reg_ix));			\		}							\	lreg_ix = (lreg)>>1;						\	if ((rs->reg_status & REG_CLAIMED) &&				\	    ((th)->half_def[lreg_ix] & REGNAME_CLAIM)) {		\		rs->reg_nclaims--;					\		CheckRegFree ((st), rs, (reg_ix));			\		if ((rs->reg_status & REG_CLAIMED) == 0)		\			(th)->half_def[lreg_ix] &= ~REGNAME_CLAIM;	\		}							\	}#ifdef PRIORITIZE_AVAIL_LIST#define CheckInstAvail(st, inum) while (1) {				\	int	pri, avail, last_avail;					\	if ((st)->iwin_flags [(inum)] &					\(IWIN_DEP2 | IWIN_DEP3 | IWIN_FLUSH | IWIN_AVAIL | IWIN_LDST_DEP | IWIN_BRDLY)) \		 break;							\	if (((st)->iwin_flags [(inum)] & (IWIN_SPEC | IWIN_CTL)) ==	\						(IWIN_SPEC | IWIN_CTL)) \		break;							\	(st)->iwin_flags [(inum)] |= IWIN_AVAIL;			\	pri = (st)->iwin_headpri;					\	avail = (st)->iwin_next_avail;					\	last_avail = -1;						\	while (pri != (inum)) {						\		if (pri == avail) {					\			last_avail = avail;				\			avail = (st)->iwin_avail_list [avail];		\			}						\		pri = (st)->iwin_pri [pri];				\		}							\	(st)->iwin_avail_list [(inum)] = avail;				\	if (last_avail < 0)						\		(st)->iwin_next_avail = (inum);				\	else	(st)->iwin_avail_list [last_avail] = (inum);		\	break; }#else  /* PRIORITIZE_AVAIL_LIST */#define CheckInstAvail(st, inum) while (1) {				\	int	pri, avail, last_avail;					\	if ((st)->iwin_flags [(inum)] &					\(IWIN_DEP2 | IWIN_DEP3 | IWIN_FLUSH | IWIN_AVAIL | IWIN_LDST_DEP | IWIN_BRDLY)) \		break;							\	if (((st)->iwin_flags [(inum)] & (IWIN_SPEC | IWIN_CTL)) ==	\						(IWIN_SPEC | IWIN_CTL)) \		break;							\	(st)->iwin_flags [(inum)] |= IWIN_AVAIL;			\	if ((st)->iwin_next_avail >= 0) {				\		(st)->iwin_avail_list [(st)->iwin_last_avail] = (inum);	\		(st)->iwin_last_avail = (inum);				\		}							\	else {								\		(st)->iwin_next_avail = (inum);				\		(st)->iwin_last_avail = (inum);				\		}							\	(st)->iwin_avail_list [(inum)] = -1;				\	break; }#endif  /* PRIORITIZE_AVAIL_LIST */#else  /* INLINE */	/*	 *  If we aren't inlining these functions, then include function	 *  prototypes, and make the declarations vacuous.	 */extern	void	UnthreadInst (struct s_cpu_state *st, int inum);extern	void	AcquireRegMap (REGSTAT *rs, THREAD *th, int lreg);extern	void	ReleaseRegMap (struct s_cpu_state *st, THREAD *th,						int reg_ix, int lreg);extern	void	CheckRegFree(struct s_cpu_state *st, REGSTAT *rs, int reg_ix);extern	void	CheckInstAvail (struct s_cpu_state *st, int inum);extern void Add_to_worklist(struct s_cpu_state *st, int inc,		void (*func)(void *st, void *a2),		void *argument2);#define	WorkDecls#endif  /* INLINE */#ifdef MIPSY_MXS	/*	 *  For the MIPSY_MXS version, the address and the compiled address	 *  of the code is the same.	 */#define addr_to_cadr(st,addr) (addr)#define	cadr_to_addr(st,cadr) (cadr)#elseextern	int	addr_to_cadr (struct s_cpu_state *st, uint addr);extern	uint	cadr_to_addr (struct s_cpu_state *st, int cadr);extern	int	DoPrivInst(struct s_cpu_state *st, int inst,				uint srcreg, uint *dstreg, int *hack);extern	int	FPusable(struct s_cpu_state *st);extern	int	GetLastException (struct s_cpu_state *st);#endif

⌨️ 快捷键说明

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