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.


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