All of lore.kernel.org
 help / color / mirror / Atom feed
From: Warner Losh <imp@bsdimp.com>
To: qemu-devel@nongnu.org
Cc: Kyle Evans <kevans@freebsd.org>, Warner Losh <imp@bsdimp.com>,
	 Rick Richard <rick@sloservers.com>
Subject: [PATCH 01/14] bsd-user: HOST_BIG_ENDIAN and TARGET_BIG_ENDIAN are always
Date: Sat, 19 Sep 2026 23:20:37 -0600	[thread overview]
Message-ID: <20260919-misc-2025q4-v1-1-ebfa61049bd7@bsdimp.com> (raw)
In-Reply-To: <20260919-misc-2025q4-v1-0-ebfa61049bd7@bsdimp.com>

From: Rick Richard <rick@sloservers.com>

TARGET_BIG_ENDIAN and HOST_BIG_ENDIAN are always defined.

lseek and target_offset64() transpose upper and lower halves
on 32-bit ABIs, -strace prints wrong off_t.

Signed-off-by: Rick Richard <rick@sloservers.com>
[ fixed defined() too ]
Reviewed-by: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
 bsd-user/bsd-file.h          | 2 +-
 bsd-user/freebsd/os-misc.h   | 2 +-
 bsd-user/freebsd/os-thread.h | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/bsd-user/bsd-file.h b/bsd-user/bsd-file.h
index 0fefc07232..a2c2e38e50 100644
--- a/bsd-user/bsd-file.h
+++ b/bsd-user/bsd-file.h
@@ -986,7 +986,7 @@ static abi_long do_bsd_lseek(CPUArchState *env, abi_long arg1, abi_long arg2,
         ret = get_errno(res);
         set_second_rval(env, 0xFFFFFFFF);
     } else {
-#ifdef TARGET_BIG_ENDIAN
+#if TARGET_BIG_ENDIAN
         ret = ((res >> 32) & 0xFFFFFFFF);
         set_second_rval(env, res & 0xFFFFFFFF);
 #else
diff --git a/bsd-user/freebsd/os-misc.h b/bsd-user/freebsd/os-misc.h
index 0f87b21cc8..e9f9eed4b4 100644
--- a/bsd-user/freebsd/os-misc.h
+++ b/bsd-user/freebsd/os-misc.h
@@ -336,7 +336,7 @@ static inline abi_long do_freebsd_kldsym(abi_long fileid, abi_long cmd,
 #if TARGET_ABI_BITS == 32
 static inline uint64_t target_offset64(uint32_t word0, uint32_t word1)
 {
-#ifdef TARGET_BIG_ENDIAN
+#if TARGET_BIG_ENDIAN
     return ((uint64_t)word0 << 32) | word1;
 #else
     return ((uint64_t)word1 << 32) | word0;
diff --git a/bsd-user/freebsd/os-thread.h b/bsd-user/freebsd/os-thread.h
index 4258b24095..6552c60337 100644
--- a/bsd-user/freebsd/os-thread.h
+++ b/bsd-user/freebsd/os-thread.h
@@ -18,7 +18,7 @@
 int safe_thr_suspend(struct timespec *timeout);
 int safe__umtx_op(void *, int, unsigned long, void *, void *);
 
-#if defined(HOST_BIG_ENDIAN) == defined(TARGET_BIG_ENDIAN) && \
+#if HOST_BIG_ENDIAN == TARGET_BIG_ENDIAN && \
     (TARGET_ABI_BITS == HOST_LONG_BITS || defined(UMTX_OP__32BIT))
 #define _UMTX_OPTIMIZED
 #if defined(TARGET_ABI32)

-- 
2.55.0



  reply	other threads:[~2026-09-20  5:22 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  5:20 [PATCH 00/14] bsd-user: Upstream a few fixes Warner Losh
2026-09-20  5:20 ` Warner Losh [this message]
2026-09-20 21:57   ` [PATCH 01/14] bsd-user: HOST_BIG_ENDIAN and TARGET_BIG_ENDIAN are always Richard Henderson
2026-09-20  5:20 ` [PATCH 02/14] bsd-user: Drop support for FreeBSD 12 Warner Losh
2026-09-21 18:35   ` Pierrick Bouvier
2026-09-20  5:20 ` [PATCH 03/14] bsd-user: Flag shared memory as needing atomics Warner Losh
2026-09-20 21:59   ` Richard Henderson
2026-09-20  5:20 ` [PATCH 04/14] bsd-user: Add gdb for system calls Warner Losh
2026-09-20 22:02   ` Richard Henderson
2026-09-21 10:06     ` Warner Losh
2026-09-20  5:20 ` [PATCH 05/14] bsd-user: Initialize per-arch child registers Warner Losh
2026-09-20 22:07   ` Richard Henderson
2026-09-20  5:20 ` [PATCH 06/14] bsd-user: Fix crazy bug with mmap Warner Losh
2026-09-20 22:09   ` Richard Henderson
2026-09-21  2:38     ` Warner Losh
2026-09-20  5:20 ` [PATCH 07/14] bsd-user: Move tb_flush stuff to begin_parallel_context Warner Losh
2026-09-20 22:11   ` Richard Henderson
2026-09-20  5:20 ` [PATCH 08/14] bsd-user: Fix MAP_TYPE definition Warner Losh
2026-09-20 22:12   ` Richard Henderson
2026-09-20  5:20 ` [PATCH 09/14] bsd-user: Implement exterrctl(2) Warner Losh
2026-09-21 18:34   ` Pierrick Bouvier
2026-09-20  5:20 ` [PATCH 10/14] bsd-user: Implement sigfastblock Warner Losh
2026-09-21 18:34   ` Pierrick Bouvier
2026-09-20  5:20 ` [PATCH 11/14] bsd-user: Eliminate unused regs arg in load_elf_binary Warner Losh
2026-09-20 22:14   ` Richard Henderson
2026-09-20  5:20 ` [PATCH 12/14] bsd-user: #ifdef sockopt that aren't in 14 Warner Losh
2026-09-21 18:32   ` Pierrick Bouvier
2026-09-20  5:20 ` [PATCH 13/14] bsd-user: Fix non-PIE binaries Warner Losh
2026-09-20 22:33   ` Richard Henderson
2026-09-21  1:06     ` Warner Losh
2026-09-20  5:20 ` [PATCH 14/14] bsd-user: Remove host-os.h Warner Losh
2026-09-20 22:34   ` Richard Henderson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260919-misc-2025q4-v1-1-ebfa61049bd7@bsdimp.com \
    --to=imp@bsdimp.com \
    --cc=kevans@freebsd.org \
    --cc=qemu-devel@nongnu.org \
    --cc=rick@sloservers.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.