00001
00011 #ifndef __KERN_INTERRUPT_H__
00012 #define __KERN_INTERRUPT_H__
00013
00014 #include <list.h>
00015 #include <register.h>
00016
00017
00018 #define INTERRUPT_STACK_SIZE (16 * 1024)
00019
00020
00021 #define INTERRUPT_STUB_SIZE 16
00022
00023
00024 typedef char InterruptStub [16];
00025
00026
00027 extern InterruptStub interrupt_stubs [];
00028
00029
00030 #define INTERRUPT_VECTOR_EXCEPTIONS 0
00031
00032 #define INTERRUPT_VECTOR_INTERRUPTS 32
00033
00034 #define INTERRUPT_VECTOR_TRAPS 48
00035
00036 #define INTERRUPT_VECTOR_MAXIMUM 99
00037
00038 typedef unsigned int InterruptVector;
00039
00040 typedef void (* InterruptHandlerFunction) (InterruptVector, Registers *);
00041
00042
00043 typedef struct
00044 {
00045
00046 ListNode interruptHandlerList;
00047
00048 InterruptHandlerFunction handlerFunction;
00049
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
00059 typedef struct
00060 {
00061
00062 ListNode exceptionHandlerList;
00063
00064 ExceptionHandlerFunction handlerFunction;
00065
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
00128