eebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4dwXKw6wkPz6PlGn; Tue, 20 Jan 2026 16:08:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4dwXKw3Q85z3GjH; Tue, 20 Jan 2026 16:08:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Authentication-Results: mx1.freebsd.org; none Received: from tom.home (kib@localhost [127.0.0.1] (may be forged)) by kib.kiev.ua (8.18.1/8.18.1) with ESMTP id 60KG7oxK069210; Tue, 20 Jan 2026 18:07:53 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 60KG7oxK069210 Received: (from kostik@localhost) by tom.home (8.18.1/8.18.1/Submit) id 60KG7oVN069209; Tue, 20 Jan 2026 18:07:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Jan 2026 18:07:50 +0200 From: Konstantin Belousov To: Jessica Clarke Cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 96acaa960023 - main - compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches Message-ID: References: <696f9463.f398.7ea9495a@gitrepo.freebsd.org> <7F0190E5-8B20-40A5-9D31-1D56BCF39E71@freebsd.org> List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <7F0190E5-8B20-40A5-9D31-1D56BCF39E71@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=4.0.2 X-Spam-Checker-Version: SpamAssassin 4.0.2 (2025-08-27) on tom.home X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Rspamd-Queue-Id: 4dwXKw3Q85z3GjH On Tue, Jan 20, 2026 at 04:05:19PM +0000, Jessica Clarke wrote: > On 20 Jan 2026, at 14:42, Konstantin Belousov wrote: > > > > 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; > > Any reason not to use: > > typedef uint64_t freebsd32_uint64_t __aligned(4); > > on amd64 (and normal typedef elsewhere)? Then you can just use the > normal CP. See for example https://godbolt.org/z/svseWv7xo. Yes, this way it uses only std C instead of the GNU extension, and not depend on compiler properly handle unaligned types. IMO it is better that way, and all machinery is hidden under the typedef+ the macro.