qemu: add patches to fix build on ppc64(le)-musl

The musl headers are laid out differently, so it needs a couple
workarounds to get access to all the definitions.

This also fixes qemu-user-static.

[ci skip]

Closes: #11373 [via git-merge-pr]
This commit is contained in:
q66 2019-04-28 19:48:35 +02:00 committed by Jürgen Buchmüller
parent 7a08534cbf
commit bd05206403
2 changed files with 28 additions and 0 deletions

View file

@ -0,0 +1,12 @@
This include is necessary to get PT_NIP on musl.
--- linux-user/host/ppc64/hostdep.h
+++ linux-user/host/ppc64/hostdep.h
@@ -17,6 +17,8 @@
#ifndef __ASSEMBLER__
+#include <asm/ptrace.h>
+
/* These are defined by the safe-syscall.inc.S file */
extern char safe_syscall_start[];
extern char safe_syscall_end[];

View file

@ -0,0 +1,16 @@
On musl, the regs field in uc_mcontext is void * so it is necessary to
cast it. The sys/user.h include is to get access to definition of pt_regs.
--- accel/tcg/user-exec.c
+++ accel/tcg/user-exec.c
@@ -285,9 +285,10 @@ int cpu_signal_handler(int host_signum, void *pinfo,
* From Wine
*/
#ifdef linux
+#include <sys/user.h>
/* All Registers access - only for local access */
#define REG_sig(reg_name, context) \
- ((context)->uc_mcontext.regs->reg_name)
+ (((struct pt_regs *)(context)->uc_mcontext.regs)->reg_name)
/* Gpr Registers access */
#define GPR_sig(reg_num, context) REG_sig(gpr[reg_num], context)
/* Program counter */