mirror of
https://github.com/void-linux/void-packages.git
synced 2025-04-23 09:37:02 +02:00
qemu, qemu-user-static: fix build on ppc32
This commit is contained in:
parent
b3329ed67a
commit
a5107e6a03
1 changed files with 117 additions and 0 deletions
117
srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
Normal file
117
srcpkgs/qemu/patches/fix-linux-user-ppc32.patch
Normal file
|
@ -0,0 +1,117 @@
|
|||
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)
|
Loading…
Add table
Reference in a new issue