Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/arch/amd64/include/interrupt.h

    rc0e9f3f r304342e  
    3636#define KERN_amd64_INTERRUPT_H_
    3737
    38 #include <typedefs.h>
     38#include <arch/types.h>
    3939#include <arch/pm.h>
    40 #include <trace.h>
    4140
    42 #define IVT_ITEMS  IDT_ITEMS
    43 #define IVT_FIRST  0
     41#define IVT_ITEMS               IDT_ITEMS
     42#define IVT_FIRST               0
    4443
    45 #define EXC_COUNT  32
    46 #define IRQ_COUNT  16
     44#define EXC_COUNT               32
     45#define IRQ_COUNT               16
    4746
    48 #define IVT_EXCBASE   0
    49 #define IVT_IRQBASE   (IVT_EXCBASE + EXC_COUNT)
    50 #define IVT_FREEBASE  (IVT_IRQBASE + IRQ_COUNT)
     47#define IVT_EXCBASE             0
     48#define IVT_IRQBASE             (IVT_EXCBASE + EXC_COUNT)
     49#define IVT_FREEBASE            (IVT_IRQBASE + IRQ_COUNT)
    5150
    52 #define IRQ_CLK       0
    53 #define IRQ_KBD       1
    54 #define IRQ_PIC1      2
    55 #define IRQ_PIC_SPUR  7
    56 #define IRQ_MOUSE     12
    57 #define IRQ_DP8390    9
     51#define IRQ_CLK                 0
     52#define IRQ_KBD                 1
     53#define IRQ_PIC1                2
     54#define IRQ_PIC_SPUR            7
     55#define IRQ_MOUSE               12
    5856
    59 /* This one must have four least significant bits set to ones */
    60 #define VECTOR_APIC_SPUR  (IVT_ITEMS - 1)
     57/* this one must have four least significant bits set to ones */
     58#define VECTOR_APIC_SPUR        (IVT_ITEMS - 1)
    6159
    6260#if (((VECTOR_APIC_SPUR + 1) % 16) || VECTOR_APIC_SPUR >= IVT_ITEMS)
     
    6462#endif
    6563
    66 #define VECTOR_DEBUG              1
    67 #define VECTOR_CLK                (IVT_IRQBASE + IRQ_CLK)
    68 #define VECTOR_PIC_SPUR           (IVT_IRQBASE + IRQ_PIC_SPUR)
    69 #define VECTOR_SYSCALL            IVT_FREEBASE
    70 #define VECTOR_TLB_SHOOTDOWN_IPI  (IVT_FREEBASE + 1)
    71 #define VECTOR_DEBUG_IPI          (IVT_FREEBASE + 2)
     64#define VECTOR_DEBUG                    1
     65#define VECTOR_CLK                      (IVT_IRQBASE + IRQ_CLK)
     66#define VECTOR_PIC_SPUR                 (IVT_IRQBASE + IRQ_PIC_SPUR)
     67#define VECTOR_SYSCALL                  IVT_FREEBASE
     68#define VECTOR_TLB_SHOOTDOWN_IPI        (IVT_FREEBASE + 1)
     69#define VECTOR_DEBUG_IPI                (IVT_FREEBASE + 2)
    7270
    7371/** This is passed to interrupt handlers */
    7472typedef struct istate {
    7573        uint64_t rax;
    76         uint64_t rbx;
    7774        uint64_t rcx;
    7875        uint64_t rdx;
    7976        uint64_t rsi;
    8077        uint64_t rdi;
    81         uint64_t rbp;
    8278        uint64_t r8;
    8379        uint64_t r9;
    8480        uint64_t r10;
    8581        uint64_t r11;
    86         uint64_t r12;
    87         uint64_t r13;
    88         uint64_t r14;
    89         uint64_t r15;
    90         uint64_t alignment;     /* align rbp_frame on multiple of 16 */
    91         uint64_t rbp_frame;     /* imitation of frame pointer linkage */
    92         uint64_t rip_frame;     /* imitation of return address linkage */
    93         uint64_t error_word;    /* real or fake error word */
     82        uint64_t rbp;
     83        uint64_t error_word;
    9484        uint64_t rip;
    9585        uint64_t cs;
    9686        uint64_t rflags;
    97         uint64_t rsp;           /* only if istate_t is from uspace */
    98         uint64_t ss;            /* only if istate_t is from uspace */
     87        uint64_t stack[]; /* Additional data on stack */
    9988} istate_t;
    10089
    10190/** Return true if exception happened while in userspace */
    102 NO_TRACE static inline int istate_from_uspace(istate_t *istate)
     91static inline int istate_from_uspace(istate_t *istate)
    10392{
    10493        return !(istate->rip & 0x8000000000000000);
    10594}
    10695
    107 NO_TRACE static inline void istate_set_retaddr(istate_t *istate,
    108     uintptr_t retaddr)
     96static inline void istate_set_retaddr(istate_t *istate, uintptr_t retaddr)
    10997{
    11098        istate->rip = retaddr;
    11199}
    112 
    113 NO_TRACE static inline unative_t istate_get_pc(istate_t *istate)
     100static inline unative_t istate_get_pc(istate_t *istate)
    114101{
    115102        return istate->rip;
    116103}
    117 
    118 NO_TRACE static inline unative_t istate_get_fp(istate_t *istate)
     104static inline unative_t istate_get_fp(istate_t *istate)
    119105{
    120106        return istate->rbp;
    121107}
    122108
    123 extern void (* disable_irqs_function)(uint16_t);
    124 extern void (* enable_irqs_function)(uint16_t);
     109extern void (* disable_irqs_function)(uint16_t irqmask);
     110extern void (* enable_irqs_function)(uint16_t irqmask);
    125111extern void (* eoi_function)(void);
    126112
     113extern void decode_istate(int n, istate_t *istate);
    127114extern void interrupt_init(void);
    128 extern void trap_virtual_enable_irqs(uint16_t);
    129 extern void trap_virtual_disable_irqs(uint16_t);
     115extern void trap_virtual_enable_irqs(uint16_t irqmask);
     116extern void trap_virtual_disable_irqs(uint16_t irqmask);
     117/* AMD64 - specific page handler */
     118extern void ident_page_fault(int n, istate_t *istate);
    130119
    131120#endif
Note: See TracChangeset for help on using the changeset viewer.