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.


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