MCPcopy Create free account
hub / github.com/MultiFuzz/MultiFuzz / rem_timer

Function rem_timer

icicle-cortexm/fuzzware-native/timer.c:117–152  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

115}
116
117uc_err rem_timer(uc_engine *uc, uint32_t id) {
118 struct TimerState* timers = &uc->fw->timers;
119
120 // Catch bugs from the other side
121 if(id >= MAX_TIMERS) {
122 perror("[TIMER ERROR] rem_timer: Too high id passed\n");
123 exit(-1);
124 } else if(!timers->timers[id].in_use) {
125 perror("[TIMER ERROR] rem_timer: Unused timer to be removed\n");
126 exit(-1);
127 }
128
129 #ifdef DEBUG_TIMER
130 printf("[TIMER] rem_timer(%d)\n", id); fflush(stdout);
131 #endif
132
133 if(timers->timers[id].is_active) {
134 stop_timer(uc, id);
135 }
136
137 memset(&timers->timers[id], 0, sizeof(timers->timers[id]));
138
139 // Delete tail entries if we can
140 while(id != -1 && id == timers->end_ind-1) {
141 if(timers->timers[id].in_use) {
142 break;
143 } else {
144 --id;
145 --timers->end_ind;
146 }
147 }
148
149 --timers->num_inuse;
150
151 return UC_ERR_OK;
152}
153
154static void insert_active_timer(uc_engine *uc, struct Timer *tim) {
155 struct TimerState* timers = &uc->fw->timers;

Callers

nothing calls this directly

Calls 1

stop_timerFunction · 0.85

Tested by

no test coverage detected