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.


source code clean up,
[palacios.git] / palacios / include / palacios / vmm_intr.h
1 #ifndef __VMM_INTR_H_
2 #define __VMM_INTR_H_
3
4
5 #ifdef __V3VEE__
6
7 #include <palacios/vmm_intr.h>
8 #include <palacios/vmm_types.h>
9
10 #define DE_EXCEPTION          0x00  
11 #define DB_EXCEPTION          0x01
12 #define NMI_EXCEPTION         0x02
13 #define BP_EXCEPTION          0x03
14 #define OF_EXCEPTION          0x04
15 #define BR_EXCEPTION          0x05
16 #define UD_EXCEPTION          0x06
17 #define NM_EXCEPTION          0x07
18 #define DF_EXCEPTION          0x08
19 #define TS_EXCEPTION          0x0a
20 #define NP_EXCEPTION          0x0b
21 #define SS_EXCEPTION          0x0c
22 #define GPF_EXCEPTION         0x0d
23 #define PF_EXCEPTION          0x0e
24 #define MF_EXCEPTION          0x10
25 #define AC_EXCEPTION          0x11
26 #define MC_EXCEPTION          0x12
27 #define XF_EXCEPTION          0x13
28 #define SX_EXCEPTION          0x1e
29
30
31 typedef enum {INVALID_INTR, EXTERNAL_IRQ, NMI, EXCEPTION, SOFTWARE_INTR, VIRTUAL_INTR} intr_type_t;
32
33 struct guest_info;
34
35
36
37
38
39
40
41
42 int v3_raise_irq(struct guest_info * info, int irq);
43
44
45 struct intr_ctrl_ops {
46   int (*intr_pending)(void * private_data);
47   int (*get_intr_number)(void * private_data);
48   int (*raise_intr)(void * private_data, int irq);
49   int (*begin_irq)(void * private_data, int irq);
50 };
51
52
53
54
55 void set_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * state);
56
57 int v3_raise_exception(struct guest_info * info, uint_t excp);
58 int v3_raise_exception_with_error(struct guest_info * info, uint_t excp, uint_t error_code);
59
60 int intr_pending(struct guest_info * info);
61 uint_t get_intr_number(struct guest_info * info);
62 intr_type_t get_intr_type(struct guest_info * info);
63
64 int injecting_intr(struct guest_info * info, uint_t intr_num, intr_type_t type);
65
66 /*
67 int start_irq(struct vm_intr * intr);
68 int end_irq(struct vm_intr * intr, int irq);
69 */
70
71 #endif // !__V3VEE__
72
73
74
75 void init_interrupt_state(struct guest_info * info);
76
77 /* We need a way to allow the APIC/PIC to decide when they are supposed to receive interrupts...
78  * Maybe a notification call when they have been turned on, to deliver irqs to them...
79  * We can rehook the guest raise_irq op, to the appropriate controller
80  */
81
82
83 struct vm_intr {
84
85   /* We need to rework the exception state, to handle stacking */
86   uint_t excp_pending;
87   uint_t excp_num;
88   uint_t excp_error_code_valid : 1;
89   uint_t excp_error_code;
90   
91   struct intr_ctrl_ops * controller;
92   void * controller_state;
93
94   /* some way to get the [A]PIC intr */
95
96 };
97
98
99 struct vmm_intr_state;
100
101 int v3_hook_irq(uint_t irq,
102                  void (*handler)(struct vmm_intr_state *state),
103                  void  *opaque);
104
105 int v3_hook_irq_for_guest_injection(struct guest_info *info, int irq);
106
107
108 #endif