From owner-svn-src-all@freebsd.org Sun Aug 21 07:41:12 2016 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4000EBC0A8F; Sun, 21 Aug 2016 07:41:12 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C15F1E2B; Sun, 21 Aug 2016 07:41:11 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u7L7fBlp075024; Sun, 21 Aug 2016 07:41:11 GMT (envelope-from ed@FreeBSD.org) Received: (from ed@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u7L7fBnN075023; Sun, 21 Aug 2016 07:41:11 GMT (envelope-from ed@FreeBSD.org) Message-Id: <201608210741.u7L7fBnN075023@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ed set sender to ed@FreeBSD.org using -f From: Ed Schouten Date: Sun, 21 Aug 2016 07:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r304555 - head/sys/compat/cloudabi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Aug 2016 07:41:12 -0000 Author: ed Date: Sun Aug 21 07:41:11 2016 New Revision: 304555 URL: https://svnweb.freebsd.org/changeset/base/304555 Log: Use memcpy() to copy 64-bit timestamps into the syscall return values. On 32-bit platforms, our 64-bit timestamps need to be split up across two registers. A simple assignment to td_retval[0] will cause the top 32 bits to get lost. By using memcpy(), we will automatically either use 1 or 2 registers depending on the size of register_t. Modified: head/sys/compat/cloudabi/cloudabi_clock.c Modified: head/sys/compat/cloudabi/cloudabi_clock.c ============================================================================== --- head/sys/compat/cloudabi/cloudabi_clock.c Sun Aug 21 07:28:38 2016 (r304554) +++ head/sys/compat/cloudabi/cloudabi_clock.c Sun Aug 21 07:41:11 2016 (r304555) @@ -117,7 +117,7 @@ cloudabi_sys_clock_res_get(struct thread error = cloudabi_convert_timespec(&ts, &cts); if (error != 0) return (error); - td->td_retval[0] = cts; + memcpy(td->td_retval, &cts, sizeof(cts)); return (0); } @@ -129,6 +129,6 @@ cloudabi_sys_clock_time_get(struct threa int error; error = cloudabi_clock_time_get(td, uap->clock_id, &ts); - td->td_retval[0] = ts; + memcpy(td->td_retval, &ts, sizeof(ts)); return (error); }