From: Aurelien Jarno Date: Mon, 18 Apr 2016 08:07:45 +0000 (+0200) Subject: cuda: fix off-by-one error in SET_TIME command X-Git-Tag: Tizen_Studio_1.3_Release_p2.3.2~30^2~6^2~8^2~30^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ed3d807b0a577c4f825b25f3281fe54ce89202db;p=sdk%2Femulator%2Fqemu.git 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 Cc: David Gibson Signed-off-by: Aurelien Jarno Reviewed-by: Hervé Poussineau [this fixes a regression introduced by e647317 "cuda: port SET_TIME command to new framework"] Signed-off-by: David Gibson --- 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;