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.


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