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

📄 ms_wrklst.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.  * */	/*	 *  ms_wrklst.c  -  Implement the worklist mechanism for the	 *		    simulator.	 *	 *	The worklist mechanism is designed to handle instructions	 *	that take multiple cycles to complete, such as floating	 *	point operations, or cache accesses.  These instructions	 *	are handled by locking their destination register, and then	 *	scheduling their completion for the appropriate cycle.	 *	 *	Jim Bennett	 *	1993, 1994	 */#include <stdlib.h>#include "ms.h"#ifndef INLINEvoid Add_to_worklist(struct s_cpu_state *st, int inc,		void (*func)(void *st, void *a2),		void *argument2)	{	WorkList *wd_w, *wd_wlp;	int	wd_c;	wd_w = st->free_head;	if (wd_w == NULL)		{		fprintf (stderr, "Out of work items!!\r\n");		ms_break (st, NULL, "ERR");		}	st->free_head = wd_w->next;	wd_c = st->work_cycle+(inc);	wd_wlp = st->work_tail;	if (wd_wlp == NULL)		{		wd_w->next = NULL;		st->work_head = wd_w;		st->work_tail = wd_w;		}	else if (wd_c < wd_wlp->cycle)		{		wd_wlp = st->work_head;		if (wd_c < wd_wlp->cycle)			{			wd_w->next = wd_wlp;			st->work_head = wd_w;			}		else			{			for (; wd_wlp->next->cycle < wd_c;					wd_wlp = wd_wlp->next);			wd_w->next = wd_wlp->next;			wd_wlp->next = wd_w;			}		}	else		{		wd_w->next = NULL;		wd_wlp->next = wd_w;		st->work_tail = wd_w;		}	wd_w->cycle = wd_c;	wd_w->f = func;	wd_w->arg2 = argument2;	}#endif

⌨️ 快捷键说明

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