亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? interrupt.cc

?? nachos test nachos 有關實驗
?? CC
字號:
// interrupt.cc //	Routines to simulate hardware interrupts.////	The hardware provides a routine (SetLevel) to enable or disable//	interrupts.////	In order to emulate the hardware, we need to keep track of all//	interrupts the hardware devices would cause, and when they//	are supposed to occur.  ////	This module also keeps track of simulated time.  Time advances//	only when the following occur: //		interrupts are re-enabled//		a user instruction is executed//		there is nothing in the ready queue////  DO NOT CHANGE -- part of the machine emulation//// Copyright (c) 1992-1993 The Regents of the University of California.// All rights reserved.  See copyright.h for copyright notice and limitation // of liability and disclaimer of warranty provisions.#include "copyright.h"#include "interrupt.h"#include "system.h"// String definitions for debugging messagesstatic char *intLevelNames[] = { "off", "on"};static char *intTypeNames[] = { "timer", "disk", "console write", 			"console read", "network send", "network recv"};//----------------------------------------------------------------------// PendingInterrupt::PendingInterrupt// 	Initialize a hardware device interrupt that is to be scheduled //	to occur in the near future.////	"func" is the procedure to call when the interrupt occurs//	"param" is the argument to pass to the procedure//	"time" is when (in simulated time) the interrupt is to occur//	"kind" is the hardware device that generated the interrupt//----------------------------------------------------------------------PendingInterrupt::PendingInterrupt(VoidFunctionPtr func, int param, int time, 				IntType kind){    handler = func;    arg = param;    when = time;    type = kind;}//----------------------------------------------------------------------// Interrupt::Interrupt// 	Initialize the simulation of hardware device interrupts.//	//	Interrupts start disabled, with no interrupts pending, etc.//----------------------------------------------------------------------Interrupt::Interrupt(){    level = IntOff;    pending = new List();    inHandler = FALSE;    yieldOnReturn = FALSE;    status = SystemMode;}//----------------------------------------------------------------------// Interrupt::~Interrupt// 	De-allocate the data structures needed by the interrupt simulation.//----------------------------------------------------------------------Interrupt::~Interrupt(){    while (!pending->IsEmpty())	delete (PendingInterrupt *)pending->Remove();    delete pending;}//----------------------------------------------------------------------// Interrupt::ChangeLevel// 	Change interrupts to be enabled or disabled, without advancing //	the simulated time (normally, enabling interrupts advances the time).//----------------------------------------------------------------------// Interrupt::ChangeLevel// 	Change interrupts to be enabled or disabled, without advancing //	the simulated time (normally, enabling interrupts advances the time).////	Used internally.////	"old" -- the old interrupt status//	"now" -- the new interrupt status//----------------------------------------------------------------------voidInterrupt::ChangeLevel(IntStatus old, IntStatus now){    level = now;    DEBUG('i',"\tinterrupts: %s -> %s\n",intLevelNames[old],intLevelNames[now]);}//----------------------------------------------------------------------// Interrupt::SetLevel// 	Change interrupts to be enabled or disabled, and if interrupts//	are being enabled, advance simulated time by calling OneTick().//// Returns://	The old interrupt status.// Parameters://	"now" -- the new interrupt status//----------------------------------------------------------------------IntStatusInterrupt::SetLevel(IntStatus now){    IntStatus old = level;        ASSERT((now == IntOff) || (inHandler == FALSE));// interrupt handlers are 						// prohibited from enabling 						// interrupts    ChangeLevel(old, now);			// change to new state    if ((now == IntOn) && (old == IntOff))	OneTick();				// advance simulated time    return old;}//----------------------------------------------------------------------// Interrupt::Enable// 	Turn interrupts on.  Who cares what they used to be? //	Used in ThreadRoot, to turn interrupts on when first starting up//	a thread.//----------------------------------------------------------------------voidInterrupt::Enable(){     (void) SetLevel(IntOn); }//----------------------------------------------------------------------// Interrupt::OneTick// 	Advance simulated time and check if there are any pending //	interrupts to be called. ////	Two things can cause OneTick to be called://		interrupts are re-enabled//		a user instruction is executed//----------------------------------------------------------------------voidInterrupt::OneTick(){    MachineStatus old = status;// advance simulated time    if (status == SystemMode) {        stats->totalTicks += SystemTick;	stats->systemTicks += SystemTick;    } else {					// USER_PROGRAM	stats->totalTicks += UserTick;	stats->userTicks += UserTick;    }    DEBUG('i', "\n== Tick %d ==\n", stats->totalTicks);// check any pending interrupts are now ready to fire    ChangeLevel(IntOn, IntOff);		// first, turn off interrupts					// (interrupt handlers run with					// interrupts disabled)    while (CheckIfDue(FALSE))		// check for pending interrupts	;    ChangeLevel(IntOff, IntOn);		// re-enable interrupts    if (yieldOnReturn) {		// if the timer device handler asked 					// for a context switch, ok to do it now	yieldOnReturn = FALSE; 	status = SystemMode;		// yield is a kernel routine	currentThread->Yield();	status = old;    }}//----------------------------------------------------------------------// Interrupt::YieldOnReturn// 	Called from within an interrupt handler, to cause a context switch//	(for example, on a time slice) in the interrupted thread,//	when the handler returns.////	We can't do the context switch here, because that would switch//	out the interrupt handler, and we want to switch out the //	interrupted thread.//----------------------------------------------------------------------voidInterrupt::YieldOnReturn(){     ASSERT(inHandler == TRUE);      yieldOnReturn = TRUE; }//----------------------------------------------------------------------// Interrupt::Idle// 	Routine called when there is nothing in the ready queue.////	Since something has to be running in order to put a thread//	on the ready queue, the only thing to do is to advance //	simulated time until the next scheduled hardware interrupt.////	If there are no pending interrupts, stop.  There's nothing//	more for us to do.//----------------------------------------------------------------------voidInterrupt::Idle(){    DEBUG('i', "Machine idling; checking for interrupts.\n");    status = IdleMode;    if (CheckIfDue(TRUE)) {		// check for any pending interrupts    	while (CheckIfDue(FALSE))	// check for any other pending 	    ;				// interrupts        yieldOnReturn = FALSE;		// since there's nothing in the					// ready queue, the yield is automatic        status = SystemMode;	return;				// return in case there's now					// a runnable thread    }    // if there are no pending interrupts, and nothing is on the ready    // queue, it is time to stop.   If the console or the network is     // operating, there are *always* pending interrupts, so this code    // is not reached.  Instead, the halt must be invoked by the user program.    DEBUG('i', "Machine idle.  No interrupts to do.\n");    printf("No threads ready or runnable, and no pending interrupts.\n");    printf("Assuming the program completed.\n");    Halt();}//----------------------------------------------------------------------// Interrupt::Halt// 	Shut down Nachos cleanly, printing out performance statistics.//----------------------------------------------------------------------voidInterrupt::Halt(){    printf("Machine halting!\n\n");    stats->Print();    Cleanup();     // Never returns.}//----------------------------------------------------------------------// Interrupt::Schedule// 	Arrange for the CPU to be interrupted when simulated time//	reaches "now + when".////	Implementation: just put it on a sorted list.////	NOTE: the Nachos kernel should not call this routine directly.//	Instead, it is only called by the hardware device simulators.////	"handler" is the procedure to call when the interrupt occurs//	"arg" is the argument to pass to the procedure//	"fromNow" is how far in the future (in simulated time) the //		 interrupt is to occur//	"type" is the hardware device that generated the interrupt//----------------------------------------------------------------------voidInterrupt::Schedule(VoidFunctionPtr handler, int arg, int fromNow, IntType type){    int when = stats->totalTicks + fromNow;    PendingInterrupt *toOccur = new PendingInterrupt(handler, arg, when, type);    DEBUG('i', "Scheduling interrupt handler the %s at time = %d\n", 					intTypeNames[type], when);    ASSERT(fromNow > 0);    pending->SortedInsert(toOccur, when);}//----------------------------------------------------------------------// Interrupt::CheckIfDue// 	Check if an interrupt is scheduled to occur, and if so, fire it off.//// Returns://	TRUE, if we fired off any interrupt handlers// Params://	"advanceClock" -- if TRUE, there is nothing in the ready queue,//		so we should simply advance the clock to when the next //		pending interrupt would occur (if any).  If the pending//		interrupt is just the time-slice daemon, however, then //		we're done!//----------------------------------------------------------------------boolInterrupt::CheckIfDue(bool advanceClock){    MachineStatus old = status;    int when;    ASSERT(level == IntOff);		// interrupts need to be disabled,					// to invoke an interrupt handler    if (DebugIsEnabled('i'))	DumpState();    PendingInterrupt *toOccur = 		(PendingInterrupt *)pending->SortedRemove(&when);    if (toOccur == NULL)		// no pending interrupts	return FALSE;			    if (advanceClock && when > stats->totalTicks) {	// advance the clock	stats->idleTicks += (when - stats->totalTicks);	stats->totalTicks = when;    } else if (when > stats->totalTicks) {	// not time yet, put it back	pending->SortedInsert(toOccur, when);	return FALSE;    }// Check if there is nothing more to do, and if so, quit    if ((status == IdleMode) && (toOccur->type == TimerInt) 				&& pending->IsEmpty()) {	 pending->SortedInsert(toOccur, when);	 return FALSE;    }    DEBUG('i', "Invoking interrupt handler for the %s at time %d\n", 			intTypeNames[toOccur->type], toOccur->when);#ifdef USER_PROGRAM    if (machine != NULL)    	machine->DelayedLoad(0, 0);#endif    inHandler = TRUE;    status = SystemMode;			// whatever we were doing,						// we are now going to be						// running in the kernel    (*(toOccur->handler))(toOccur->arg);	// call the interrupt handler    status = old;				// restore the machine status    inHandler = FALSE;    delete toOccur;    return TRUE;}//----------------------------------------------------------------------// PrintPending// 	Print information about an interrupt that is scheduled to occur.//	When, where, why, etc.//----------------------------------------------------------------------static voidPrintPending(int arg){    PendingInterrupt *pend = (PendingInterrupt *)arg;    printf("Interrupt handler %s, scheduled at %d\n", 	intTypeNames[pend->type], pend->when);}//----------------------------------------------------------------------// DumpState// 	Print the complete interrupt state - the status, and all interrupts//	that are scheduled to occur in the future.//----------------------------------------------------------------------voidInterrupt::DumpState(){    printf("Time: %d, interrupts %s\n", stats->totalTicks, 					intLevelNames[level]);    printf("Pending interrupts:\n");    fflush(stdout);    pending->Mapcar(PrintPending);    printf("End of pending interrupts\n");    fflush(stdout);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产成人精品亚洲午夜麻豆| 欧美日韩精品专区| 日本久久电影网| 日韩欧美www| 亚洲午夜日本在线观看| 国产激情精品久久久第一区二区 | 在线播放日韩导航| 欧美国产日本视频| 日韩国产一二三区| 91同城在线观看| 久久天天做天天爱综合色| 亚洲h在线观看| 99精品欧美一区| 国产免费成人在线视频| 日本在线播放一区二区三区| 91丨porny丨国产入口| 久久亚洲免费视频| 日韩精品国产欧美| 欧美在线不卡一区| 亚洲精品高清视频在线观看| 国产成人aaa| 精品va天堂亚洲国产| 日本亚洲最大的色成网站www| 色综合天天综合网国产成人综合天| 国产日产欧美一区二区三区| 麻豆精品久久久| 日韩欧美激情在线| 老司机午夜精品| 欧美成人a∨高清免费观看| 日韩国产精品大片| 欧美一区二区三区四区视频| 午夜精品福利视频网站| 日韩美女一区二区三区| 亚洲超碰97人人做人人爱| 在线观看日韩电影| 亚洲高清免费在线| 欧美日本韩国一区二区三区视频| 亚洲国产精品一区二区久久恐怖片| 91免费看`日韩一区二区| 亚洲精品成人在线| 欧美色精品在线视频| 亚洲影院理伦片| 欧美日韩久久一区二区| 日韩av电影免费观看高清完整版 | 精品一区二区三区免费| 精品理论电影在线观看| 国产精品伊人色| 国产精品欧美精品| 色欧美日韩亚洲| 亚洲超碰97人人做人人爱| 欧美一区二视频| 国产一区二区视频在线| 欧美韩日一区二区三区四区| 99久久综合国产精品| 一二三四社区欧美黄| 91精品午夜视频| 国产一区二区不卡老阿姨| 国产精品久久夜| 欧美日韩在线播放| 久久精品免费看| 国产精品久久久久久久久免费丝袜 | 久久国产三级精品| 国产精品久久久久久久裸模| 欧美日韩成人一区| 国产激情精品久久久第一区二区| 亚洲视频在线观看一区| 91精品婷婷国产综合久久竹菊| 黄色精品一二区| 一区二区三区四区高清精品免费观看| 欧美精品自拍偷拍| 粉嫩在线一区二区三区视频| 亚洲国产精品影院| 国产丝袜美腿一区二区三区| 欧美亚洲另类激情小说| 激情综合色综合久久综合| 中文字幕中文字幕在线一区 | 精品卡一卡二卡三卡四在线| av中文字幕在线不卡| 三级亚洲高清视频| 中文字幕一区二区三| 欧美一区二区黄色| 色综合色狠狠综合色| 国产在线精品一区二区三区不卡| 亚洲精品日韩专区silk| 久久日一线二线三线suv| 欧美婷婷六月丁香综合色| 国产91精品一区二区麻豆网站| 亚洲电影第三页| 国产精品色哟哟| 精品欧美黑人一区二区三区| 日本韩国一区二区| av在线这里只有精品| 精品一区二区三区视频在线观看| 亚洲尤物视频在线| 亚洲人成人一区二区在线观看 | proumb性欧美在线观看| 久久av资源站| 日韩精品一区第一页| 亚洲欧美另类在线| 国产精品久久久久久亚洲伦| 久久久综合视频| 精品国产制服丝袜高跟| 欧美高清一级片在线| 在线观看欧美日本| 成人aa视频在线观看| 国产成人精品免费在线| 国产永久精品大片wwwapp| 免费精品视频在线| 青青青伊人色综合久久| 亚洲va天堂va国产va久| 亚洲国产中文字幕| 一区二区三区日本| 亚洲一二三区不卡| 国产另类ts人妖一区二区| 日本 国产 欧美色综合| 天天色 色综合| 日韩二区三区四区| 婷婷开心久久网| 日韩在线卡一卡二| 日日摸夜夜添夜夜添亚洲女人| 亚洲香肠在线观看| 亚洲大片精品永久免费| 亚洲成人动漫在线免费观看| 亚洲一二三四久久| 亚洲国产三级在线| 奇米色777欧美一区二区| 欧美aaaaaa午夜精品| 精品一区二区免费看| 国内精品自线一区二区三区视频| 国产伦精一区二区三区| 国产精品白丝av| 99久久婷婷国产综合精品| 97精品国产露脸对白| 欧美羞羞免费网站| 91精品久久久久久久99蜜桃| 精品美女一区二区| 中文字幕欧美国产| 亚洲午夜在线电影| 久久99国产精品麻豆| 国产成人久久精品77777最新版本 国产成人鲁色资源国产91色综 | 亚洲图片欧美一区| 麻豆精品国产传媒mv男同| 高清在线成人网| 日本电影亚洲天堂一区| 精品视频一区二区不卡| 久久综合狠狠综合久久综合88| 欧美激情在线免费观看| 亚洲成人资源网| 国产伦精一区二区三区| 在线观看亚洲a| 久久嫩草精品久久久精品一| 亚洲欧美综合网| 日韩和欧美一区二区三区| 国产一区二区三区久久悠悠色av| av一区二区三区黑人| 91麻豆精品国产91久久久久| 欧美国产视频在线| 日本成人在线看| 99re热视频精品| 欧美tickling挠脚心丨vk| 亚洲精品国产精华液| 国产麻豆9l精品三级站| 欧美肥妇bbw| 亚洲天堂精品视频| 韩国理伦片一区二区三区在线播放| 96av麻豆蜜桃一区二区| 精品国产乱码久久久久久牛牛| 成人免费在线播放视频| 久久成人久久爱| 欧美网站大全在线观看| 中文字幕一区二区三区在线观看 | 亚洲欧美综合在线精品| 九一九一国产精品| 欧美性生活大片视频| 欧美国产视频在线| 久久av老司机精品网站导航| 在线精品视频一区二区| 国产精品丝袜黑色高跟| 精品一区二区三区在线观看 | 91丨porny丨国产| 国产日韩欧美制服另类| 美国一区二区三区在线播放| 欧美在线制服丝袜| 亚洲视频一二三| 成人在线综合网站| 久久久三级国产网站| 麻豆精品国产91久久久久久| 3atv一区二区三区| 亚洲gay无套男同| 在线观看日韩精品| 一区二区三区电影在线播| 91免费版在线| 亚洲黄色小说网站| 99国产精品一区| 亚洲日本成人在线观看| 99久久精品国产一区二区三区| 国产精品理论在线观看| 国产成人精品一区二区三区网站观看| 亚洲精品在线免费播放| 精品在线免费观看|