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.


modified copyright tags
[palacios.git] / palacios / src / palacios / svm_halt.c
1 /* (c) 2008, Peter Dinda <pdinda@northwestern.edu> */
2 /* (c) 2008, Jack Lange <jarusl@cs.northwestern.edu> */
3 /* (c) 2008, The V3VEE Project <http://www.v3vee.org> */
4
5
6 #include <palacios/svm_halt.h>
7 #include <palacios/vmm_intr.h>
8 // From GeekOS
9 void Yield(void);
10
11
12 //
13 // This should trigger a #GP if cpl!=0, otherwise, yield to host
14 //
15
16 int handle_svm_halt(struct guest_info * info)
17 {
18   if (info->cpl!=0) { 
19     v3_raise_exception(info, GPF_EXCEPTION);
20   } else {
21     
22     // What we should do is starting waiting on an OS event that will
23     // result in an injection of an interrupt.
24     
25     // What we will hackishly do instead is resume on any event
26     // Plus is this totally GeekOS specific
27     
28     ullong_t yield_start = 0;
29     ullong_t yield_stop = 0;
30     uint32_t gap = 0;
31     
32     PrintDebug("GeekOS Yield\n");
33     
34     rdtscll(yield_start);
35     Yield();
36     rdtscll(yield_stop);
37     
38     
39     //v3_update_time(info, yield_stop - yield_start);
40     gap = yield_stop - yield_start;
41     v3_raise_irq(info, 0);
42     
43     PrintDebug("GeekOS Yield Done (%d cycles)\n", gap);
44     
45     info->rip+=1;
46   }
47     
48   return 0;
49
50 }