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.


reworked the interrupt injection to be guest specific
[palacios.git] / palacios / include / palacios / vmm_intr.h
1 /*
2  * This file is part of the Palacios Virtual Machine Monitor developed
3  * by the V3VEE Project with funding from the United States National 
4  * Science Foundation and the Department of Energy.  
5  *
6  * The V3VEE Project is a joint project between Northwestern University
7  * and the University of New Mexico.  You can find out more at 
8  * http://www.v3vee.org
9  *
10  * Copyright (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> 
11  * Copyright (c) 2008, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jarusl@cs.northwestern.edu>
15  *
16  * This is free software.  You are permitted to use,
17  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
18  */
19
20 #ifndef __VMM_INTR_H_
21 #define __VMM_INTR_H_
22
23
24 #ifdef __V3VEE__
25
26 #include <palacios/vmm_intr.h>
27 #include <palacios/vmm_types.h>
28
29
30 #define DE_EXCEPTION          0x00  
31 #define DB_EXCEPTION          0x01
32 #define NMI_EXCEPTION         0x02
33 #define BP_EXCEPTION          0x03
34 #define OF_EXCEPTION          0x04
35 #define BR_EXCEPTION          0x05
36 #define UD_EXCEPTION          0x06
37 #define NM_EXCEPTION          0x07
38 #define DF_EXCEPTION          0x08
39 #define TS_EXCEPTION          0x0a
40 #define NP_EXCEPTION          0x0b
41 #define SS_EXCEPTION          0x0c
42 #define GPF_EXCEPTION         0x0d
43 #define PF_EXCEPTION          0x0e
44 #define MF_EXCEPTION          0x10
45 #define AC_EXCEPTION          0x11
46 #define MC_EXCEPTION          0x12
47 #define XF_EXCEPTION          0x13
48 #define SX_EXCEPTION          0x1e
49
50
51 typedef enum {INVALID_INTR, EXTERNAL_IRQ, NMI, EXCEPTION, SOFTWARE_INTR, VIRTUAL_INTR} intr_type_t;
52
53 struct guest_info;
54 struct v3_interrupt;
55
56 /* We need a way to allow the APIC/PIC to decide when they are supposed to receive interrupts...
57  * Maybe a notification call when they have been turned on, to deliver irqs to them...
58  * We can rehook the guest raise_irq op, to the appropriate controller
59  */
60
61
62 struct v3_irq_hook {
63   int (*handler)(struct guest_info * info, struct v3_interrupt * intr, void * priv_data);
64   void * priv_data;
65 };
66
67
68 struct v3_intr_state {
69
70   /* We need to rework the exception state, to handle stacking */
71   uint_t excp_pending;
72   uint_t excp_num;
73   uint_t excp_error_code_valid : 1;
74   uint_t excp_error_code;
75   
76   struct intr_ctrl_ops * controller;
77   void * controller_state;
78
79   /* some way to get the [A]PIC intr */
80
81   struct v3_irq_hook * hooks[256];
82   
83 };
84
85
86
87 void init_interrupt_state(struct guest_info * info);
88
89
90 int v3_raise_irq(struct guest_info * info, int irq);
91
92 /*Zheng 07/30/2008*/
93 int v3_lower_irq(struct guest_info * info, int irq);
94
95
96 /*Zheng 07/30/2008*/
97
98 struct intr_ctrl_ops {
99   int (*intr_pending)(void * private_data);
100   int (*get_intr_number)(void * private_data);
101   int (*raise_intr)(void * private_data, int irq);
102   int (*lower_intr)(void * private_data, int irq);
103   int (*begin_irq)(void * private_data, int irq);
104 };
105
106
107
108
109 void set_intr_controller(struct guest_info * info, struct intr_ctrl_ops * ops, void * state);
110
111 int v3_raise_exception(struct guest_info * info, uint_t excp);
112 int v3_raise_exception_with_error(struct guest_info * info, uint_t excp, uint_t error_code);
113
114 int intr_pending(struct guest_info * info);
115 uint_t get_intr_number(struct guest_info * info);
116 intr_type_t get_intr_type(struct guest_info * info);
117
118 int injecting_intr(struct guest_info * info, uint_t intr_num, intr_type_t type);
119
120 /*
121 int start_irq(struct vm_intr * intr);
122 int end_irq(struct vm_intr * intr, int irq);
123 */
124
125
126
127 int v3_hook_irq(struct guest_info * info, 
128                 uint_t irq,
129                 int (*handler)(struct guest_info * info, struct v3_interrupt * intr, void * priv_data),
130                 void  * priv_data);
131
132 int v3_hook_passthrough_irq(struct guest_info *info, uint_t irq);
133
134
135
136 #endif // !__V3VEE__
137
138
139
140 #endif