summaryrefslogtreecommitdiff
path: root/hw/misc/macio/cuda.c
diff options
context:
space:
mode:
authorAurelien Jarno <aurelien@aurel32.net>2016-04-18 10:07:45 +0200
committerDavid Gibson <david@gibson.dropbear.id.au>2016-04-19 11:39:23 +1000
commited3d807b0a577c4f825b25f3281fe54ce89202db (patch)
treee91a666286c2a89d0745c8be059b3c692190ac16 /hw/misc/macio/cuda.c
parent92b674b62a1aec734280c9019cfb3b3745044b66 (diff)
downloadqemu-ed3d807b0a577c4f825b25f3281fe54ce89202db.tar.gz
qemu-ed3d807b0a577c4f825b25f3281fe54ce89202db.tar.bz2
qemu-ed3d807b0a577c4f825b25f3281fe54ce89202db.zip
cuda: fix off-by-one error in SET_TIME command
With the new framework the cuda_cmd_set_time command directly receive the data, without the command byte. Therefore the time is stored at in_data[0], not at in_data[1]. This fixes the "hwclock --systohc" command in a guest. Cc: Hervé Poussineau <hpoussin@reactos.org> Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net> Reviewed-by: Hervé Poussineau <hpoussin@reactos.org> [this fixes a regression introduced by e647317 "cuda: port SET_TIME command to new framework"] Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'hw/misc/macio/cuda.c')
-rw-r--r--hw/misc/macio/cuda.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/misc/macio/cuda.c b/hw/misc/macio/cuda.c
index c7472aaa9d..f15f301100 100644
--- a/hw/misc/macio/cuda.c
+++ b/hw/misc/macio/cuda.c
@@ -685,8 +685,8 @@ static bool cuda_cmd_set_time(CUDAState *s,
return false;
}
- ti = (((uint32_t)in_data[1]) << 24) + (((uint32_t)in_data[2]) << 16)
- + (((uint32_t)in_data[3]) << 8) + in_data[4];
+ ti = (((uint32_t)in_data[0]) << 24) + (((uint32_t)in_data[1]) << 16)
+ + (((uint32_t)in_data[2]) << 8) + in_data[3];
s->tick_offset = ti - (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL)
/ NANOSECONDS_PER_SECOND);
return true;