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

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

?? interrupt.cc

?? Nachos platform for Ubuntu
?? 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一区二区三区免费野_久草精品视频
男男成人高潮片免费网站| 国产日本亚洲高清| 一区二区欧美视频| 欧美性大战久久久| 一区二区三区在线高清| 欧美在线不卡视频| 日本欧美在线看| 久久综合狠狠综合久久激情 | 亚洲二区在线视频| 欧美人妇做爰xxxⅹ性高电影| 三级精品在线观看| 一区二区三区中文字幕电影| 欧美午夜影院一区| 七七婷婷婷婷精品国产| 国产亚洲福利社区一区| 91视频在线观看免费| 亚洲一二三区在线观看| 日韩免费电影一区| 成人性视频免费网站| 亚洲精品免费一二三区| 91精品国产91热久久久做人人| 久久av中文字幕片| 国产欧美日韩久久| 欧美少妇bbb| 久久久久一区二区三区四区| 国产成人鲁色资源国产91色综| 国产不卡在线一区| 亚洲欧美日韩中文字幕一区二区三区 | 国产成人在线观看免费网站| 中文乱码免费一区二区| 欧美日韩中文另类| 国产盗摄女厕一区二区三区| 亚洲裸体xxx| 久久亚区不卡日本| 国产精品午夜在线| 51精品国自产在线| jizzjizzjizz欧美| 日本欧美一区二区三区乱码| 国产精品久久久久三级| 日韩欧美在线一区二区三区| 99久久免费精品高清特色大片| 日韩成人伦理电影在线观看| 中文字幕一区二区三| 91精品欧美久久久久久动漫| av中文字幕不卡| 韩国女主播成人在线| 亚洲大片精品永久免费| 亚洲日本在线视频观看| 久久精品夜夜夜夜久久| 日韩手机在线导航| 欧美系列亚洲系列| 91麻豆精品秘密| 成人毛片老司机大片| 国内精品免费在线观看| 免费一区二区视频| 婷婷丁香激情综合| 亚洲精品欧美综合四区| 国产精品丝袜黑色高跟| 国产亚洲成aⅴ人片在线观看| 7777精品伊人久久久大香线蕉的| 色综合天天综合| 不卡视频免费播放| 国产 日韩 欧美大片| 国内精品自线一区二区三区视频| 日韩电影一二三区| 午夜视黄欧洲亚洲| 亚洲成人一二三| 一区二区在线看| 亚洲精选视频在线| 综合色中文字幕| 综合激情网...| 18欧美亚洲精品| 亚洲视频在线观看一区| 中文字幕日韩欧美一区二区三区| 欧美精彩视频一区二区三区| 久久综合国产精品| 麻豆国产一区二区| 青青青爽久久午夜综合久久午夜| 日韩专区一卡二卡| 毛片av中文字幕一区二区| 美女国产一区二区三区| 精品在线一区二区| 国产美女在线观看一区| 国产精品香蕉一区二区三区| 高清国产一区二区| 99免费精品在线观看| 日本精品一区二区三区高清 | 色欧美片视频在线观看| 色噜噜狠狠成人网p站| 欧美亚洲动漫制服丝袜| 欧美美女一区二区在线观看| 91麻豆精品国产91| 欧美va亚洲va| 中文字幕第一区综合| 亚洲欧洲中文日韩久久av乱码| 一区二区三区 在线观看视频| 天堂一区二区在线| 国产中文字幕一区| aaa国产一区| 精品视频在线免费| 精品国产3级a| 粉嫩13p一区二区三区| 99久久婷婷国产精品综合| 在线观看精品一区| 日韩亚洲欧美中文三级| 久久久久久久久久久黄色| 国产精品久久精品日日| 亚洲18女电影在线观看| 狠狠色狠狠色综合| 99久久久免费精品国产一区二区| 欧美性xxxxxx少妇| 国产亚洲精品免费| 亚洲一区二区三区四区在线观看| 蜜桃精品视频在线| gogogo免费视频观看亚洲一| 欧美日韩视频在线一区二区| 久久免费精品国产久精品久久久久| 国产精品成人午夜| 日韩高清不卡一区二区| 成人av电影免费观看| 欧美妇女性影城| 国产精品理伦片| 日本伊人色综合网| 99精品视频一区二区| 日韩你懂的电影在线观看| 亚洲欧美另类小说| 国产一区二区三区香蕉| 欧美日韩不卡在线| 国产精品美女久久久久av爽李琼| 亚洲第一激情av| a4yy欧美一区二区三区| 日韩视频一区二区在线观看| 亚洲视频资源在线| 国产酒店精品激情| 91精品福利在线一区二区三区| 成人免费小视频| 国产一区二区在线观看免费| 欧美日韩精品三区| 亚洲欧美日韩国产成人精品影院 | 亚洲一区二区三区不卡国产欧美 | 中文字幕一区二区日韩精品绯色| 麻豆成人久久精品二区三区小说| 91福利视频在线| 国产区在线观看成人精品| 在线观看日韩一区| 国产亲近乱来精品视频| 蜜臀av性久久久久蜜臀aⅴ流畅 | 高清shemale亚洲人妖| 日韩丝袜美女视频| 日精品一区二区三区| 欧美又粗又大又爽| 国产精品的网站| 国产一区三区三区| 欧美tickling挠脚心丨vk| 亚洲成人免费视频| 欧美色老头old∨ideo| 亚洲三级视频在线观看| 99久久精品国产一区二区三区 | 中文一区二区完整视频在线观看| 久88久久88久久久| 欧美电影免费观看高清完整版| 日韩高清不卡在线| 欧美一区二区三区免费在线看| 亚洲电影一级黄| 欧美日韩成人一区| 日韩精品欧美成人高清一区二区| 欧美日韩在线综合| 亚洲成人高清在线| 制服.丝袜.亚洲.中文.综合| 三级不卡在线观看| 日韩你懂的电影在线观看| 久久国产三级精品| 久久久五月婷婷| 成人精品小蝌蚪| 亚洲女女做受ⅹxx高潮| 欧美中文字幕一区| 日韩精品免费视频人成| 日韩欧美一区电影| 国产一区二区三区蝌蚪| 欧美激情一二三区| 99精品视频在线免费观看| 一区二区欧美在线观看| 欧美电影影音先锋| 精品一区在线看| 国产精品入口麻豆原神| 色综合久久99| 日韩黄色小视频| 久久久久久久综合| 99re热视频这里只精品| 亚洲综合免费观看高清完整版| 欧美日韩国产综合一区二区| 另类人妖一区二区av| 国产农村妇女毛片精品久久麻豆 | 中文字幕乱码日本亚洲一区二区| 91丝袜美女网| 午夜电影久久久| 日本一区二区三区在线观看| 97aⅴ精品视频一二三区| 亚洲一区二区三区四区的| 日韩久久精品一区|