Skip to contentSkip to conversation

ppc: Include asm/ptrace.h for pt_regs struct definition

PATCH In review Khem Raj 5 participants 5 messages Mar 14, 2022

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH v2 1/1 ppc: Include asm/ptrace.h for pt_regs struct definition

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

    return uc->uc_mcontext.regs->nip;
           ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>

---
v2: Drop ifdef __powerpc__

 linux-user/include/host/ppc/host-signal.h | 3 +++
 1 file changed, 3 insertions(+)
linux-user/include/host/ppc/host-signal.h +3 -0
index b80384d135..ec6166ed66 100644
@@ -11,6 +11,9 @@
 #ifndef PPC_HOST_SIGNAL_H
 #define PPC_HOST_SIGNAL_H
 
+/* needed for pt_regs */
+#include <asm/ptrace.h>
+
 /* The third argument to a SA_SIGINFO handler is ucontext_t. */
 typedef ucontext_t host_sigcontext;
 
Signature · 1 line
2.35.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 20 lines · Khem Raj

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

     return uc->uc_mcontext.regs->nip;
            ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell <[email protected]>
Cc Philippe Mathieu-Daudé <[email protected]>
Cc Richard Henderson <[email protected]>

---
v2: Drop ifdef __powerpc__

  linux-user/include/host/ppc/host-signal.h | 3 +++
  1 file changed, 3 insertions(+)
linux-user/include/host/ppc/host-signal.h +0 -0
index b80384d135..ec6166ed66 100644

linux-user/include/host/ppc/host-signal.h line 16

Quoted 6 lines
linux-user/include/host/ppc/host-signal.h +3 -0
@@ -11,6 +11,9 @@
  #ifndef PPC_HOST_SIGNAL_H
  #define PPC_HOST_SIGNAL_H
 
+/* needed for pt_regs */
+#include <asm/ptrace.h>
+

I am intrigued about why we didn't hit this before, especially considering that ppc64 header is just a pointer to this file.

I looked it up and didn't find why. This change seems harmless to me though.

Quoted 3 lines
linux-user/include/host/ppc/host-signal.h +0 -0
  /* The third argument to a SA_SIGINFO handler is ucontext_t. */
  typedef ucontext_t host_sigcontext;
 
#2 lore raw
Quoted 2 lines · Daniel Henrique Barboza

I am intrigued about why we didn't hit this before, especially considering that ppc64 header is just a pointer to this file.

It's specific to musl, which does different things with its system includes than glibc does.

-- PMM

#3 lore raw
Quoted 7 lines · Peter Maydell
Quoted 2 lines · Daniel Henrique Barboza

I am intrigued about why we didn't hit this before, especially considering that ppc64 header is just a pointer to this file.

It's specific to musl, which does different things with its system includes than glibc does.

And while we have CI testing for QEMU with Alpine that uses musl, this is only x86_64 host. IOW we don't have CI coverage of ppc64 host with musl, only glibc

Regards,
Daniel

Signature · 3 lines
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
#4 lore raw
In reply to Khem Raj
Quoted 9 lines · Khem Raj

Fixes
../qemu-6.2.0/linux-user/host/ppc64/../ppc/host-signal.h:16:32: error: incomplete definition of type 'struct pt_regs'

     return uc->uc_mcontext.regs->nip;
            ~~~~~~~~~~~~~~~~~~~~^
Cc Peter Maydell<[email protected]>
Cc Philippe Mathieu-Daudé<[email protected]>
Cc Richard Henderson<[email protected]>
Quoted 5 lines

---
v2: Drop ifdef __powerpc__

  linux-user/include/host/ppc/host-signal.h | 3 +++
  1 file changed, 3 insertions(+)

As per late conversation vs version 1, instead of the include, we should update the code to avoid the pt_regs indirection and instead reference gp_regs directly.

We should also move the file to ../ppc64/, leaving ppc/ empty.

r~