replay-internal.h (60618e2d77691e44bb78e23b2b0cf07b5c405e56) replay-internal.h (3e21408b0596aa2babe1e26996a15e7ad5eee71a)
1#ifndef REPLAY_INTERNAL_H
2#define REPLAY_INTERNAL_H
3
4/*
5 * replay-internal.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
1#ifndef REPLAY_INTERNAL_H
2#define REPLAY_INTERNAL_H
3
4/*
5 * replay-internal.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
15/* Asynchronous events IDs */
16
17typedef enum ReplayAsyncEventKind {
18 REPLAY_ASYNC_EVENT_BH,
19 REPLAY_ASYNC_EVENT_BH_ONESHOT,
20 REPLAY_ASYNC_EVENT_INPUT,
21 REPLAY_ASYNC_EVENT_INPUT_SYNC,
22 REPLAY_ASYNC_EVENT_CHAR_READ,
23 REPLAY_ASYNC_EVENT_BLOCK,
24 REPLAY_ASYNC_EVENT_NET,
25 REPLAY_ASYNC_COUNT
26} ReplayAsyncEventKind;
27
15/* Any changes to order/number of events will need to bump REPLAY_VERSION */
16enum ReplayEvents {
17 /* for instruction event */
18 EVENT_INSTRUCTION,
19 /* for software interrupt */
20 EVENT_INTERRUPT,
21 /* for emulated exceptions */
22 EVENT_EXCEPTION,
23 /* for async events */
24 EVENT_ASYNC,
28/* Any changes to order/number of events will need to bump REPLAY_VERSION */
29enum ReplayEvents {
30 /* for instruction event */
31 EVENT_INSTRUCTION,
32 /* for software interrupt */
33 EVENT_INTERRUPT,
34 /* for emulated exceptions */
35 EVENT_EXCEPTION,
36 /* for async events */
37 EVENT_ASYNC,
38 EVENT_ASYNC_LAST = EVENT_ASYNC + REPLAY_ASYNC_COUNT - 1,
25 /* for shutdown requests, range allows recovery of ShutdownCause */
26 EVENT_SHUTDOWN,
27 EVENT_SHUTDOWN_LAST = EVENT_SHUTDOWN + SHUTDOWN_CAUSE__MAX,
28 /* for character device write event */
29 EVENT_CHAR_WRITE,
30 /* for character device read all event */
31 EVENT_CHAR_READ_ALL,
32 EVENT_CHAR_READ_ALL_ERROR,

--- 11 unchanged lines hidden (view full) ---

44 /* some of greater codes are reserved for checkpoints */
45 EVENT_CHECKPOINT,
46 EVENT_CHECKPOINT_LAST = EVENT_CHECKPOINT + CHECKPOINT_COUNT - 1,
47 /* end of log event */
48 EVENT_END,
49 EVENT_COUNT
50};
51
39 /* for shutdown requests, range allows recovery of ShutdownCause */
40 EVENT_SHUTDOWN,
41 EVENT_SHUTDOWN_LAST = EVENT_SHUTDOWN + SHUTDOWN_CAUSE__MAX,
42 /* for character device write event */
43 EVENT_CHAR_WRITE,
44 /* for character device read all event */
45 EVENT_CHAR_READ_ALL,
46 EVENT_CHAR_READ_ALL_ERROR,

--- 11 unchanged lines hidden (view full) ---

58 /* some of greater codes are reserved for checkpoints */
59 EVENT_CHECKPOINT,
60 EVENT_CHECKPOINT_LAST = EVENT_CHECKPOINT + CHECKPOINT_COUNT - 1,
61 /* end of log event */
62 EVENT_END,
63 EVENT_COUNT
64};
65
52/* Asynchronous events IDs */
53
54enum ReplayAsyncEventKind {
55 REPLAY_ASYNC_EVENT_BH,
56 REPLAY_ASYNC_EVENT_BH_ONESHOT,
57 REPLAY_ASYNC_EVENT_INPUT,
58 REPLAY_ASYNC_EVENT_INPUT_SYNC,
59 REPLAY_ASYNC_EVENT_CHAR_READ,
60 REPLAY_ASYNC_EVENT_BLOCK,
61 REPLAY_ASYNC_EVENT_NET,
62 REPLAY_ASYNC_COUNT
63};
64
65typedef enum ReplayAsyncEventKind ReplayAsyncEventKind;
66
67typedef struct ReplayState {
68 /*! Cached clock values. */
69 int64_t cached_clock[REPLAY_CLOCK_COUNT];
70 /*! Current icount - number of processed instructions. */
71 uint64_t current_icount;
72 /*! Number of instructions to be executed before other events happen. */
73 int instruction_count;
74 /*! Type of the currently executed event. */
75 unsigned int data_kind;
76 /*! Flag which indicates that event is not processed yet. */
77 unsigned int has_unread_data;
78 /*! Temporary variable for saving current log offset. */
79 uint64_t file_offset;
80 /*! Next block operation id.
81 This counter is global, because requests from different
82 block devices should not get overlapping ids. */
83 uint64_t block_request_id;
84 /*! Prior value of the host clock */
85 uint64_t host_clock_last;
66typedef struct ReplayState {
67 /*! Cached clock values. */
68 int64_t cached_clock[REPLAY_CLOCK_COUNT];
69 /*! Current icount - number of processed instructions. */
70 uint64_t current_icount;
71 /*! Number of instructions to be executed before other events happen. */
72 int instruction_count;
73 /*! Type of the currently executed event. */
74 unsigned int data_kind;
75 /*! Flag which indicates that event is not processed yet. */
76 unsigned int has_unread_data;
77 /*! Temporary variable for saving current log offset. */
78 uint64_t file_offset;
79 /*! Next block operation id.
80 This counter is global, because requests from different
81 block devices should not get overlapping ids. */
82 uint64_t block_request_id;
83 /*! Prior value of the host clock */
84 uint64_t host_clock_last;
86 /*! Asynchronous event type read from the log */
87 int32_t read_event_kind;
88 /*! Asynchronous event id read from the log */
89 uint64_t read_event_id;
90} ReplayState;
91extern ReplayState replay_state;
92
93/* File for replay writing */
94extern FILE *replay_file;
95/* Instruction count of the replay breakpoint */

--- 101 unchanged lines hidden ---
85 /*! Asynchronous event id read from the log */
86 uint64_t read_event_id;
87} ReplayState;
88extern ReplayState replay_state;
89
90/* File for replay writing */
91extern FILE *replay_file;
92/* Instruction count of the replay breakpoint */

--- 101 unchanged lines hidden ---