From nobody Tue Jan 20 14:42:43 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dwVRX55dPz6PfDV for ; Tue, 20 Jan 2026 14:42:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4dwVRX3wmqz3xwF for ; Tue, 20 Jan 2026 14:42:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768920168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J/8N9EA+8qH3u/KJwsF/m2sot3IRfvt2SPl1Ky5XNBU=; b=FHtU0BUNAIl3MmIUWyQdaUpIeSYj9ywjGUBN6LNmHNJSVC2B0MHtTXccTgIi0Kqe4TXTDc FBrNM0OoBUXpnfWOeKeAAQ2zwa9B4YVY1faR+BrxWNGWPRGhjIIIZ4TndPRfaBGqJMl4xP 9LLu5+E7/flWAtZCi38yFoLOyhF/H6HlfLBnR4f5EjrIrEROmm5mmccrlR7NnffGdR0TKT LCA1bFJ0vGamiKujuLPwQCubDoDpgeYHWM9SujgVhl8NoRl3WuE0AnFun/LTTfBCtmnnSs +/RndKh/F9mqLljyOXxibEucgTrusDsYZMFNHOZbpVJPD7vIBmox+SScO4qBOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1768920168; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=J/8N9EA+8qH3u/KJwsF/m2sot3IRfvt2SPl1Ky5XNBU=; b=uAUjmsJGGP5Pe3uM345R8c5vFlNTBJ1OL7pOJlHUhy3yn5OAsnEefS5gf1PCg6Upzb2KyB L5UrsA/pBdjmQti0c9n7WMZ/N/W3xCmD+t7/ZH0AgD0jVYdC2WEMO8fGhtEHGNw596Eb1d LGYSZGa/B+VsRCpufaT9aX7i4UbHE3opbZ6W0v1Whak8URa6kZ3eby7Xb+zpcssbBVr86W hrbCtJq07Isu7IE68o/XZYF3Kq/61e7zRNyglFBGiIMDK/IQ/ypRZc9n0ap1O+Ta5sMbmj Xv6EPTUr29z3J905WF9RH5Nnb+tbselurH30Jcjc26DBTdvNi/iXdEerGAtXyw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1768920168; a=rsa-sha256; cv=none; b=aassgsIRAF/bTkcl33f4lnrGfjuYyWCBcEwCnIihMxNurayNYG2D/QVuWl2w+WXtr5PSPN wthm781PIdYhXLjZMR4Cc/2sm4smrXIo9rwPnxL6MaZlByXnWbHdmxEwj7BkI4qf6L2OB4 BfJafr+2uCUQWVIdTKYxfWiLjdQBL8qiw7XDFUEZL2OGFvQYGvrSeCs2i+smUdeecFt1At L3IkPjIWAlmDzNX9xvouXk9XoQOuUZ8gJAhboB0o2SptNfW+jzroNnefNl5IOqzB2HbCi3 a1VxRZj5rhvhujzmwA8wg9qMa7FYhjutvKEP3xc1hVNX1/atBB4vpbo1SWq53Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4dwVRX3MvCz1LQd for ; Tue, 20 Jan 2026 14:42:48 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id f398 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 20 Jan 2026 14:42:43 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 96acaa960023 - main - compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 96acaa960023c20e852e04e7cc5c6a5faca36c67 Auto-Submitted: auto-generated Date: Tue, 20 Jan 2026 14:42:43 +0000 Message-Id: <696f9463.f398.7ea9495a@gitrepo.freebsd.org> The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=96acaa960023c20e852e04e7cc5c6a5faca36c67 commit 96acaa960023c20e852e04e7cc5c6a5faca36c67 Author: Konstantin Belousov AuthorDate: 2026-01-12 04:45:36 +0000 Commit: Konstantin Belousov CommitDate: 2026-01-20 14:42:35 +0000 compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches uint64_t is 4-byte aligned on i386, but is 8-bytes aligned on all other 32bit arches FreeBSD supports. Provide the freebsd32_uint64_t type and the FU64_CP() macro, which are intended to be used where 32bit ABI uses (u)int64_t type, and do proper layout and copying for the aggregate type. Reviewed by: des, emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D54663 --- sys/compat/freebsd32/freebsd32.h | 11 ++++++++++- sys/sys/abi_compat.h | 8 ++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/sys/compat/freebsd32/freebsd32.h b/sys/compat/freebsd32/freebsd32.h index 9d724c93fee7..7324f9adf70c 100644 --- a/sys/compat/freebsd32/freebsd32.h +++ b/sys/compat/freebsd32/freebsd32.h @@ -36,8 +36,17 @@ #include /* - * i386 is the only arch with a 32-bit time_t + * i386 is the only arch with a 32-bit time_t. + * Also it is the only arch with (u)int64_t having 4-bytes alignment. */ +typedef struct { +#ifdef __amd64__ + uint32_t val[2]; +#else + uint64_t val; +#endif +} freebsd32_uint64_t; + #ifdef __amd64__ typedef int32_t time32_t; #else diff --git a/sys/sys/abi_compat.h b/sys/sys/abi_compat.h index c2233f2eac2c..0a7110191430 100644 --- a/sys/sys/abi_compat.h +++ b/sys/sys/abi_compat.h @@ -67,6 +67,14 @@ TS_CP((src), (dst), it_value); \ } while (0) +#define FU64_CP(src, dst, fld) do { \ + _Static_assert(sizeof((src).fld) == sizeof(uint64_t), \ + "FU64_CP src: " #src "." #fld "is not 8 bytes"); \ + _Static_assert(sizeof((dst).fld) == sizeof(uint64_t), \ + "FU64_CP dst: " #dst "." #fld "is not 8 bytes"); \ + memcpy(&(dst).fld, &(src).fld, sizeof(uint64_t)); \ +} while (0) + #define BT_CP(src, dst, fld) do { \ CP((src).fld, (dst).fld, sec); \ *(uint64_t *)&(dst).fld.frac[0] = (src).fld.frac; \