Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


new interrupt hooking mechanism
[palacios.git] / palacios / include / palacios / vmm_intr.h
1 #ifndef __VMM_INTR_H_
2 #define __VMM_INTR_H_
3
4 #include <palacios/vmm_intr.h>
5 #include <palacios/vmm_types.h>
6
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
26
27
28 typedef enum {INVALID_INTR, EXTERNAL_IRQ, NMI, EXCEPTION, SOFTWARE_INTR, VIRTUAL_INTR} intr_type_t;
29
30 struct guest_info;
31
32
33
34
35 /* We need a way to allow the APIC/PIC to decide when they are supposed to receive interrupts...
36  * Maybe a notification call when they have been turned on, to deliver irqs to them...
37  * We can rehook the guest raise_irq op, to the appropriate controller
38  */
39
40
41 struct vm_intr {
42
43   /* We need to rework the exception state, to handle stacking */
44   uint_t excp_pending;
45   uint_t excp_num;
46   uint_t excp_error_code_valid : 1;
47   uint_t excp_error_code;
48   
49   struct intr_ctrl_ops * controller;
50   void * controller_state;
51
52   /* some way to get the [A]PIC intr */
53
54 };
55
56
57
58 int v3_raise_irq(struct guest_info * info, int irq);
59 int hook_irq(struct guest_info * info, int irq);
60
61
62 struct vmm_intr_state;
63
64 int hook_irq_new(uint_t irq,
65                  void (*handler)(struct vmm_intr_state *state),
66                  void  *opaque);
67
68 int hook_irq_for_guest_injection(struct guest_info *info, int irq);
69
70
71 struct intr_ctrl_ops {
72   int (*intr_pending)(void * private_data);
73   int (*get_intr_number)(void * private_data);
74   int (*raise_intr)(void * private_data, int irq);
75   int (*begin_irq)(void * private_data, int irq);
76 };
77
78
79
80 void init_interrupt_state(struct guest_info * info);
81 void set_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * state);
82
83 int raise_exception(struct guest_info * info, uint_t excp);
84 int raise_exception_with_error(struct guest_info * info, uint_t excp, uint_t error_code);
85
86 int intr_pending(struct guest_info * info);
87 uint_t get_intr_number(struct guest_info * info);
88 intr_type_t get_intr_type(struct guest_info * info);
89
90 int injecting_intr(struct guest_info * info, uint_t intr_num, intr_type_t type);
91
92 /*
93 int start_irq(struct vm_intr * intr);
94 int end_irq(struct vm_intr * intr, int irq);
95 */
96 #endif