Date: Tue, 27 Jan 2026 00:39:42 +0000 From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: a984c2346bb1 - stable/15 - compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches Message-ID: <6978094e.d1d5.6dd27ebd@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=a984c2346bb11e723560635ca11ed9c10565b9f0 commit a984c2346bb11e723560635ca11ed9c10565b9f0 Author: Konstantin Belousov <kib@FreeBSD.org> AuthorDate: 2026-01-12 04:45:36 +0000 Commit: Konstantin Belousov <kib@FreeBSD.org> CommitDate: 2026-01-27 00:38:22 +0000 compat32: provide a type and a macro for (u)int64_t handling on non-x86 arches (cherry picked from commit 96acaa960023c20e852e04e7cc5c6a5faca36c67) --- 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 <sys/_ffcounter.h> /* - * 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; \home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6978094e.d1d5.6dd27ebd>
