00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include "copyright.h"
00024 #include "interrupt.h"
00025 #include "main.h"
00026
00027
00028
00029 static char *intLevelNames[] = { "off", "on"};
00030 static char *intTypeNames[] = { "timer", "disk", "console write",
00031 "console read", "elevator", "network send",
00032 "network recv"};
00033
00046 PendingInterrupt::PendingInterrupt(CallBackObj *callOnInt,
00047 int time, IntType kind)
00048 {
00049 callOnInterrupt = callOnInt;
00050 when = time;
00051 type = kind;
00052 }
00053
00059 static int
00060 PendingCompare (PendingInterrupt *x, PendingInterrupt *y)
00061 {
00062 if (x->when < y->when) { return -1; }
00063 else if (x->when > y->when) { return 1; }
00064 else { return 0; }
00065 }
00066
00074 Interrupt::Interrupt()
00075 {
00076 level = IntOff;
00077 pending = new SortedList<PendingInterrupt *>(PendingCompare);
00078 inHandler = FALSE;
00079 yieldOnReturn = FALSE;
00080 status = SystemMode;
00081 }
00082
00107
00125
00149
00191
00209
00236
00259
00283
00332
00345