From: John Wolfe Date: Thu, 20 May 2021 18:38:38 +0000 (-0700) Subject: Add backdoor support for host time of day in Arm X-Git-Tag: stable-11.3.0~16 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33ba0f01a3a15b245857e0f8ba2563b3177ced25;p=thirdparty%2Fopen-vm-tools.git Add backdoor support for host time of day in Arm The timeSync plugin makes backdoor calls to get host time of day. Update the time of day backdoor calls to function with the Arm backdoor implementation. Also fix a bug where an error returned by the GETTIME backdoor handler is incorrectly treated as a time value. --- diff --git a/open-vm-tools/services/plugins/timeSync/timeSync.c b/open-vm-tools/services/plugins/timeSync/timeSync.c index 514078075..f2f2c1ed9 100644 --- a/open-vm-tools/services/plugins/timeSync/timeSync.c +++ b/open-vm-tools/services/plugins/timeSync/timeSync.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2019 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2021 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -275,7 +275,15 @@ TimeSyncReadHost(int64 *host, int64 *apparentError, Bool *apparentErrorValid, "attempting BDOOR_CMD_GETTIME\n"); bp.in.cx.halfs.low = BDOOR_CMD_GETTIME; Backdoor(&bp); - hostSecs = bp.out.ax.word; + /* + * This backdoor returns uint32 time value in bp.out.ax.word or + * MAX_UINT32 in case of error. + */ + if (bp.out.ax.word == MAX_UINT32) { + hostSecs = -1; + } else { + hostSecs = bp.out.ax.word; + } } } hostUsecs = bp.out.bx.word; diff --git a/open-vm-tools/toolbox/toolboxcmd-stat.c b/open-vm-tools/toolbox/toolboxcmd-stat.c index cdd3a7053..5e8201a5d 100644 --- a/open-vm-tools/toolbox/toolboxcmd-stat.c +++ b/open-vm-tools/toolbox/toolboxcmd-stat.c @@ -1,5 +1,5 @@ /********************************************************* - * Copyright (C) 2008-2016,2019 VMware, Inc. All rights reserved. + * Copyright (C) 2008-2021 VMware, Inc. All rights reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published @@ -144,7 +144,15 @@ StatHostTime(void) /* Falling back to older command. */ bp.in.cx.halfs.low = BDOOR_CMD_GETTIME; Backdoor(&bp); - hostSecs = bp.out.ax.word; + /* + * This backdoor returns uint32 time value in bp.out.ax.word or + * MAX_UINT32 in case of error. + */ + if (bp.out.ax.word == MAX_UINT32) { + hostSecs = -1; + } else { + hostSecs = bp.out.ax.word; + } } hostUsecs = bp.out.bx.word;