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

Function sync_timers

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

Source from the content-addressed store, hash-verified

91}
92
93static inline void sync_timers(uc_engine *uc) {
94 uc->get_timer_countdown(uc->ctx, &uc->fw->timers.cur_countdown);
95
96 // This does not perform reloading as syncing is assumed to only occur and to be handled
97 // within the timer callback. All manual timer syncs are on a non-elapsed state
98
99 // In case the countdown is 0, we are currently handling timer timer callbacks
100 struct TimerState* timers = &uc->fw->timers;
101 if(timers->cur_countdown != 0) {
102 int64_t elapsed = timers->cur_interval - timers->cur_countdown;
103
104 #ifdef DEBUG_TIMER
105 printf("[sync_timers] timers.cur_interval: %lu, timers.cur_countdown: %lu -> elapsed: %ld\n", timers->cur_interval, timers->cur_countdown, elapsed); fflush(NULL);
106 #endif
107
108 timers->global_ticker += elapsed;
109 timers->cur_interval = timers->cur_countdown;
110
111 for(struct Timer *cursor=timers->active_head; cursor; cursor = cursor->next) {
112 cursor->ticker_val -= elapsed;
113 }
114 }
115}
116
117uc_err rem_timer(uc_engine *uc, uint32_t id) {
118 struct TimerState* timers = &uc->fw->timers;

Callers 3

insert_active_timerFunction · 0.85
remove_active_timerFunction · 0.85
get_global_tickerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected