Main Page | Data Structures | File List | Globals | Related Pages

interrupt.h

Go to the documentation of this file.
00001 
00011 #ifndef __KERN_INTERRUPT_H__
00012 #define __KERN_INTERRUPT_H__
00013 
00014 #include <list.h>
00015 #include <register.h>
00016 
00017 /* the size of the stack used for handling interrupts */
00018 #define INTERRUPT_STACK_SIZE (16 * 1024)
00019 
00020 /* the size in bytes of each interrupt stub */
00021 #define INTERRUPT_STUB_SIZE 16
00022 
00023 /* the code for an individual interrupt stub */
00024 typedef char InterruptStub [16];
00025 
00026 /* the array of interrupt stubs to be installed into the IDT */
00027 extern InterruptStub interrupt_stubs [];
00028 
00029 /* the interrupt vector of the first exception */
00030 #define INTERRUPT_VECTOR_EXCEPTIONS 0
00031 /* the interrupt vector of the first hardware interrupt */
00032 #define INTERRUPT_VECTOR_INTERRUPTS 32
00033 /* the interrupt vector of the first software trap */
00034 #define INTERRUPT_VECTOR_TRAPS 48
00035 /* the number of the maximum interrupt */
00036 #define INTERRUPT_VECTOR_MAXIMUM 99
00037 
00038 typedef unsigned int InterruptVector;
00039 
00040 typedef void (* InterruptHandlerFunction) (InterruptVector, Registers *);
00041 
00042 /* a handler for an interrupt */
00043 typedef struct
00044 {
00045         /* the position of the handler in the handler list */
00046         ListNode interruptHandlerList;
00047         /* a function to be invoked when the interrupt is signaled */
00048         InterruptHandlerFunction handlerFunction;
00049         /* the vector of the interrupt to wait for */
00050         InterruptVector interruptVector;
00051 } InterruptHandler;
00052 
00053 typedef unsigned int ExceptionVector;
00054 typedef unsigned int ExceptionData;
00055 
00056 typedef void (* ExceptionHandlerFunction) (ExceptionVector, ExceptionData, Registers *);
00057 
00058 /* a handler for an exception interrupt */
00059 typedef struct
00060 {
00061         /* the position of the handler in the handler list */
00062         ListNode exceptionHandlerList;
00063         /* a function to be invoked when the exception is raised */
00064         ExceptionHandlerFunction handlerFunction;
00065         /* the vector of the exception to wait for */
00066         ExceptionVector exceptionVector;
00067 } ExceptionHandler;
00068 
00076 extern int interrupt_dispatcher_initialize (void);
00077 
00088 extern InterruptHandler * interrupt_handler_create (InterruptVector vector, InterruptHandlerFunction handler);
00097 extern void interrupt_handler_destroy (InterruptHandler * handler);
00108 extern ExceptionHandler * exception_handler_create (ExceptionVector vector, ExceptionHandlerFunction handler);
00117 extern void exception_handler_destroy (ExceptionHandler * handler);
00118 
00125 extern void interrupt_wait (void);
00126 
00127 #endif /* __KERN_INTERRUPT_H__ */
00128 

Generated on Fri Apr 9 21:59:16 2004 for 15-410 Project 3 by doxygen 1.3.2