Skip to content

Commit

Permalink
Log values generated by the random syscall for replaying (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnivra authored Apr 2, 2022
1 parent df29d24 commit 1e7dd2e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions linux-user/syscall.c
Original file line number Diff line number Diff line change
Expand Up @@ -800,8 +800,10 @@ static abi_long do_random(abi_ulong buf, abi_long count, abi_ulong p_rnd_out)
randval = rand() & 0xFFFFu;
size = ((count - i) < sizeof(randval)) ? (count - i) : sizeof(randval);
if (size == 1) {
qemu_log("RANDOM (%02x, 1)\n", (uint8_t)randval);
ret = put_user_u8((uint8_t) randval, buf + i);
} else if (size == 2) {
qemu_log("RANDOM (%02x, 2)\n", randval);
ret = put_user_u16(randval, buf + i);
} else {
fprintf(stderr, "qemu: INTERNAL ERROR: I can only write 8 or 16 bits at a time! (asked for %zd)", size);
Expand Down

0 comments on commit 1e7dd2e

Please sign in to comment.