aboutsummaryrefslogtreecommitdiffstats
path: root/community/qemu/fix-ppc.patch
blob: df2fcff6f623122bd1296ffad701f03affe2471d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/linux-user/host/ppc/host-signal.h b/linux-user/host/ppc/host-signal.h
index 1d8e658..6ba11fc 100644
--- a/linux-user/host/ppc/host-signal.h
+++ b/linux-user/host/ppc/host-signal.h
@@ -13,18 +13,31 @@
 
 static inline uintptr_t host_signal_pc(ucontext_t *uc)
 {
+#if defined(__linux__) && !(defined (__GLIBC__) || defined(__UCLIBC__)) // musl libc
+    return uc->uc_mcontext.gp_regs[32];
+#else
     return uc->uc_mcontext.regs->nip;
+#endif
 }
 
 static inline void host_signal_set_pc(ucontext_t *uc, uintptr_t pc)
 {
+#if defined(__linux__) && !(defined (__GLIBC__) || defined(__UCLIBC__)) // musl libc
+    uc->uc_mcontext.gp_regs[32] = pc;
+#else
     uc->uc_mcontext.regs->nip = pc;
+#endif
 }
 
 static inline bool host_signal_write(siginfo_t *info, ucontext_t *uc)
 {
+#if defined(__linux__) && !(defined (__GLIBC__) || defined(__UCLIBC__)) // musl libc
+    return uc->uc_mcontext.gp_regs[40] != 0x400
+        && (uc->uc_mcontext.gp_regs[42] & 0x02000000);
+#else
     return uc->uc_mcontext.regs->trap != 0x400
         && (uc->uc_mcontext.regs->dsisr & 0x02000000);
+#endif
 }
 
 #endif