4 #include <palacios/vmm_intr.h>
5 #include <palacios/vmm_types.h>
7 #define DE_EXCEPTION 0x00
8 #define DB_EXCEPTION 0x01
9 #define NMI_EXCEPTION 0x02
10 #define BP_EXCEPTION 0x03
11 #define OF_EXCEPTION 0x04
12 #define BR_EXCEPTION 0x05
13 #define UD_EXCEPTION 0x06
14 #define NM_EXCEPTION 0x07
15 #define DF_EXCEPTION 0x08
16 #define TS_EXCEPTION 0x0a
17 #define NP_EXCEPTION 0x0b
18 #define SS_EXCEPTION 0x0c
19 #define GPF_EXCEPTION 0x0d
20 #define PF_EXCEPTION 0x0e
21 #define MF_EXCEPTION 0x10
22 #define AC_EXCEPTION 0x11
23 #define MC_EXCEPTION 0x12
24 #define XF_EXCEPTION 0x13
25 #define SX_EXCEPTION 0x1e
28 typedef enum {INVALID_INTR, EXTERNAL_IRQ, NMI, EXCEPTION, SOFTWARE, VIRTUAL} intr_types_t;
35 uint_t excp_error_code;
37 struct intr_ctrl_ops * controller;
38 void * controller_state;
40 /* some way to get the [A]PIC intr */
45 int raise_irq(struct guest_info * info, int irq, int error_code);
46 int hook_irq(struct guest_info * info, int irq);
48 struct intr_ctrl_ops {
49 int (*intr_pending)(void * private_data);
50 int (*get_intr_number)(void * private_data);
51 int (*raise_intr)(void * private_data, int irq, int error_code);
52 int (*begin_irq)(void * private_data, int irq);
57 void init_interrupt_state(struct guest_info * info);
58 void set_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * state);
60 int raise_exception(struct guest_info * info, uint_t excp);
62 int intr_pending(struct vm_intr * intr);
63 uint_t get_intr_number(struct vm_intr * intr);
64 intr_types_t get_intr_type(struct vm_intr * intr);
67 int start_irq(struct vm_intr * intr);
68 int end_irq(struct vm_intr * intr, int irq);