qemu: update to 8.1.0.

This commit is contained in:
André Cerqueira 2023-09-15 23:38:32 +01:00 committed by classabbyamp
parent 78329d899a
commit 147fb2841c
11 changed files with 222 additions and 516 deletions

View file

@ -1,117 +0,0 @@
commit 37814f62c2cc7aba2eea073014d6c53dcd5bf42c
Author: q66 <daniel@octaforge.org>
Date: Fri Jul 1 16:53:55 2022 +0200
fix linux-user build on 32-bit ppc
Partial revert https://gitlab.com/qemu-project/qemu/-/commit/9d1401b79463e74adbfac69d836789d4e103fb61
and https://gitlab.com/qemu-project/qemu/-/commit/0a7e01904d407baa73c1baddbdfc9ccf2ace8356
diff --git a/common-user/host/ppc/safe-syscall.inc.S b/common-user/host/ppc/safe-syscall.inc.S
new file mode 100644
index 0000000..e69de29
diff --git a/common-user/safe-syscall-error.c b/common-user/safe-syscall-error.c
index cf74b50..a36132c 100644
--- a/common-user/safe-syscall-error.c
+++ b/common-user/safe-syscall-error.c
@@ -12,6 +12,7 @@
#include "qemu/osdep.h"
#include "user/safe-syscall.h"
+#if !defined(__powerpc__) || defined(__powerpc64__)
/*
* This is intended to be invoked via tail-call on the error path
* from the assembly in host/arch/safe-syscall.inc.S. This takes
@@ -23,3 +24,4 @@ long safe_syscall_set_errno_tail(int value)
errno = value;
return -1;
}
+#endif
diff --git a/include/user/safe-syscall.h b/include/user/safe-syscall.h
index 61a04e2..793fe84 100644
--- a/include/user/safe-syscall.h
+++ b/include/user/safe-syscall.h
@@ -125,6 +125,8 @@
* kinds of restartability.
*/
+#if !defined(__powerpc__) || defined(__powerpc64__)
+
/* The core part of this function is implemented in assembly */
extern long safe_syscall_base(int *pending, long number, ...);
extern long safe_syscall_set_errno_tail(int value);
@@ -137,4 +139,10 @@ extern char safe_syscall_end[];
safe_syscall_base(&((TaskState *)thread_cpu->opaque)->signal_pending, \
__VA_ARGS__)
+#else
+
+#define safe_syscall syscall
+
+#endif
+
#endif
diff --git a/linux-user/include/host/ppc/host-signal.h b/linux-user/include/host/ppc/host-signal.h
new file mode 100644
index 0000000..b80384d
--- /dev/null
+++ b/linux-user/include/host/ppc/host-signal.h
@@ -0,0 +1,38 @@
+/*
+ * host-signal.h: signal info dependent on the host architecture
+ *
+ * Copyright (c) 2003-2005 Fabrice Bellard
+ * Copyright (c) 2021 Linaro Limited
+ *
+ * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
+ * See the COPYING file in the top-level directory.
+ */
+
+#ifndef PPC_HOST_SIGNAL_H
+#define PPC_HOST_SIGNAL_H
+
+/* The third argument to a SA_SIGINFO handler is ucontext_t. */
+typedef ucontext_t host_sigcontext;
+
+static inline uintptr_t host_signal_pc(host_sigcontext *uc)
+{
+ return uc->uc_mcontext.regs->nip;
+}
+
+static inline void host_signal_set_pc(host_sigcontext *uc, uintptr_t pc)
+{
+ uc->uc_mcontext.regs->nip = pc;
+}
+
+static inline void *host_signal_mask(host_sigcontext *uc)
+{
+ return &uc->uc_sigmask;
+}
+
+static inline bool host_signal_write(siginfo_t *info, host_sigcontext *uc)
+{
+ return uc->uc_mcontext.regs->trap != 0x400
+ && (uc->uc_mcontext.regs->dsisr & 0x02000000);
+}
+
+#endif
diff --git a/linux-user/signal.c b/linux-user/signal.c
index 092e70b..b8dfa8a 100644
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -800,6 +800,7 @@ void queue_signal(CPUArchState *env, int sig, int si_type,
/* Adjust the signal context to rewind out of safe-syscall if we're in it */
static inline void rewind_if_in_safe_syscall(void *puc)
{
+#if !defined(__powerpc__) || defined(__powerpc64__)
host_sigcontext *uc = (host_sigcontext *)puc;
uintptr_t pcreg = host_signal_pc(uc);
@@ -807,6 +808,7 @@ static inline void rewind_if_in_safe_syscall(void *puc)
&& pcreg < (uintptr_t)safe_syscall_end) {
host_signal_set_pc(uc, (uintptr_t)safe_syscall_start);
}
+#endif
}
static void host_signal_handler(int host_sig, siginfo_t *info, void *puc)

View file

@ -1,39 +0,0 @@
Source: @pullmoll
Upstream: no
Reason: Target architectures with soft float do not define these constants.
--- a/tests/fp/fp-bench.c 2020-12-08 17:59:44.000000000 +0100
+++ b/tests/fp/fp-bench.c 2020-12-12 20:38:40.702235420 +0100
@@ -485,16 +485,32 @@
switch (rounding) {
case ROUND_EVEN:
+#if defined(FE_TONEAREST)
rhost = FE_TONEAREST;
+#else
+ return;
+#endif
break;
case ROUND_ZERO:
+#if defined(FE_TOWARDZERO)
rhost = FE_TOWARDZERO;
+#else
+ return;
+#endif
break;
case ROUND_DOWN:
+#if defined(FE_DOWNWARD)
rhost = FE_DOWNWARD;
+#else
+ return;
+#endif
break;
case ROUND_UP:
+#if defined(FE_UPWARD)
rhost = FE_UPWARD;
+#else
+ return;
+#endif
break;
case ROUND_TIEAWAY:
die_host_rounding(rounding);

View file

@ -1,72 +0,0 @@
From 5cb993ff131fca2abef3ce074a20258fd6fce557 Mon Sep 17 00:00:00 2001
From: Bernhard Beschow <shentey@gmail.com>
Date: Sat, 18 Mar 2023 19:59:31 +0100
Subject: [PATCH] qemu/osdep: Switch position of "extern" and "G_NORETURN"
Fixes the Windows build under msys2 using GCC 12 which fails with the following
error:
[184/579] Compiling C++ object qga/vss-win32/qga-vss.dll.p/install.cpp.obj
FAILED: qga/vss-win32/qga-vss.dll.p/install.cpp.obj
"c++" "-m64" "-mcx16" "-Iqga/vss-win32/qga-vss.dll.p" "-Iqga/vss-win32" "-I../src/qga/vss-win32" "-I." "-Iqapi" "-Itrace" "-Iui" "-Iui/shader" "-IC:/msys64/mingw64/include/glib-2.0" "-IC:/msys64/mingw64/lib/glib-2.0/include" "-fdiagnostics-color=auto" "-Wall" "-Winvalid-pch" "-Wnon-virtual-dtor" "-Werror" "-std=gnu++11" "-g" "-iquote" "." "-iquote" "C:/msys64/home/shentey/Projects/qemu/src" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/include" "-iquote" "C:/msys64/home/shentey/Projects/qemu/src/tcg/i386" "-D__STDC_LIMIT_MACROS" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-fno-pie" "-no-pie" "-D_GNU_SOURCE" "-D_FILE_OFFSET_BITS=64" "-D_LARGEFILE_SOURCE" "-fno-strict-aliasing" "-fno-common" "-fwrapv" "-Wundef" "-Wwrite-strings" "-Wtype-limits" "-Wformat-security" "-Wformat-y2k" "-Winit-self" "-Wignored-qualifiers" "-Wempty-body" "-Wendif-labels" "-Wexpansion-to-defined" "-Wimplicit-fallthrough=2" "-Wmissing-format-attribute" "-Wno-missing-include-dirs" "-Wno-shift-negative-value" "-Wno-psabi" "-fstack-protector-strong" "-Wno-unknown-pragmas" "-Wno-delete-non-virtual-dtor" "-Wno-non-virtual-dtor" -MD -MQ qga/vss-win32/qga-vss.dll.p/install.cpp.obj -MF "qga/vss-win32/qga-vss.dll.p/install.cpp.obj.d" -o qga/vss-win32/qga-vss.dll.p/install.cpp.obj "-c" ../src/qga/vss-win32/install.cpp
In file included from C:/msys64/mingw64/lib/glib-2.0/include/glibconfig.h:9,
from C:/msys64/mingw64/include/glib-2.0/glib/gtypes.h:34,
from C:/msys64/mingw64/include/glib-2.0/glib/galloca.h:34,
from C:/msys64/mingw64/include/glib-2.0/glib.h:32,
from C:/msys64/home/shentey/Projects/qemu/src/include/glib-compat.h:32,
from C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:144,
from ../src/qga/vss-win32/install.cpp:13:
C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: standard attributes in middle of decl-specifiers
1075 | # define G_NORETURN [[noreturn]]
| ^
C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
240 | extern G_NORETURN
| ^~~~~~~~~~
C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: standard attributes must precede the decl-specifiers to apply to the declaration, or follow them to apply to the type
1075 | # define G_NORETURN [[noreturn]]
| ^
C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
240 | extern G_NORETURN
| ^~~~~~~~~~
C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: error: attribute ignored [-Werror=attributes]
1075 | # define G_NORETURN [[noreturn]]
| ^
C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
240 | extern G_NORETURN
| ^~~~~~~~~~
C:/msys64/mingw64/include/glib-2.0/glib/gmacros.h:1075:21: note: an attribute that appertains to a type-specifier is ignored
1075 | # define G_NORETURN [[noreturn]]
| ^
C:/msys64/home/shentey/Projects/qemu/src/include/qemu/osdep.h:240:8: note: in expansion of macro 'G_NORETURN'
240 | extern G_NORETURN
| ^~~~~~~~~~
cc1plus.exe: all warnings being treated as errors
Apparently it also fixes the compilation with Clang 15 (see
https://gitlab.com/qemu-project/qemu/-/issues/1541 ).
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1541
Signed-off-by: Bernhard Beschow <shentey@gmail.com>
Message-Id: <20230318185931.181659-1-shentey@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
include/qemu/osdep.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/qemu/osdep.h b/include/qemu/osdep.h
index f68b5d8708c..9eff0be95bd 100644
--- a/include/qemu/osdep.h
+++ b/include/qemu/osdep.h
@@ -237,7 +237,7 @@ extern "C" {
* supports QEMU_ERROR, this will be reported at compile time; otherwise
* this will be reported at link time due to the missing symbol.
*/
-extern G_NORETURN
+G_NORETURN extern
void QEMU_ERROR("code path is reachable")
qemu_build_not_reached_always(void);
#if defined(__OPTIMIZE__) && !defined(__NO_INLINE__)
--
GitLab

View file

@ -0,0 +1,211 @@
Builds defines -D_FILE_OFFSET_BITS=64 which makes the original functions
anf macros behave same as their 64 suffixed counterparts. This also
helps in compiling with latest musl C library, where these macros and
functions are no more available under _GNU_SOURCE feature macro
source: https://git.alpinelinux.org/aports/plain/community/qemu/lfs64.patch
--
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index bbba2a6..38fa09a 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6812,13 +6812,13 @@ static int target_to_host_fcntl_cmd(int cmd)
ret = cmd;
break;
case TARGET_F_GETLK:
- ret = F_GETLK64;
+ ret = F_GETLK;
break;
case TARGET_F_SETLK:
- ret = F_SETLK64;
+ ret = F_SETLK;
break;
case TARGET_F_SETLKW:
- ret = F_SETLKW64;
+ ret = F_SETLKW;
break;
case TARGET_F_GETOWN:
ret = F_GETOWN;
@@ -6834,13 +6834,13 @@ static int target_to_host_fcntl_cmd(int cmd)
break;
#if TARGET_ABI_BITS == 32
case TARGET_F_GETLK64:
- ret = F_GETLK64;
+ ret = F_GETLK;
break;
case TARGET_F_SETLK64:
- ret = F_SETLK64;
+ ret = F_SETLK;
break;
case TARGET_F_SETLKW64:
- ret = F_SETLKW64;
+ ret = F_SETLKW;
break;
#endif
case TARGET_F_SETLEASE:
@@ -6894,8 +6894,8 @@ static int target_to_host_fcntl_cmd(int cmd)
* them to 5, 6 and 7 before making the syscall(). Since we make the
* syscall directly, adjust to what is supported by the kernel.
*/
- if (ret >= F_GETLK64 && ret <= F_SETLKW64) {
- ret -= F_GETLK64 - 5;
+ if (ret >= F_GETLK && ret <= F_SETLKW) {
+ ret -= F_GETLK - 5;
}
#endif
@@ -6928,7 +6928,7 @@ static int host_to_target_flock(int type)
return type;
}
-static inline abi_long copy_from_user_flock(struct flock64 *fl,
+static inline abi_long copy_from_user_flock(struct flock *fl,
abi_ulong target_flock_addr)
{
struct target_flock *target_fl;
@@ -6953,7 +6953,7 @@ static inline abi_long copy_from_user_flock(struct flock64 *fl,
}
static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
- const struct flock64 *fl)
+ const struct flock *fl)
{
struct target_flock *target_fl;
short l_type;
@@ -6972,8 +6972,8 @@ static inline abi_long copy_to_user_flock(abi_ulong target_flock_addr,
return 0;
}
-typedef abi_long from_flock64_fn(struct flock64 *fl, abi_ulong target_addr);
-typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock64 *fl);
+typedef abi_long from_flock64_fn(struct flock *fl, abi_ulong target_addr);
+typedef abi_long to_flock64_fn(abi_ulong target_addr, const struct flock *fl);
#if defined(TARGET_ARM) && TARGET_ABI_BITS == 32
struct target_oabi_flock64 {
@@ -6984,7 +6984,7 @@ struct target_oabi_flock64 {
abi_int l_pid;
} QEMU_PACKED;
-static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
+static inline abi_long copy_from_user_oabi_flock64(struct flock *fl,
abi_ulong target_flock_addr)
{
struct target_oabi_flock64 *target_fl;
@@ -7009,7 +7009,7 @@ static inline abi_long copy_from_user_oabi_flock64(struct flock64 *fl,
}
static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
- const struct flock64 *fl)
+ const struct flock *fl)
{
struct target_oabi_flock64 *target_fl;
short l_type;
@@ -7029,7 +7029,7 @@ static inline abi_long copy_to_user_oabi_flock64(abi_ulong target_flock_addr,
}
#endif
-static inline abi_long copy_from_user_flock64(struct flock64 *fl,
+static inline abi_long copy_from_user_flock64(struct flock *fl,
abi_ulong target_flock_addr)
{
struct target_flock64 *target_fl;
@@ -7054,7 +7054,7 @@ static inline abi_long copy_from_user_flock64(struct flock64 *fl,
}
static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
- const struct flock64 *fl)
+ const struct flock *fl)
{
struct target_flock64 *target_fl;
short l_type;
@@ -7075,7 +7075,7 @@ static inline abi_long copy_to_user_flock64(abi_ulong target_flock_addr,
static abi_long do_fcntl(int fd, int cmd, abi_ulong arg)
{
- struct flock64 fl64;
+ struct flock fl64;
#ifdef F_GETOWN_EX
struct f_owner_ex fox;
struct target_f_owner_ex *target_fox;
@@ -7347,7 +7347,7 @@ static inline abi_long target_truncate64(CPUArchState *cpu_env, const char *arg1
arg2 = arg3;
arg3 = arg4;
}
- return get_errno(truncate64(arg1, target_offset64(arg2, arg3)));
+ return get_errno(truncate(arg1, target_offset64(arg2, arg3)));
}
#endif
@@ -7361,7 +7361,7 @@ static inline abi_long target_ftruncate64(CPUArchState *cpu_env, abi_long arg1,
arg2 = arg3;
arg3 = arg4;
}
- return get_errno(ftruncate64(arg1, target_offset64(arg2, arg3)));
+ return get_errno(ftruncate(arg1, target_offset64(arg2, arg3)));
}
#endif
@@ -8597,7 +8597,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
void *tdirp;
int hlen, hoff, toff;
int hreclen, treclen;
- off64_t prev_diroff = 0;
+ off_t prev_diroff = 0;
hdirp = g_try_malloc(count);
if (!hdirp) {
@@ -8650,7 +8650,7 @@ static int do_getdents(abi_long dirfd, abi_long arg2, abi_long count)
* Return what we have, resetting the file pointer to the
* location of the first record not returned.
*/
- lseek64(dirfd, prev_diroff, SEEK_SET);
+ lseek(dirfd, prev_diroff, SEEK_SET);
break;
}
@@ -8684,7 +8684,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
void *tdirp;
int hlen, hoff, toff;
int hreclen, treclen;
- off64_t prev_diroff = 0;
+ off_t prev_diroff = 0;
hdirp = g_try_malloc(count);
if (!hdirp) {
@@ -8726,7 +8726,7 @@ static int do_getdents64(abi_long dirfd, abi_long arg2, abi_long count)
* Return what we have, resetting the file pointer to the
* location of the first record not returned.
*/
- lseek64(dirfd, prev_diroff, SEEK_SET);
+ lseek(dirfd, prev_diroff, SEEK_SET);
break;
}
@@ -11157,7 +11157,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
return -TARGET_EFAULT;
}
}
- ret = get_errno(pread64(arg1, p, arg3, target_offset64(arg4, arg5)));
+ ret = get_errno(pread(arg1, p, arg3, target_offset64(arg4, arg5)));
unlock_user(p, arg2, ret);
return ret;
case TARGET_NR_pwrite64:
@@ -11174,7 +11174,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
return -TARGET_EFAULT;
}
}
- ret = get_errno(pwrite64(arg1, p, arg3, target_offset64(arg4, arg5)));
+ ret = get_errno(pwrite(arg1, p, arg3, target_offset64(arg4, arg5)));
unlock_user(p, arg2, 0);
return ret;
#endif
@@ -12034,7 +12034,7 @@ static abi_long do_syscall1(CPUArchState *cpu_env, int num, abi_long arg1,
case TARGET_NR_fcntl64:
{
int cmd;
- struct flock64 fl;
+ struct flock fl;
from_flock64_fn *copyfrom = copy_from_user_flock64;
to_flock64_fn *copyto = copy_to_user_flock64;

View file

@ -1,42 +0,0 @@
Source: @pullmoll
Upstream: no
Reason: errno=EFAULT when the address passed to mremap(2) is not valid
See Rich Felker's comment at https://www.openwall.com/lists/musl/2017/06/21/2 for
why we need to return errno as described in man mremap(2) from qemu-user-static.
Also speed up the loop when checking for increasing the mappings size to go
in steps of TARGET_PAGE_SIZE and OR-in a check for the very last byte of the range.
diff --git linux-user/mmap.c linux-user/mmap.c
index 7e3b245..1e8d0f1 100644
--- a/linux-user/mmap.c
+++ b/linux-user/mmap.c
@@ -738,7 +738,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
!guest_range_valid_untagged(new_addr, new_size)) ||
((flags & MREMAP_MAYMOVE) == 0 &&
!guest_range_valid_untagged(old_addr, new_size))) {
- errno = ENOMEM;
+ errno = EFAULT;
return -1;
}
@@ -775,9 +775,10 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
abi_ulong addr;
for (addr = old_addr + old_size;
addr < old_addr + new_size;
- addr++) {
+ addr += TARGET_PAGE_SIZE) {
prot |= page_get_flags(addr);
}
+ prot |= page_get_flags(old_addr + new_size - 1);
}
if (prot == 0) {
host_addr = mremap(g2h_untagged(old_addr),
@@ -796,7 +797,7 @@ abi_long target_mremap(abi_ulong old_addr, abi_ulong old_size,
}
}
} else {
- errno = ENOMEM;
+ errno = EFAULT;
host_addr = MAP_FAILED;
}
}

View file

@ -1,10 +1,10 @@
Source: https://github.com/void-linux/void-packages/issues/23557
diff --git linux-user/syscall.c linux-user/syscall.c
index 945fc25..8d8b68a 100644
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 14fdebd..de280af 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -3071,7 +3071,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
@@ -3229,7 +3229,7 @@ static abi_long do_sendrecvmsg_locked(int fd, struct target_msghdr *msgp,
int flags, int send)
{
abi_long ret, len;

View file

@ -1,25 +0,0 @@
--- a/linux-user/signal.c
+++ b/linux-user/signal.c
@@ -21,5 +21,9 @@
#include "exec/gdbstub.h"
#include "hw/core/tcg-cpu-ops.h"
+#if defined(_ARCH_PPC64) && !defined(__GLIBC__) /* musl */
+#include <asm/ptrace.h>
+#endif
+
#include <sys/ucontext.h>
#include <sys/resource.h>
--- a/util/mmap-alloc.c
+++ b/util/mmap-alloc.c
@@ -25,6 +25,10 @@
#ifdef CONFIG_LINUX
#include <sys/vfs.h>
+/* musl undefs this on ppc and mips */
+#ifndef MAP_SYNC
+#define MAP_SYNC 0x80000
+#endif
#endif
size_t qemu_fd_getpagesize(int fd)

View file

@ -1,13 +0,0 @@
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -141,6 +141,10 @@
#include "fd-trans.h"
#include "tcg/tcg.h"
+#ifndef RLIMIT_RTTIME
+#define RLIMIT_RTTIME 15
+#endif
+
#ifndef CLONE_IO
#define CLONE_IO 0x80000000 /* Clone io context */
#endif

View file

@ -1,60 +0,0 @@
capstone 5 declares this struct, so we need a different name
--
diff --git a/target/tricore/cpu.c b/target/tricore/cpu.c
index d0a9272..6297af9 100644
--- a/target/tricore/cpu.c
+++ b/target/tricore/cpu.c
@@ -103,14 +103,14 @@ static void tricore_cpu_realizefn(DeviceState *dev, Error **errp)
}
/* Some features automatically imply others */
- if (tricore_feature(env, TRICORE_FEATURE_161)) {
+ if (tricore_feature_x(env, TRICORE_FEATURE_161)) {
set_feature(env, TRICORE_FEATURE_16);
}
- if (tricore_feature(env, TRICORE_FEATURE_16)) {
+ if (tricore_feature_x(env, TRICORE_FEATURE_16)) {
set_feature(env, TRICORE_FEATURE_131);
}
- if (tricore_feature(env, TRICORE_FEATURE_131)) {
+ if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
set_feature(env, TRICORE_FEATURE_13);
}
cpu_reset(cs);
diff --git a/target/tricore/cpu.h b/target/tricore/cpu.h
index 47d0ffb..6fd447c 100644
--- a/target/tricore/cpu.h
+++ b/target/tricore/cpu.h
@@ -258,7 +258,7 @@ enum tricore_features {
TRICORE_FEATURE_161,
};
-static inline int tricore_feature(CPUTriCoreState *env, int feature)
+static inline int tricore_feature_x(CPUTriCoreState *env, int feature)
{
return (env->features & (1ULL << feature)) != 0;
}
diff --git a/target/tricore/op_helper.c b/target/tricore/op_helper.c
index 532ae6b..6a71b5b 100644
--- a/target/tricore/op_helper.c
+++ b/target/tricore/op_helper.c
@@ -2528,7 +2528,7 @@ void helper_ret(CPUTriCoreState *env)
/* PCXI = new_PCXI; */
env->PCXI = new_PCXI;
- if (tricore_feature(env, TRICORE_FEATURE_13)) {
+ if (tricore_feature_x(env, TRICORE_FEATURE_13)) {
/* PSW = new_PSW */
psw_write(env, new_PSW);
} else {
@@ -2639,7 +2639,7 @@ void helper_rfm(CPUTriCoreState *env)
env->gpr_a[10] = cpu_ldl_data(env, env->DCX+8);
env->gpr_a[11] = cpu_ldl_data(env, env->DCX+12);
- if (tricore_feature(env, TRICORE_FEATURE_131)) {
+ if (tricore_feature_x(env, TRICORE_FEATURE_131)) {
env->DBGTCR = 0;
}
}

View file

@ -1,113 +0,0 @@
From 7ece08d7902d5a8c007deeb0b75cb533a41dd882 Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Sun, 7 Mar 2021 01:47:42 +0100
Subject: [PATCH] support ppcle architecture
---
configure | 14 ++++++++++++--
configs/targets/ppcle-linux-user.mak | 4 ++++
linux-user/ppc/target_syscall.h | 4 ++++
scripts/qemu-binfmt-conf.sh | 6 +++++-
tests/tcg/configure.sh | 2 ++
5 files changed, 27 insertions(+), 3 deletions(-)
create mode 100644 configs/targets/ppcle-linux-user.mak
diff --git a/configure b/configure
index 18c26e0..03d3e18 100755
--- a/configure
+++ b/configure
@@ -653,7 +653,11 @@ elif check_define _ARCH_PPC ; then
cpu="ppc64"
fi
else
- cpu="ppc"
+ if check_define _LITTLE_ENDIAN ; then
+ cpu="ppcle"
+ else
+ cpu="ppc"
+ fi
fi
elif check_define __mips__ ; then
cpu="mips"
@@ -638,6 +642,9 @@
ppc)
CPU_CFLAGS="-m32" ;;
+ ppcle)
+ cpu="ppc"
+ CPU_CFLAGS="-m32 -mlittle-endian" ;;
ppc64)
CPU_CFLAGS="-m64 -mbig-endian" ;;
ppc64le)
diff --git a/configs/targets/ppcle-linux-user.mak b/configs/targets/ppcle-linux-user.mak
new file mode 100644
index 0000000..2259243
--- /dev/null
+++ b/configs/targets/ppcle-linux-user.mak
@@ -0,0 +1,4 @@
+TARGET_ARCH=ppc
+TARGET_SYSTBL_ABI=common,nospu,32
+TARGET_SYSTBL=syscall.tbl
+TARGET_XML_FILES= gdb-xml/power-core.xml gdb-xml/power-fpu.xml gdb-xml/power-altivec.xml gdb-xml/power-spe.xml
diff --git a/linux-user/ppc/target_syscall.h b/linux-user/ppc/target_syscall.h
index b9c4b81..cf26497 100644
--- a/linux-user/ppc/target_syscall.h
+++ b/linux-user/ppc/target_syscall.h
@@ -65,7 +65,11 @@ struct target_revectored_struct {
#define UNAME_MACHINE "ppc64le"
#endif
#else
+#if TARGET_BIG_ENDIAN
#define UNAME_MACHINE "ppc"
+#else
+#define UNAME_MACHINE "ppcle"
+#endif
#endif
#define UNAME_MINIMUM_RELEASE "2.6.32"
diff --git a/scripts/qemu-binfmt-conf.sh b/scripts/qemu-binfmt-conf.sh
index 9f1580a..393943f 100755
--- a/scripts/qemu-binfmt-conf.sh
+++ b/scripts/qemu-binfmt-conf.sh
@@ -46,6 +46,10 @@ ppc_magic='\x7fELF\x01\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x
ppc_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
ppc_family=ppc
+ppcle_magic='\x7fELF\x01\x01\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x14\x00'
+ppcle_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff\x00'
+ppc_family=ppcle
+
ppc64_magic='\x7fELF\x02\x02\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x02\x00\x15'
ppc64_mask='\xff\xff\xff\xff\xff\xff\xff\x00\xff\xff\xff\xff\xff\xff\xff\xff\xff\xfe\xff\xff'
ppc64_family=ppc
@@ -148,7 +152,7 @@ qemu_get_family() {
"Power Macintosh"|ppc64|powerpc|ppc)
echo "ppc"
;;
- ppc64el|ppc64le)
+ ppc64el|ppc64le|ppcel|ppcle)
echo "ppcle"
;;
arm|armel|armhf|arm64|armv[4-9]*l|aarch64)
diff --git a/configure b/configure
index 72ab03f11a..0691929d76 100755
--- a/configure
+++ b/configure
@@ -1866,6 +1866,7 @@ fi
: ${cross_prefix_mips="mips-linux-gnu-"}
: ${cross_prefix_nios2="nios2-linux-gnu-"}
: ${cross_prefix_ppc="powerpc-linux-gnu-"}
+: ${cross_prefix_ppcle="powerpcle-linux-gnu-"}
: ${cross_prefix_ppc64="powerpc64-linux-gnu-"}
: ${cross_prefix_ppc64le="$cross_prefix_ppc64"}
: ${cross_prefix_riscv64="riscv64-linux-gnu-"}
@@ -1883,6 +1884,7 @@ fi
: ${cross_cc_cflags_hexagon="-mv67 -O2 -static"}
: ${cross_cc_cflags_i386="-m32"}
: ${cross_cc_cflags_ppc="-m32 -mbig-endian"}
+: ${cross_cc_cflags_ppcle="-m32"}
: ${cross_cc_cflags_ppc64="-m64 -mbig-endian"}
: ${cross_cc_ppc64le="$cross_cc_ppc64"}
: ${cross_cc_cflags_ppc64le="-m64 -mlittle-endian"}
2.30.1

View file

@ -1,8 +1,8 @@
# Template file for 'qemu'
# This package should be updated together with qemu-user-static
pkgname=qemu
version=7.1.0
revision=3
version=8.1.0
revision=1
build_style=configure
configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --localstatedir=/var
--disable-glusterfs --disable-xen --enable-docs --enable-kvm --enable-libusb --enable-pie
@ -10,10 +10,10 @@ configure_args="--prefix=/usr --sysconfdir=/etc --libexecdir=/usr/libexec --loca
--audio-drv-list=alsa$(vopt_if sdl2 ,sdl)$(vopt_if jack ,jack)$(vopt_if pulseaudio ,pa)
$(vopt_enable opengl) $(vopt_enable pulseaudio pa) $(vopt_enable sdl2 sdl) $(vopt_enable smartcard)
$(vopt_enable spice) $(vopt_enable virgl virglrenderer) $(vopt_if gtk3 '--enable-gtk')"
hostmakedepends="gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
hostmakedepends="flex glib-devel gettext pkg-config perl python3 python3-Sphinx python3-sphinx_rtd_theme ninja"
makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-devel
snappy-devel libuuid-devel libX11-devel alsa-lib-devel libaio-devel gnutls-devel
libsasl-devel libglib-devel ncurses-devel libseccomp-devel nss-devel
libsasl-devel ncurses-devel libseccomp-devel nss-devel
libcurl-devel xfsprogs-devel libcap-ng-devel vde2-devel usbredir-devel
libbluetooth-devel libssh2-devel libusb-devel libnfs-devel libslirp-devel
libxkbcommon-devel libzstd-devel $(vopt_if sdl2 'SDL2-devel SDL2_image-devel')
@ -25,18 +25,17 @@ makedepends="capstone-devel dtc-devel libpng-devel libjpeg-turbo-devel pixman-de
$(vopt_if jack 'jack-devel') $(vopt_if pulseaudio 'pulseaudio-devel')"
short_desc="Open Source Processor Emulator"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, LGPL-2.1-or-later"
license="GPL-2.0-only, LGPL-2.1-only"
homepage="https://www.qemu.org"
distfiles="https://wiki.qemu.org/download/qemu-${version}.tar.bz2"
checksum=f7ac2b85b3f1831e6810b140306e30af91556e15784864b209f3942858947fd0
checksum=53a2388f4f67d03e94ed7fe192d8828e64c535fadf7bf9dd0bc1d2091eedf624
ignore_elf_dirs="/usr/share/qemu"
nostrip_files="hppa-firmware.img openbios-ppc openbios-sparc32 openbios-sparc64
palcode-clipper s390-ccw.img s390-netboot.img u-boot.e500 opensbi-riscv32-generic-fw_dynamic.elf
opensbi-riscv64-generic-fw_dynamic.elf"
make_check=no # capstone5.0: fails 90/95 qemu:unit / test-vmstate (when updating the qemu package this should go away)
build_options="gtk3 opengl sdl2 spice virgl smartcard numa iscsi jack pulseaudio"
build_options_default="opengl gtk3 virgl sdl2 numa iscsi jack pulseaudio"
build_options="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
build_options_default="gtk3 iscsi jack numa opengl pulseaudio sdl2 smartcard spice virgl"
desc_option_sdl2="Enable SDL (2.x) video output"
desc_option_spice="Enable support for SPICE"
desc_option_virgl="Enable support for VirGL (A Virtual 3D GPU renderer)"
@ -44,33 +43,10 @@ desc_option_smartcard="Enable smartcard support"
desc_option_numa="Enable support for host NUMA"
desc_option_iscsi="Enable support for iSCSI"
case "$XBPS_TARGET_MACHINE" in
aarch64-musl) CFLAGS="-D_LINUX_SYSINFO_H";;
esac
if [ "$XBPS_TARGET_ENDIAN" = "le" ]; then
build_options_default+=" spice"
fi
if [ "$CROSS_BUILD" ]; then
configure_args+=" --cross-prefix=${XBPS_CROSS_TRIPLET}-"
else
build_options_default+=" smartcard"
fi
post_extract() {
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
grep -rl 'Input/output error' tests/qemu-iotests |
xargs -n1 sed -i -e 's;Input/output error;I/O error;g'
grep -rl 'Operation not supported' tests/qemu-iotests |
xargs -n1 sed -i -e 's;Operation not supported;Not supported;g'
fi
}
pre_configure() {
unset CPP
}
post_install() {
vdoc "${FILESDIR}/README.voidlinux"