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.


3af8cfe8cd95f159a34db719e2a4504b08a17a55
[palacios.git] / palacios / include / extensions / tm_util.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:  Maciek Swiech <dotpyfe@u.northwestern.edu>
15  *          Marcel Flores <marcel-flores@u.northwestern.edu>
16  *          Zachary Bischof <zbischof@u.northwestern.edu>
17  *          Kyle C. Hale <kh@u.northwestern.edu>
18  *
19  * This is free software.  You are permitted to use,
20  * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
21  */
22
23 #ifndef __TM_UTIL_H
24 #define __TM_UTIL_H
25
26 // new printing macros
27 // used like TM_ERR(core, ABORT, "couldnt wangle the dangle");
28
29 #define TM_ERR(core, label, msg, ...) \
30     do {                              \
31         typeof (core) _core = (core);  \
32         PrintError(_core->vm_info, _core, "TM %10s | " msg , #label, ##__VA_ARGS__); \
33     } while (0);
34
35 #define TM_DBG(core, label, msg, ...) \
36     do {                              \
37         typeof (core) _core = (core);  \
38         PrintDebug(_core->vm_info, _core, "TM %10s | " msg , #label, ##__VA_ARGS__); \
39     } while (0);
40
41 struct mem_op {
42     addr_t   guest_addr;
43     uint64_t data;
44     int      current;
45
46     struct list_head op_node;
47 };
48
49 void v3_clear_tm_lists(struct v3_trans_mem * tm);
50
51 // note memory location touched in the list, avoids duplicate creation
52 int add_mem_op_to_list(struct list_head * list, addr_t guest_addr);
53
54 // searches for address in the list, returns pointer to elt if found, null
55 struct mem_op * list_contains_guest_addr(struct list_head * list, addr_t guest_addr);
56
57 // checks for current = 0 in list, updates to new value from staging page
58 int update_list(struct v3_trans_mem * tm, struct list_head * list);
59
60 // writes value to staging page, sets current = 0
61 int stage_entry(struct v3_trans_mem * tm, struct list_head * list, addr_t guest_addr);
62
63 // adds entry to list if it doesnt exist, used in copying
64 int copy_add_entry(struct list_head * list, addr_t guest_addr, uint64_t data);
65
66 // if TM block succesfully finishes, commits the list
67 int commit_list(struct guest_info * core, struct v3_trans_mem * tm);
68
69 // copy other lists to core's global lists
70 int v3_copy_lists(struct guest_info *core);
71
72 // set TM_MODE to TM_ON
73 int v3_set_tm(struct v3_trans_mem * tm);
74
75 // set TM_MODE to TM_OFF, clear data structures
76 int v3_clr_tm(struct v3_trans_mem * tm);
77
78 // clear the vtlb on a core
79 int v3_clr_vtlb(struct guest_info *core);
80
81 // set TM_STATE to TM_ABORT
82 int v3_tm_set_abrt(struct v3_trans_mem * tm);
83
84 // free the staging page of the core
85 int v3_free_staging_page(struct v3_trans_mem * tm);
86
87 #endif