ui: fix mixup between qnum and qcode in SDL1 key handling
[qemu/ar7.git] / replay / replay-time.c
blobf70382a88f3c9fa7c387a90765932747f04319b3
1 /*
2 * replay-time.c
4 * Copyright (c) 2010-2015 Institute for System Programming
5 * of the Russian Academy of Sciences.
7 * This work is licensed under the terms of the GNU GPL, version 2 or later.
8 * See the COPYING file in the top-level directory.
12 #include "qemu/osdep.h"
13 #include "qemu-common.h"
14 #include "sysemu/replay.h"
15 #include "replay-internal.h"
16 #include "qemu/error-report.h"
18 int64_t replay_save_clock(ReplayClockKind kind, int64_t clock)
20 replay_save_instructions();
22 if (replay_file) {
23 replay_mutex_lock();
24 replay_put_event(EVENT_CLOCK + kind);
25 replay_put_qword(clock);
26 replay_mutex_unlock();
29 return clock;
32 void replay_read_next_clock(ReplayClockKind kind)
34 unsigned int read_kind = replay_state.data_kind - EVENT_CLOCK;
36 assert(read_kind == kind);
38 int64_t clock = replay_get_qword();
40 replay_check_error();
41 replay_finish_event();
43 replay_state.cached_clock[read_kind] = clock;
46 /*! Reads next clock event from the input. */
47 int64_t replay_read_clock(ReplayClockKind kind)
49 replay_account_executed_instructions();
51 if (replay_file) {
52 int64_t ret;
53 replay_mutex_lock();
54 if (replay_next_event_is(EVENT_CLOCK + kind)) {
55 replay_read_next_clock(kind);
57 ret = replay_state.cached_clock[kind];
58 replay_mutex_unlock();
60 return ret;
63 error_report("REPLAY INTERNAL ERROR %d", __LINE__);
64 exit(1);