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

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

?? interrupt.cc

?? linux的例子,就是下載后到自己的機子上去運行
?? 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一区二区三区免费野_久草精品视频
亚洲色图色小说| 亚洲成人av资源| 一区二区国产盗摄色噜噜| 9人人澡人人爽人人精品| 国产成人免费在线观看| 在线免费观看视频一区| 国产欧美一区二区在线| 91视频观看免费| 日韩经典中文字幕一区| 久久久久久**毛片大全| 国产不卡高清在线观看视频| 色又黄又爽网站www久久| 国产午夜久久久久| 成人美女视频在线看| 欧美国产精品劲爆| 国产精品99久久久久久似苏梦涵| 欧美在线看片a免费观看| 午夜久久电影网| 26uuu久久天堂性欧美| 丝袜诱惑制服诱惑色一区在线观看| 国产精品正在播放| 国产欧美视频在线观看| 国产呦萝稀缺另类资源| 日韩一区二区三区电影在线观看 | 亚洲国产另类av| 久久久综合九色合综国产精品| 成人永久免费视频| 午夜av区久久| 亚洲男人的天堂一区二区| 国产日韩欧美麻豆| 成人高清伦理免费影院在线观看| 狠狠狠色丁香婷婷综合久久五月| 国产情人综合久久777777| 日韩欧美国产不卡| 国产日韩欧美精品电影三级在线| 欧美亚洲国产一区二区三区| 欧美精品乱码久久久久久按摩| 自拍偷拍亚洲综合| 国产宾馆实践打屁股91| 国产免费成人在线视频| 成人三级伦理片| 国产精品欧美极品| www.亚洲国产| 亚洲精品欧美在线| 欧美日韩精品系列| 秋霞影院一区二区| 欧美不卡123| 国产真实精品久久二三区| 久久精品一区四区| 成+人+亚洲+综合天堂| 亚洲视频免费在线| 欧美日韩在线观看一区二区| 午夜精品福利视频网站| 欧美一级理论片| 国产传媒欧美日韩成人| 亚洲欧洲成人精品av97| 欧美日韩在线直播| 喷水一区二区三区| 久久久.com| 91小宝寻花一区二区三区| 亚洲国产视频在线| 精品久久久久久久久久久久久久久 | 成人免费毛片a| 亚洲卡通动漫在线| 9191久久久久久久久久久| 国内久久精品视频| 亚洲色大成网站www久久九九| 在线观看av不卡| 精品亚洲国内自在自线福利| 国产精品福利一区二区三区| 欧美日韩精品欧美日韩精品一综合| 美女视频黄a大片欧美| 中文字幕日韩精品一区| 7878成人国产在线观看| 成人精品视频一区二区三区尤物| 亚洲国产精品影院| 国产亚洲欧美色| 欧美日韩成人一区二区| 国产91富婆露脸刺激对白| 午夜免费久久看| 国产欧美日韩另类视频免费观看| 欧美日韩一区二区在线观看 | 日韩天堂在线观看| 不卡一二三区首页| 美国欧美日韩国产在线播放| 亚洲免费在线视频一区 二区| 欧美mv日韩mv国产网站app| 色狠狠桃花综合| 国产裸体歌舞团一区二区| 香蕉影视欧美成人| 中文字幕一区二区三区在线观看| 日韩一区二区三区免费观看| 91搞黄在线观看| 成人高清免费观看| 韩国三级在线一区| 亚洲va中文字幕| 亚洲伦理在线免费看| 国产拍欧美日韩视频二区| 欧美一个色资源| 欧美美女激情18p| 色网综合在线观看| av午夜精品一区二区三区| 韩国一区二区在线观看| 老司机精品视频在线| 五月激情综合婷婷| 亚洲成av人综合在线观看| 亚洲蜜桃精久久久久久久| 欧美国产一区视频在线观看| 久久色在线观看| 精品久久久三级丝袜| 日韩免费电影网站| 日韩一区和二区| 91麻豆精品国产自产在线 | 国产精品乱子久久久久| 久久色.com| 欧美精品一区二区精品网| 欧美一个色资源| 日韩欧美国产高清| 欧美xfplay| 26uuu精品一区二区三区四区在线| 91精品国产欧美日韩| 91精品国产手机| 日韩欧美在线综合网| 欧美成人a在线| 欧美mv日韩mv国产网站| 精品区一区二区| 久久亚区不卡日本| 欧美国产精品专区| 亚洲婷婷综合久久一本伊一区| 亚洲欧美色一区| 亚洲永久精品大片| 日本色综合中文字幕| 麻豆91免费看| 成人综合激情网| 日本二三区不卡| 欧美一区二区福利视频| 精品美女一区二区| 国产精品美女久久久久久久 | 久久亚洲精精品中文字幕早川悠里 | 久久精品视频网| 欧美激情在线观看视频免费| 亚洲精品中文字幕在线观看| 五月婷婷久久丁香| 精品无码三级在线观看视频| 国产成人啪免费观看软件| 91蜜桃在线观看| 欧美一区二区三区视频在线| 国产午夜三级一区二区三| 亚洲激情网站免费观看| 久久精品二区亚洲w码| 成人av网站免费观看| 欧美日韩日日摸| 欧美国产在线观看| 亚洲福利国产精品| 国产激情视频一区二区在线观看 | 韩国女主播一区| 91影院在线观看| 日韩一区二区视频| 亚洲欧美另类小说| 老司机精品视频在线| 色综合天天性综合| 久久久美女毛片| 中文字幕日韩一区| 久久国产人妖系列| 色国产综合视频| 国产欧美综合色| 免费观看91视频大全| 91欧美激情一区二区三区成人| 欧美一区二区三区在线视频| 成人欧美一区二区三区小说| 麻豆视频观看网址久久| 在线精品视频一区二区三四| 精品久久久久香蕉网| 亚洲高清一区二区三区| 99综合影院在线| 久久综合视频网| 午夜国产不卡在线观看视频| 99re这里只有精品视频首页| 亚洲精品在线观看网站| 午夜精品视频在线观看| 91在线小视频| 中文字幕av一区二区三区免费看| 日韩av在线发布| 欧美日韩中字一区| 亚洲丝袜精品丝袜在线| 国产福利一区二区三区| 精品久久五月天| 男女性色大片免费观看一区二区| 欧美性感一区二区三区| 亚洲免费观看高清完整版在线观看| 国产白丝精品91爽爽久久| 亚洲精品在线免费观看视频| 麻豆成人91精品二区三区| 日韩一区和二区| 蜜桃精品视频在线| 欧美精品一卡二卡| 视频在线观看一区二区三区| 在线观看精品一区| 亚洲精品伦理在线| 91蝌蚪porny九色|