-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtm_init.cpp
120 lines (99 loc) · 2.63 KB
/
tm_init.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#include "tm_init.h"
#include "tm_global.h"
#include "controller.h"
#include <stdio.h>
#include <cassert>
void init_controller(int num_cpus)
{
global_controller = new Controller(num_cpus);
}
void begin_transaction()
{
assert(global_controller != NULL);
global_controller->BeginTransaction();
}
/*void begin_transaction_pc(logical_address_t pc)
{
assert(global_controller != NULL);
global_controller->BeginTransactionPC(pc);
}*/
void commit_transaction()
{
assert(global_controller != NULL);
global_controller->CommitTransaction();
}
void abort_transaction()
{
assert(global_controller != NULL);
global_controller->AbortTransaction();
}
void resume_transaction()
{
assert(global_controller != NULL);
global_controller->ResumeTransaction();
}
void disable_interrupts()
{
assert(global_controller != NULL);
global_controller->DisableInterrupts();
}
void enable_interrupts()
{
assert(global_controller != NULL);
global_controller->EnableInterrupts();
}
void early_release(int var)
{
assert(global_controller != NULL);
global_controller->EarlyRelease(var);
}
int memory_operation(generic_transaction_t *mop)
{
assert(global_controller != NULL);
return global_controller->MemoryOperation(mop);
}
int memory_observe(generic_transaction_t *mop)
{
assert(global_controller != NULL);
return global_controller->MemoryObserve(mop);
}
int in_transaction(int cpu)
{
assert(global_controller != NULL);
return global_controller->InTransaction(cpu) == true ? 1 : 0;
}
int in_exception(int cpu)
{
assert(global_controller != NULL);
return global_controller->InException(cpu) == true ? 1 : 0;
}
int handling_exception(int cpu, int exception)
{
assert(global_controller != NULL);
return global_controller->handlingException(cpu, exception);
}
int clearing_exception(int cpu, int exception)
{
assert(global_controller != NULL);
return global_controller->clearingException(cpu, exception);
}
void dump_stats()
{
assert(global_controller != NULL);
global_controller->DumpStats();
}
void begin_transaction_idx(conf_object_t* obj, lang_void* data) {
assert(global_controller != NULL);
global_controller->BeginTransactionIdx(SIM_get_processor_number(obj));
}
void abort_transaction_idx(conf_object_t* obj, lang_void* data) {
assert(global_controller != NULL);
global_controller->AbortTransactionIdx(SIM_get_processor_number(obj));
}
void commit_transaction_idx(conf_object_t* obj, lang_void* data) {
assert(global_controller != NULL);
global_controller->CommitTransactionIdx(SIM_get_processor_number(obj));
}
void undo() {
printf("Undo called!\n");
}