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.


614ceca6dd81033d759a198374d3fe0f6f3b1921
[palacios.git] / palacios / src / palacios / vmm_barrier.c
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) 2011, Jack Lange <jacklange@cs.pitt.edu> 
11  * Copyright (c) 2011, The V3VEE Project <http://www.v3vee.org> 
12  * All rights reserved.
13  *
14  * Author: Jack Lange <jacklangel@cs.pitt.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
21 #include <util/vmm_barrier.h>
22
23
24
25 int v3_init_barrier(struct v3_barrier * barrier) {
26     memset(barrier, 0, sizeof(struct v3_barrier));
27     v3_lock_init(&(barrier->lock));
28
29     return 0;
30 }
31
32
33 int v3_activate_barrier(struct guest_info * core, struct v3_barrier * barrier) {
34     addr_t flag;
35     int acquired = 0;
36     
37     flag = v3_lock_irqsave(barrier->lock);
38
39     if (barrier->active == 0) {
40         barrier->active = 1;
41         acquired = 1;
42     }
43
44     v3_unlock_irqrestore(barrier->lock, flag);
45
46     if (acquired == 0) {
47         return -1;
48     }
49
50
51     // wait for barrier catch
52
53
54     return 0;
55 }
56
57
58
59
60 int v3_deactivate_barrier(struct v3_barrier * barrier) {
61
62 }
63
64
65 int v3_check_barrier(struct guest_info * core, struct v3_barrier * barrier) {
66
67     if (barrier->activated == 0) {
68         return 0;
69     }
70     
71     // set cpu bit
72
73     // wait for cpu bit to clear
74
75 }