Skip to content

Commit

Permalink
exec: Move [b]tswapl() declarations to 'exec/user/tswap-target.h'
Browse files Browse the repository at this point in the history
tswapl() and bswaptls() are target-dependent and only used
by user emulation. Move their definitions to a new header:
"exec/user/tswap-target.h".

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Anton Johansson <[email protected]>
Message-Id: <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
  • Loading branch information
philmd committed Apr 26, 2024
1 parent 4250826 commit 8272386
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 8 deletions.
1 change: 1 addition & 0 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -3692,6 +3692,7 @@ Overall usermode emulation
M: Riku Voipio <[email protected]>
S: Maintained
F: accel/tcg/user-exec*.c
F: include/exec/user/
F: include/user/
F: common-user/

Expand Down
1 change: 1 addition & 0 deletions bsd-user/freebsd/target_os_elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "target_arch_elf.h"
#include "elf.h"
#include "user/tswap-target.h"

#define bsd_get_ncpu() 1 /* until we pull in bsd-proc.[hc] */

Expand Down
1 change: 1 addition & 0 deletions bsd-user/freebsd/target_os_stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <sys/param.h>
#include "target_arch_sigtramp.h"
#include "qemu/guest-random.h"
#include "user/tswap-target.h"

/*
* The initial FreeBSD stack is as follows:
Expand Down
1 change: 1 addition & 0 deletions bsd-user/netbsd/target_os_elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "target_arch_elf.h"
#include "elf.h"
#include "user/tswap-target.h"

/* this flag is uneffective under linux too, should be deleted */
#ifndef MAP_DENYWRITE
Expand Down
1 change: 1 addition & 0 deletions bsd-user/openbsd/target_os_elf.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include "target_arch_elf.h"
#include "elf.h"
#include "user/tswap-target.h"

/* this flag is uneffective under linux too, should be deleted */
#ifndef MAP_DENYWRITE
Expand Down
1 change: 1 addition & 0 deletions bsd-user/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "qemu/osdep.h"
#include "qemu/log.h"
#include "qemu.h"
#include "user/tswap-target.h"
#include "gdbstub/user.h"
#include "signal-common.h"
#include "trace.h"
Expand Down
1 change: 1 addition & 0 deletions bsd-user/strace.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include <sys/ioccom.h>

#include "qemu.h"
#include "user/tswap-target.h"

#include "os-strace.h" /* OS dependent strace print functions */

Expand Down
8 changes: 0 additions & 8 deletions include/exec/cpu-all.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,6 @@
#define BSWAP_NEEDED
#endif

#if TARGET_LONG_SIZE == 4
#define tswapl(s) tswap32(s)
#define bswaptls(s) bswap32s(s)
#else
#define tswapl(s) tswap64(s)
#define bswaptls(s) bswap64s(s)
#endif

/* Target-endianness CPU memory access functions. These fit into the
* {ld,st}{type}{sign}{size}{endian}_p naming scheme described in bswap.h.
*/
Expand Down
1 change: 1 addition & 0 deletions include/exec/user/abitypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define EXEC_USER_ABITYPES_H

#include "cpu.h"
#include "user/tswap-target.h"

#ifdef TARGET_ABI32
#define TARGET_ABI_BITS 32
Expand Down
22 changes: 22 additions & 0 deletions include/user/tswap-target.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* target-specific swap() definitions
*
* Copyright (c) 2003 Fabrice Bellard
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
#ifndef USER_TSWAP_H
#define USER_TSWAP_H

#include "exec/cpu-defs.h"
#include "exec/tswap.h"

#if TARGET_LONG_SIZE == 4
#define tswapl(s) tswap32(s)
#define bswaptls(s) bswap32s(s)
#else
#define tswapl(s) tswap64(s)
#define bswaptls(s) bswap64s(s)
#endif

#endif
1 change: 1 addition & 0 deletions linux-user/elfload.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <sys/shm.h>

#include "qemu.h"
#include "user/tswap-target.h"
#include "user-internals.h"
#include "signal-common.h"
#include "loader.h"
Expand Down
1 change: 1 addition & 0 deletions linux-user/i386/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "user-internals.h"
#include "signal-common.h"
#include "linux-user/trace.h"
#include "user/tswap-target.h"

/* from the Linux kernel - /arch/x86/include/uapi/asm/sigcontext.h */

Expand Down
1 change: 1 addition & 0 deletions linux-user/ppc/signal.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "user-internals.h"
#include "signal-common.h"
#include "linux-user/trace.h"
#include "user/tswap-target.h"
#include "vdso-asmoffset.h"

/* See arch/powerpc/include/asm/ucontext.h. Only used for 32-bit PPC;
Expand Down

0 comments on commit 8272386

Please sign in to comment.