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.
6 * The V3VEE Project is a joint project between Northwestern University
7 * and the University of New Mexico. You can find out more at
10 * Copyright (c) 2012, NWU EECS 441 Transactional Memory Team
11 * Copyright (c) 2012, The V3VEE Project <http://www.v3vee.org>
12 * All rights reserved.
14 * Author: Maciek Swiech <dotpyfe@u.northwestern.edu>
15 * Kyle Hale <kh@u.northwestern.edu>
17 * This is free software. You are permitted to use,
18 * redistribute, and modify it as specified in the file "V3VEE_LICENSE".
22 #ifndef __TM_CACHE_H__
23 #define __TM_CACHE_H__
42 // one record in the redo log linked list
48 struct list_head rec_node;
52 uint8_t m : 1; // modified
53 uint8_t e : 1; // exclusive
54 uint8_t s : 1; // shared
55 uint8_t i : 1; // exclusive
58 } __attribute__((packed));
62 struct flag_bits * flag;;
66 uint64_t line_size; // line size in bytes
67 uint64_t size; // cache size in kb
69 uint64_t associativity;
70 enum cache_policy policy;
73 // cache hardware we are emulating
75 int (*init) (struct cache_spec * spec, struct cache_box * self);
76 struct cache_spec * spec;
77 struct cache_line ** cache_table;
79 enum TM_ERR_E (*read) (struct guest_info *core, addr_t hva, addr_t len, struct cache_box * self);
80 enum TM_ERR_E (*write) (struct guest_info *core, addr_t hva, addr_t len, struct cache_box * self);
81 uint64_t (*invalidate) (struct guest_info *core, addr_t hva, addr_t len, struct cache_box * self);
85 // TODO: dont need this anymore?
89 struct cache_box *model;
92 uint64_t num_trans_active;
94 enum TM_ERR_E (*read) (struct guest_info *core, addr_t hva, addr_t len);
95 enum TM_ERR_E (*write) (struct guest_info *core, addr_t hva, addr_t len);
101 * error = handle_start_tx(logger,vcorenum);
102 * error = handle_abort(logger,vcorenum);
103 * error = handle_commit(logger,vcorenum);
105 * should_abort = handle_write(logger, vcorenum, physaddr, data, datalen);
106 * should_abort = handle_read(logger, vcorenum, physaddr, *data, datalen);
112 * handle_start_tx(logger,vcorenum) {
113 * logger.record(BEGIN,vcorenum)
116 * handle_abort(logger,vcorenum) {
117 * logger.record(ABORT,vcorenum)
120 * handle_commit(logger,vcorenum) {
121 * logger.record(END,vcorenum)
122 * logger.commit(vcorenum)
125 * record(head,type,vcorenum,physaddr,datalen,data) {
126 * new rec = {type, vcorenum, physaddr, datalen, data,head}
128 * err = conflict_check(head,vcorenum)
131 * read(logger,core,addr,*data,datalen) {
132 * logger.record(READ,vcorenum)
134 * // hmm, we want the most recent entry, should we keep track of tail as
135 * // well?? or just keep a seperate log of current values?
138 * if cur->addr == addr
148 * write(logger,core,addr,data,datalen) {
149 * logger.record(WRITE,vcorenum,data)
154 #endif // ! __V3VEE__