]> git.proxmox.com Git - mirror_qemu.git/blame - include/sysemu/replay.h
bottom halves: introduce bh call function
[mirror_qemu.git] / include / sysemu / replay.h
CommitLineData
d73abd6d
PD
1#ifndef REPLAY_H
2#define REPLAY_H
3
4/*
5 * replay.h
6 *
7 * Copyright (c) 2010-2015 Institute for System Programming
8 * of the Russian Academy of Sciences.
9 *
10 * This work is licensed under the terms of the GNU GPL, version 2 or later.
11 * See the COPYING file in the top-level directory.
12 *
13 */
14
26bc60ac
PD
15#include <stdbool.h>
16#include <stdint.h>
d73abd6d
PD
17#include "qapi-types.h"
18
8eda206e
PD
19/* replay clock kinds */
20enum ReplayClockKind {
21 /* host_clock */
22 REPLAY_CLOCK_HOST,
23 /* virtual_rt_clock */
24 REPLAY_CLOCK_VIRTUAL_RT,
25 REPLAY_CLOCK_COUNT
26};
27typedef enum ReplayClockKind ReplayClockKind;
28
8bd7f71d
PD
29/* IDs of the checkpoints */
30enum ReplayCheckpoint {
31 CHECKPOINT_CLOCK_WARP,
32 CHECKPOINT_RESET_REQUESTED,
33 CHECKPOINT_SUSPEND_REQUESTED,
34 CHECKPOINT_CLOCK_VIRTUAL,
35 CHECKPOINT_CLOCK_HOST,
36 CHECKPOINT_CLOCK_VIRTUAL_RT,
37 CHECKPOINT_INIT,
38 CHECKPOINT_RESET,
39 CHECKPOINT_COUNT
40};
41typedef enum ReplayCheckpoint ReplayCheckpoint;
42
d73abd6d
PD
43extern ReplayMode replay_mode;
44
26bc60ac
PD
45/* Processing the instructions */
46
47/*! Returns number of executed instructions. */
48uint64_t replay_get_current_step(void);
8b427044
PD
49/*! Returns number of instructions to execute in replay mode. */
50int replay_get_instructions(void);
51/*! Updates instructions counter in replay mode. */
52void replay_account_executed_instructions(void);
26bc60ac 53
6f060969
PD
54/* Interrupts and exceptions */
55
56/*! Called by exception handler to write or read
57 exception processing events. */
58bool replay_exception(void);
59/*! Used to determine that exception is pending.
60 Does not proceed to the next event in the log. */
61bool replay_has_exception(void);
62/*! Called by interrupt handlers to write or read
63 interrupt processing events.
64 \return true if interrupt should be processed */
65bool replay_interrupt(void);
66/*! Tries to read interrupt event from the file.
67 Returns true, when interrupt request is pending */
68bool replay_has_interrupt(void);
69
8eda206e
PD
70/* Processing clocks and other time sources */
71
72/*! Save the specified clock */
73int64_t replay_save_clock(ReplayClockKind kind, int64_t clock);
74/*! Read the specified clock from the log or return cached data */
75int64_t replay_read_clock(ReplayClockKind kind);
76/*! Saves or reads the clock depending on the current replay mode. */
77#define REPLAY_CLOCK(clock, value) \
78 (replay_mode == REPLAY_MODE_PLAY ? replay_read_clock((clock)) \
79 : replay_mode == REPLAY_MODE_RECORD \
80 ? replay_save_clock((clock), (value)) \
81 : (value))
82
b60c48a7
PD
83/* Events */
84
85/*! Called when qemu shutdown is requested. */
86void replay_shutdown_request(void);
8bd7f71d
PD
87/*! Should be called at check points in the execution.
88 These check points are skipped, if they were not met.
89 Saves checkpoint in the SAVE mode and validates in the PLAY mode.
90 Returns 0 in PLAY mode if checkpoint was not found.
91 Returns 1 in all other cases. */
92bool replay_checkpoint(ReplayCheckpoint checkpoint);
b60c48a7 93
c0c071d0
PD
94/* Asynchronous events queue */
95
96/*! Disables storing events in the queue */
97void replay_disable_events(void);
98/*! Returns true when saving events is enabled */
99bool replay_events_enabled(void);
6f060969 100
d73abd6d 101#endif