[PATCH v3 51/87] linux-user/s390x: Create target_ptrace.h

Richard Henderson posted 87 patches 1 month ago
[PATCH v3 51/87] linux-user/s390x: Create target_ptrace.h
Posted by Richard Henderson 1 month ago
Move target_psw_t to target_ptrace.h.
Remove the target_pt_regs; add target_s390x_reg to target_ptrace.h,
which matches what is actually used.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 linux-user/s390x/target_ptrace.h  | 18 ++++++++++++++++++
 linux-user/s390x/target_syscall.h | 22 ----------------------
 linux-user/s390x/signal.c         |  1 +
 3 files changed, 19 insertions(+), 22 deletions(-)
 create mode 100644 linux-user/s390x/target_ptrace.h

diff --git a/linux-user/s390x/target_ptrace.h b/linux-user/s390x/target_ptrace.h
new file mode 100644
index 0000000000..a5ceb75a74
--- /dev/null
+++ b/linux-user/s390x/target_ptrace.h
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+
+#ifndef S390X_TARGET_PTRACE_H
+#define S390X_TARGET_PTRACE_H
+
+typedef struct {
+    abi_ulong mask;
+    abi_ulong addr;
+} target_psw_t;
+
+struct target_s390_regs {
+    target_psw_t psw;
+    abi_ulong gprs[16];
+    abi_uint acrs[16];
+    abi_ulong orig_gpr2;
+};
+
+#endif /* S390X_TARGET_PTRACE_H */
diff --git a/linux-user/s390x/target_syscall.h b/linux-user/s390x/target_syscall.h
index 4018988a25..f01f9a0baa 100644
--- a/linux-user/s390x/target_syscall.h
+++ b/linux-user/s390x/target_syscall.h
@@ -1,28 +1,6 @@
 #ifndef S390X_TARGET_SYSCALL_H
 #define S390X_TARGET_SYSCALL_H
 
-/* this typedef defines how a Program Status Word looks like */
-typedef struct {
-    abi_ulong mask;
-    abi_ulong addr;
-} __attribute__ ((aligned(8))) target_psw_t;
-
-/*
- * The pt_regs struct defines the way the registers are stored on
- * the stack during a system call.
- */
-
-#define TARGET_NUM_GPRS        16
-
-struct target_pt_regs {
-    abi_ulong args[1];
-    target_psw_t psw;
-    abi_ulong gprs[TARGET_NUM_GPRS];
-    abi_ulong orig_gpr2;
-    unsigned short ilen;
-    unsigned short trap;
-};
-
 #define UNAME_MACHINE "s390x"
 #define UNAME_MINIMUM_RELEASE "2.6.32"
 
diff --git a/linux-user/s390x/signal.c b/linux-user/s390x/signal.c
index df49c24708..96d1c8d11c 100644
--- a/linux-user/s390x/signal.c
+++ b/linux-user/s390x/signal.c
@@ -22,6 +22,7 @@
 #include "signal-common.h"
 #include "linux-user/trace.h"
 #include "vdso-asmoffset.h"
+#include "target_ptrace.h"
 
 #define __NUM_GPRS 16
 #define __NUM_FPRS 16
-- 
2.43.0
Re: [PATCH v3 51/87] linux-user/s390x: Create target_ptrace.h
Posted by Peter Maydell 1 month ago
On Thu, 28 Aug 2025 at 13:14, Richard Henderson
<richard.henderson@linaro.org> wrote:
>
> Move target_psw_t to target_ptrace.h.
> Remove the target_pt_regs; add target_s390x_reg to target_ptrace.h,
> which matches what is actually used.
>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>  linux-user/s390x/target_ptrace.h  | 18 ++++++++++++++++++
>  linux-user/s390x/target_syscall.h | 22 ----------------------
>  linux-user/s390x/signal.c         |  1 +
>  3 files changed, 19 insertions(+), 22 deletions(-)
>  create mode 100644 linux-user/s390x/target_ptrace.h
>
> diff --git a/linux-user/s390x/target_ptrace.h b/linux-user/s390x/target_ptrace.h
> new file mode 100644
> index 0000000000..a5ceb75a74
> --- /dev/null
> +++ b/linux-user/s390x/target_ptrace.h
> @@ -0,0 +1,18 @@
> +/* SPDX-License-Identifier: GPL-2.0-or-later */
> +
> +#ifndef S390X_TARGET_PTRACE_H
> +#define S390X_TARGET_PTRACE_H
> +
> +typedef struct {
> +    abi_ulong mask;
> +    abi_ulong addr;
> +} target_psw_t;
> +
> +struct target_s390_regs {
> +    target_psw_t psw;
> +    abi_ulong gprs[16];
> +    abi_uint acrs[16];
> +    abi_ulong orig_gpr2;
> +};
> +
> +#endif /* S390X_TARGET_PTRACE_H */
> diff --git a/linux-user/s390x/target_syscall.h b/linux-user/s390x/target_syscall.h
> index 4018988a25..f01f9a0baa 100644
> --- a/linux-user/s390x/target_syscall.h
> +++ b/linux-user/s390x/target_syscall.h
> @@ -1,28 +1,6 @@
>  #ifndef S390X_TARGET_SYSCALL_H
>  #define S390X_TARGET_SYSCALL_H
>
> -/* this typedef defines how a Program Status Word looks like */
> -typedef struct {
> -    abi_ulong mask;
> -    abi_ulong addr;
> -} __attribute__ ((aligned(8))) target_psw_t;

You might mention in the commit message that abi_ulong
already has an aligned attribute which for s390 will be 8,
so it's OK to drop the attribute on the struct here.

Otherwise
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>

thanks
-- PMM