X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fgeekos%2Fint.c;h=513240d78fcf2f37840e9dad646535946b05eaad;hb=624a05de781c51ed5d34a6db2583f884918a9594;hp=319017bade8a73fe6a5ee380542ee0a4ca6fa98b;hpb=626595465a2c6987606a6bc697df65130ad8c2d3;p=palacios.git diff --git a/palacios/src/geekos/int.c b/palacios/src/geekos/int.c index 319017b..513240d 100644 --- a/palacios/src/geekos/int.c +++ b/palacios/src/geekos/int.c @@ -1,7 +1,7 @@ /* * GeekOS interrupt handling data structures and functions * Copyright (c) 2001,2003 David H. Hovemeyer - * $Revision: 1.1 $ + * $Revision: 1.6 $ * * This is free software. You are permitted to use, * redistribute, and modify it as specified in the file "COPYING". @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include @@ -25,6 +25,290 @@ ulong_t Get_Current_EFLAGS(void); * Private functions and data * ---------------------------------------------------------------------- */ + + + + + + + + + + + +char *exception_names[] = { + "#DE (Divide Error)", + "#DB (Reserved)", + "NMI", + "#BP (Breakpoint)", + "#OF (Overflow)", + "#BR (BOUND Range Exceeded)", + "#UD (Invalid Opcode)", + "#NM (No Math Coprocessor)", + "#DF (Double Fault)", + "Coprocessor Segment Overrun", + "#TS (Invalid TSS)", + "#NP (Segment Not Present)", + "#SS (Stack Segment Fault)", + "#GP (General Protection Fault)", + "#PF (Page Fault)", + "(Reserved - 15)", + "#MF (Math Fault x87)", + "#AC (Alignment Check)", + "#MC (Machine Check)", + "#XF (SIMD FP Exception)", + "(Reserved - 20)", + "(Reserved - 21)", + "(Reserved - 22)", + "(Reserved - 23)", + "(Reserved - 24)", + "(Reserved - 25)", + "(Reserved - 26)", + "(Reserved - 27)", + "(Reserved - 28)", + "(Reserved - 29)", + "(Reserved - 30)", + "(Reserved - 31)", + "USER 32", + "USER 33", + "USER 34", + "USER 35", + "USER 36", + "USER 37", + "USER 38", + "USER 39", + "USER 40", + "USER 41", + "USER 42", + "USER 43", + "USER 44", + "USER 45", + "USER 46", + "USER 47", + "USER 48", + "USER 49", + "USER 50", + "USER 51", + "USER 52", + "USER 53", + "USER 54", + "USER 55", + "USER 56", + "USER 57", + "USER 58", + "USER 59", + "USER 60", + "USER 61", + "USER 62", + "USER 63", + "USER 64", + "USER 65", + "USER 66", + "USER 67", + "USER 68", + "USER 69", + "USER 70", + "USER 71", + "USER 72", + "USER 73", + "USER 74", + "USER 75", + "USER 76", + "USER 77", + "USER 78", + "USER 79", + "USER 80", + "USER 81", + "USER 82", + "USER 83", + "USER 84", + "USER 85", + "USER 86", + "USER 87", + "USER 88", + "USER 89", + "USER 90", + "USER 91", + "USER 92", + "USER 93", + "USER 94", + "USER 95", + "USER 96", + "USER 97", + "USER 98", + "USER 99", + "USER 100", + "USER 101", + "USER 102", + "USER 103", + "USER 104", + "USER 105", + "USER 106", + "USER 107", + "USER 108", + "USER 109", + "USER 110", + "USER 111", + "USER 112", + "USER 113", + "USER 114", + "USER 115", + "USER 116", + "USER 117", + "USER 118", + "USER 119", + "USER 120", + "USER 121", + "USER 122", + "USER 123", + "USER 124", + "USER 125", + "USER 126", + "USER 127", + "USER 128", + "USER 129", + "USER 130", + "USER 131", + "USER 132", + "USER 133", + "USER 134", + "USER 135", + "USER 136", + "USER 137", + "USER 138", + "USER 139", + "USER 140", + "USER 141", + "USER 142", + "USER 143", + "USER 144", + "USER 145", + "USER 146", + "USER 147", + "USER 148", + "USER 149", + "USER 150", + "USER 151", + "USER 152", + "USER 153", + "USER 154", + "USER 155", + "USER 156", + "USER 157", + "USER 158", + "USER 159", + "USER 160", + "USER 161", + "USER 162", + "USER 163", + "USER 164", + "USER 165", + "USER 166", + "USER 167", + "USER 168", + "USER 169", + "USER 170", + "USER 171", + "USER 172", + "USER 173", + "USER 174", + "USER 175", + "USER 176", + "USER 177", + "USER 178", + "USER 179", + "USER 180", + "USER 181", + "USER 182", + "USER 183", + "USER 184", + "USER 185", + "USER 186", + "USER 187", + "USER 188", + "USER 189", + "USER 190", + "USER 191", + "USER 192", + "USER 193", + "USER 194", + "USER 195", + "USER 196", + "USER 197", + "USER 198", + "USER 199", + "USER 200", + "USER 201", + "USER 202", + "USER 203", + "USER 204", + "USER 205", + "USER 206", + "USER 207", + "USER 208", + "USER 209", + "USER 210", + "USER 211", + "USER 212", + "USER 213", + "USER 214", + "USER 215", + "USER 216", + "USER 217", + "USER 218", + "USER 219", + "USER 220", + "USER 221", + "USER 222", + "USER 223", + "USER 224", + "USER 225", + "USER 226", + "USER 227", + "USER 228", + "USER 229", + "USER 230", + "USER 231", + "USER 232", + "USER 233", + "USER 234", + "USER 235", + "USER 236", + "USER 237", + "USER 238", + "USER 239", + "USER 240", + "USER 241", + "USER 242", + "USER 243", + "USER 244", + "USER 245", + "USER 246", + "USER 247", + "USER 248", + "USER 249", + "USER 250", + "USER 251", + "USER 252", + "USER 253", + "USER 254", + "USER 255", +}; + +char *exception_type_names[] = { + "External Interrupt", + "NOT USED", + "NMI", + "Hardware Exception", + "NOT USED", + "NOT USED", + "Software Exception", + "NOT USED" +}; + + + + /* * A dummy interrupt handler function. * Ensures that the low-level interrupt code always @@ -33,15 +317,21 @@ ulong_t Get_Current_EFLAGS(void); static void Dummy_Interrupt_Handler(struct Interrupt_State* state) { Begin_IRQ(state); - - Print("Unexpected Interrupt! Ignoring!\n"); - SerialPrint("*** Unexpected interrupt! *** Ignoring!\n"); - Dump_Interrupt_State(state); - SerialPrint_VMCS_ALL(); - - End_IRQ(state); - // STOP(); + /* A "feature" of some chipsets is that if an interrupt is raised by mistake + * then its automatically assigned to IRQ 7(Int 39). + * Makes perfect sense... + * See: + * http://forums12.itrc.hp.com/service/forums/questionanswer.do?admit=109447627+1204759699215+28353475&threadId=1118488 + */ + if (state->intNum != 39) { + Print("Unexpected Interrupt! Ignoring!\n"); + SerialPrint("*** Unexpected interrupt! *** Ignoring!\n"); + Dump_Interrupt_State(state); + } + End_IRQ(state); + + //STOP(); } #if 0 @@ -82,6 +372,10 @@ void Init_Interrupts(void) Install_Interrupt_Handler(i, Dummy_Interrupt_Handler); } + /* JRL */ + // Disable_IRQ(7); + /* ** */ + /* Re-enable interrupts */ Enable_Interrupts(); } @@ -102,7 +396,7 @@ void Dump_Interrupt_State(struct Interrupt_State* state) { uint_t errorCode = state->errorCode; - SerialPrint("eax=%08x ebx=%08x ecx=%08x edx=%08x\n" + PrintBoth("eax=%08x ebx=%08x ecx=%08x edx=%08x\n" "esi=%08x edi=%08x ebp=%08x\n" "eip=%08x cs=%08x eflags=%08x\n" "Interrupt number=%d (%s), error code=%d\n" @@ -113,6 +407,8 @@ void Dump_Interrupt_State(struct Interrupt_State* state) state->intNum, exception_names[state->intNum], errorCode, errorCode >> 3, (errorCode >> 2) & 1, (errorCode >> 1) & 1, errorCode & 1 ); + + if (Is_User_Interrupt(state)) { struct User_Interrupt_State *ustate = (struct User_Interrupt_State*) state; SerialPrint("user esp=%08x, user ss=%08x\n", ustate->espUser, ustate->ssUser); @@ -122,4 +418,8 @@ void Dump_Interrupt_State(struct Interrupt_State* state) SerialPrint_Selector("es", state->es); SerialPrint_Selector("fs", state->fs); SerialPrint_Selector("gs", state->gs); + + + } +