From 32ca31e98245df31b311654d0ba5de232fe50265 Mon Sep 17 00:00:00 2001 From: Paul Floyd Date: Tue, 30 Jan 2024 21:23:48 +0100 Subject: [PATCH] Bug 480488 - Add support for FreeBSD 13.3 --- NEWS | 1 + configure.ac | 7 +++++++ coregrind/m_syswrap/priv_syswrap-freebsd.h | 5 ++++- coregrind/m_syswrap/syswrap-freebsd.c | 14 ++++++++++---- include/vki/vki-freebsd.h | 2 +- include/vki/vki-scnums-freebsd.h | 6 +++++- 6 files changed, 28 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 5f1f2f5d9..d03bd777e 100644 --- a/NEWS +++ b/NEWS @@ -53,6 +53,7 @@ are not entered into bugzilla tend to get forgotten about or ignored. 479041 Executables without RW sections do not trigger debuginfo reading 480052 WARNING: unhandled amd64-freebsd syscall: 580 480126 Build failure on Raspberry Pi 5 / OS 6.1.0-rpi7-rpi-v8 +480488 Add support for FreeBSD 13.3 n-i-bz Add redirect for memccpy To see details of a given bug, visit diff --git a/configure.ac b/configure.ac index 8561ea9ac..95f9ed448 100755 --- a/configure.ac +++ b/configure.ac @@ -413,6 +413,8 @@ case "${host_os}" in freebsd_13_1=1310 AC_DEFINE([FREEBSD_13_2], 1320, [FREEBSD_VERS value for FreeBSD 13.2]) freebsd_13_2=1320 + AC_DEFINE([FREEBSD_13_3], 1330, [FREEBSD_VERS value for FreeBSD 13.3]) + freebsd_13_3=1330 AC_DEFINE([FREEBSD_14], 1400, [FREEBSD_VERS value for FreeBSD 14.x]) freebsd_14=1400 AC_DEFINE([FREEBSD_15], 1500, [FREEBSD_VERS value for FreeBSD 15.x]) @@ -463,6 +465,11 @@ case "${host_os}" in AC_DEFINE([FREEBSD_VERS], FREEBSD_13_2, [FreeBSD version]) freebsd_vers=$freebsd_13_2 ;; + 13.3-*) + AC_MSG_RESULT([FreeBSD 13.3 (${kernel})]) + AC_DEFINE([FREEBSD_VERS], FREEBSD_13_3, [FreeBSD version]) + freebsd_vers=$freebsd_13_3 + ;; *) AC_MSG_RESULT([unsupported (${kernel})]) AC_MSG_ERROR([Valgrind works on FreeBSD 10.x to 15.x]) diff --git a/coregrind/m_syswrap/priv_syswrap-freebsd.h b/coregrind/m_syswrap/priv_syswrap-freebsd.h index f40e3c7d2..7e8924d88 100644 --- a/coregrind/m_syswrap/priv_syswrap-freebsd.h +++ b/coregrind/m_syswrap/priv_syswrap-freebsd.h @@ -564,9 +564,12 @@ DECL_TEMPLATE(freebsd, sys_fspacectl) // 580 DECL_TEMPLATE(freebsd, sys_swapoff) // 582 #endif -#if (FREEBSD_VERS >= FREEBSD_15) +#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3) DECL_TEMPLATE(freebsd, sys_kqueuex) // 583 DECL_TEMPLATE(freebsd, sys_membarrier) // 584 +#endif + +#if (FREEBSD_VERS >= FREEBSD_15) DECL_TEMPLATE(freebsd, sys_timerfd_create) // 585 DECL_TEMPLATE(freebsd, sys_timerfd_gettime) // 586 DECL_TEMPLATE(freebsd, sys_timerfd_settime) // 587 diff --git a/coregrind/m_syswrap/syswrap-freebsd.c b/coregrind/m_syswrap/syswrap-freebsd.c index d7e63ef4b..18717a897 100644 --- a/coregrind/m_syswrap/syswrap-freebsd.c +++ b/coregrind/m_syswrap/syswrap-freebsd.c @@ -4706,7 +4706,7 @@ PRE(sys__umtx_op) struct umtx_robust_lists_params *, obj, int, op, unsigned long, flags); PRE_MEM_READ( "_umtx_op_robust_lists(mutex)", ARG3, sizeof(struct vki_umtx_robust_lists_params) ); break; -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_3) case VKI_UMTX_OP_GET_MIN_TIMEOUT: PRINT( "sys__umtx_op ( GET_MIN_TIMEOUT, %#" FMT_REGWORD "x)", ARG4); // bit of a pain just reads args 2 and 4 @@ -4794,7 +4794,7 @@ POST(sys__umtx_op) case VKI_UMTX_OP_SHM: case VKI_UMTX_OP_ROBUST_LISTS: break; -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_3) case VKI_UMTX_OP_GET_MIN_TIMEOUT: POST_MEM_WRITE( ARG4, sizeof(long int) ); break; @@ -6991,7 +6991,7 @@ PRE(sys_swapoff) #endif -#if (FREEBSD_VERS >= FREEBSD_15) +#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3) // SYS_kqueuex 583 // int kqueuex(u_int flags); @@ -7025,6 +7025,10 @@ PRE(sys_membarrier) PRE_REG_READ3(int, "membarrier", int, cmd, unsigned, flags, int, cpu_id); } +#endif + +#if (FREEBSD_VERS >= FREEBSD_15) + // SYS_timerfd_create 585 // int timerfd_create(int clockid, int flags); PRE(sys_timerfd_create) @@ -7820,9 +7824,11 @@ const SyscallTableEntry ML_(syscall_table)[] = { BSDX_(__NR_swapoff, sys_swapoff), // 582 #endif -#if (FREEBSD_VERS >= FREEBSD_15) +#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3) BSDXY(__NR_kqueuex, sys_kqueuex), // 583 BSDX_(__NR_membarrier, sys_membarrier), // 584 +#endif +#if (FREEBSD_VERS >= FREEBSD_15) BSDXY(__NR_timerfd_create, sys_timerfd_create), // 585 BSDXY(__NR_timerfd_settime, sys_timerfd_settime), // 586 BSDXY(__NR_timerfd_gettime, sys_timerfd_gettime), // 587 diff --git a/include/vki/vki-freebsd.h b/include/vki/vki-freebsd.h index abbdf49c2..bd4f09976 100644 --- a/include/vki/vki-freebsd.h +++ b/include/vki/vki-freebsd.h @@ -2084,7 +2084,7 @@ struct vki_umtx_robust_lists_params { #define VKI_UMTX_OP_SEM2_WAKE 24 #define VKI_UMTX_OP_SHM 25 #define VKI_UMTX_OP_ROBUST_LISTS 26 -#if (FREEBSD_VERS >= FREEBSD_14) +#if (FREEBSD_VERS >= FREEBSD_13_3) #define VKI_UMTX_OP_GET_MIN_TIMEOUT 27 #define VKI_UMTX_OP_SET_MIN_TIMEOUT 28 #endif diff --git a/include/vki/vki-scnums-freebsd.h b/include/vki/vki-scnums-freebsd.h index 1be22fa50..344b932fa 100644 --- a/include/vki/vki-scnums-freebsd.h +++ b/include/vki/vki-scnums-freebsd.h @@ -676,10 +676,14 @@ #endif -#if (FREEBSD_VERS >= FREEBSD_15) +#if (FREEBSD_VERS >= FREEBSD_15) || (FREEBSD_VERS >= FREEBSD_13_3) #define __NR_kqueuex 583 #define __NR_membarrier 584 + +#endif + +#if (FREEBSD_VERS >= FREEBSD_15) #define __NR_timerfd_create 585 #define __NR_timerfd_gettime 586 #define __NR_timerfd_settime 587 -- 2.11.4.GIT