qemu/replay/replay-random.c
Philippe Mathieu-Daudé 32cad1ffb8 include: Rename sysemu/ -> system/
Headers in include/sysemu/ are not only related to system
*emulation*, they are also used by virtualization. Rename
as system/ which is clearer.

Files renamed manually then mechanical change using sed tool.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Tested-by: Lei Yang <leiyang@redhat.com>
Message-Id: <20241203172445.28576-1-philmd@linaro.org>
2024-12-20 17:44:56 +01:00

44 lines
1.1 KiB
C

/*
* 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 "system/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;
}