diff options
author | biao716.wang <biao716.wang@samsung.com> | 2023-08-28 14:40:25 +0900 |
---|---|---|
committer | biao716.wang <biao716.wang@samsung.com> | 2023-08-28 14:40:25 +0900 |
commit | d0ba767e7dc0fded6daae31c11d13b538ed8d53f (patch) | |
tree | eaaffe8ef043ee1803a7bbff50a9946e1613f58f /replay/replay-random.c | |
parent | 0889ee8339e51dfdf78c39a8f15b6e5fe5ab49d5 (diff) | |
download | qemu-arm-static-sandbox/wangbiao/qemu_5.2.tar.gz qemu-arm-static-sandbox/wangbiao/qemu_5.2.tar.bz2 qemu-arm-static-sandbox/wangbiao/qemu_5.2.zip |
Upgrade version to 5.2upstream/5.2.0sandbox/wangbiao/qemu_5.2
Change-Id: I79199e4f7e9f27b498cd41113833a6158d4f07a2
Signed-off-by: biao716.wang <biao716.wang@samsung.com>
Diffstat (limited to 'replay/replay-random.c')
-rw-r--r-- | replay/replay-random.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/replay/replay-random.c b/replay/replay-random.c new file mode 100644 index 000000000..afc7a0fcc --- /dev/null +++ b/replay/replay-random.c @@ -0,0 +1,44 @@ +/* + * replay-random.c + * + * Copyright (c) 2010-2020 Institute for System Programming + * of the Russian Academy of Sciences. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + * + */ + +#include "qemu/osdep.h" +#include "qemu/error-report.h" +#include "sysemu/replay.h" +#include "replay-internal.h" + +void replay_save_random(int ret, void *buf, size_t len) +{ + g_assert(replay_mutex_locked()); + + replay_save_instructions(); + replay_put_event(EVENT_RANDOM); + replay_put_dword(ret); + replay_put_array(buf, len); +} + +int replay_read_random(void *buf, size_t len) +{ + int ret = 0; + g_assert(replay_mutex_locked()); + + replay_account_executed_instructions(); + if (replay_next_event_is(EVENT_RANDOM)) { + size_t buf_size = 0; + ret = replay_get_dword(); + replay_get_array(buf, &buf_size); + replay_finish_event(); + g_assert(buf_size == len); + } else { + error_report("Missing random event in the replay log"); + exit(1); + } + return ret; +} |