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_TLB_SHOOTDOWN_IPI        (IVT_FREEBASE+0)
00068 #define VECTOR_WAKEUP_IPI               (IVT_FREEBASE+1)
00069 #define VECTOR_DEBUG_IPI                (IVT_FREEBASE+2)
00070 
00072 struct istate {
00073         __u64 rax;
00074         __u64 rbx;
00075         __u64 rcx;
00076         __u64 rdx;
00077         __u64 rsi;
00078         __u64 rdi;
00079         __u64 r8;
00080         __u64 r9;
00081         __u64 r10;
00082         __u64 r11;
00083         __u64 r12;
00084         __u64 r13;
00085         __u64 r14;
00086         __u64 r15;
00087         __u64 rbp;
00088         __u64 error_word;
00089         __u64 rip;
00090         __u64 cs;
00091         __u64 rflags;
00092         __u64 stack[]; /* Additional data on stack */
00093 };
00094 
00096 static inline int istate_from_uspace(istate_t *istate)
00097 {
00098         return !(istate->rip & 0x8000000000000000);
00099 }
00100 
00101 static inline void istate_set_retaddr(istate_t *istate, __address retaddr)
00102 {
00103         istate->rip = retaddr;
00104 }
00105 static inline __native istate_get_pc(istate_t *istate)
00106 {
00107         return istate->rip;
00108 }
00109 
00110 extern void (* disable_irqs_function)(__u16 irqmask);
00111 extern void (* enable_irqs_function)(__u16 irqmask);
00112 extern void (* eoi_function)(void);
00113 
00114 extern void print_info_errcode(int n, istate_t *istate);
00115 extern void null_interrupt(int n, istate_t *istate);
00116 extern void gp_fault(int n, istate_t *istate);
00117 extern void nm_fault(int n, istate_t *istate);
00118 extern void ss_fault(int n, istate_t *istate);
00119 extern void page_fault(int n, istate_t *istate);
00120 extern void syscall(int n, istate_t *istate);
00121 extern void tlb_shootdown_ipi(int n, istate_t *istate);
00122 
00123 extern void trap_virtual_enable_irqs(__u16 irqmask);
00124 extern void trap_virtual_disable_irqs(__u16 irqmask);
00125 extern void trap_virtual_eoi(void);
00126 /* AMD64 - specific page handler */
00127 extern void ident_page_fault(int n, istate_t *istate);
00128 
00129 #endif
00130 

Generated on Sun Jun 18 16:26:57 2006 for HelenOS Kernel (amd64) by  doxygen 1.4.6