interrupt.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2004 Jakub Jermar
00003  * All rights reserved.
00004  *
00005  * Redistribution and use in source and binary forms, with or without
00006  * modification, are permitted provided that the following conditions
00007  * are met:
00008  *
00009  * - Redistributions of source code must retain the above copyright
00010  *   notice, this list of conditions and the following disclaimer.
00011  * - Redistributions in binary form must reproduce the above copyright
00012  *   notice, this list of conditions and the following disclaimer in the
00013  *   documentation and/or other materials provided with the distribution.
00014  * - The name of the author may not be used to endorse or promote products
00015  *   derived from this software without specific prior written permission.
00016  *
00017  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
00018  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
00019  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
00020  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
00021  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
00022  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
00023  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
00024  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00025  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
00026  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00027  */
00028 
00035 #ifndef __ia32_INTERRUPT_H__
00036 #define __ia32_INTERRUPT_H__
00037 
00038 #include <arch/types.h>
00039 #include <arch/pm.h>
00040 
00041 #define IVT_ITEMS               IDT_ITEMS
00042 
00043 #define EXC_COUNT       32
00044 #define IRQ_COUNT       16
00045 
00046 #define IVT_EXCBASE             0
00047 #define IVT_IRQBASE             (IVT_EXCBASE+EXC_COUNT)
00048 #define IVT_FREEBASE            (IVT_IRQBASE+IRQ_COUNT)
00049 
00050 #define IRQ_CLK         0
00051 #define IRQ_KBD         1
00052 #define IRQ_PIC1        2
00053 #define IRQ_PIC_SPUR    7
00054 
00055 /* this one must have four least significant bits set to ones */
00056 #define VECTOR_APIC_SPUR        (IVT_ITEMS-1)
00057 
00058 #if (((VECTOR_APIC_SPUR + 1)%16) || VECTOR_APIC_SPUR >= IVT_ITEMS)
00059 #error Wrong definition of VECTOR_APIC_SPUR
00060 #endif
00061 
00062 #define VECTOR_DEBUG            1
00063 #define VECTOR_PIC_SPUR         (IVT_IRQBASE+IRQ_PIC_SPUR)
00064 #define VECTOR_CLK              (IVT_IRQBASE+IRQ_CLK)
00065 #define VECTOR_KBD              (IVT_IRQBASE+IRQ_KBD)
00066 
00067 #define VECTOR_SYSCALL                  (IVT_FREEBASE+0)
00068 #define VECTOR_TLB_SHOOTDOWN_IPI        (IVT_FREEBASE+1)
00069 #define VECTOR_DEBUG_IPI                (IVT_FREEBASE+2)
00070 
00071 struct istate {
00072         __u32 eax;
00073         __u32 ecx;
00074         __u32 edx;
00075         __u32 esi;
00076         __u32 edi;
00077         __u32 ebp;
00078         __u32 ebx;
00079 
00080         __u32 gs;
00081         __u32 fs;
00082         __u32 es;
00083         __u32 ds;
00084 
00085         __u32 error_word;
00086         __u32 eip;
00087         __u32 cs;
00088         __u32 eflags;
00089         __u32 stack[];
00090 };
00091 
00093 static inline int istate_from_uspace(istate_t *istate)
00094 {
00095         return !(istate->eip & 0x80000000);
00096 }
00097 
00098 static inline void istate_set_retaddr(istate_t *istate, __address retaddr)
00099 {
00100         istate->eip = retaddr;
00101 }
00102 
00103 static inline __native istate_get_pc(istate_t *istate)
00104 {
00105         return istate->eip;
00106 }
00107 
00108 extern void (* disable_irqs_function)(__u16 irqmask);
00109 extern void (* enable_irqs_function)(__u16 irqmask);
00110 extern void (* eoi_function)(void);
00111 
00112 extern void PRINT_INFO_ERRCODE(istate_t *istate);
00113 extern void null_interrupt(int n, istate_t *istate);
00114 extern void gp_fault(int n, istate_t *istate);
00115 extern void nm_fault(int n, istate_t *istate);
00116 extern void ss_fault(int n, istate_t *istate);
00117 extern void simd_fp_exception(int n, istate_t *istate);
00118 extern void syscall(int n, istate_t *istate);
00119 extern void tlb_shootdown_ipi(int n, istate_t *istate);
00120 
00121 extern void trap_virtual_enable_irqs(__u16 irqmask);
00122 extern void trap_virtual_disable_irqs(__u16 irqmask);
00123 extern void trap_virtual_eoi(void);
00124 
00125 #endif
00126 

Generated on Sun Jun 18 16:38:51 2006 for HelenOS Kernel (ia32) by  doxygen 1.4.6