[RFC 13/28] [SFrame-V3] include: sframe: s390x: keep unused bits when possible
Jens Remus
jremus@linux.ibm.com
Fri Dec 12 16:28:29 GMT 2025
Hello Indu,
a small nit below. Otherwise sharing my thoughts.
On 12/9/2025 10:07 AM, Indu Bhagat wrote:
> TBD:
> - This is a backwards incompatible change. But its better to keep unused
> bits for future extensibility. Discuss with s390x SFrame maintainer.
s390x may save FP/RA in registers when in the topmost frame, e.g. when
in leaf function. Currently it does so in floating-point registers.
These have the DWARF register numbers 16-31 on s390x. With the left
shift by 3 these do no longer fit into a signed 8-bit offset:
16 << 3 = 128
31 << 3 = 248
When considering this I would also evaluate whether it wouldn't be the
better choice to use the new FLEX_TOPMOST_FRAME and get rid of this
s390x-particularity.
I am working on a prototype to get some numbers for Glibc:
git://sourceware.org/git/binutils-gdb.git users/jremus/sframe-v3-c1-s390x
https://sourceware.org/git/?p=binutils-gdb.git;a=shortlog;h=refs/heads/users/jremus/sframe-v3-c1-s390x
> diff --git a/libsframe/sframe-dump.c b/libsframe/sframe-dump.c
> @@ -46,6 +46,30 @@ is_sframe_abi_arch_s390x (const sframe_decoder_ctx *sfd_ctx)
> return sframe_decoder_get_abi_arch (sfd_ctx) == SFRAME_ABI_S390X_ENDIAN_BIG;
> }
>
> +static bool
> +sframe_s390x_offset_regnum_p (int32_t offset, uint8_t ver)
> +{
> + if (ver == SFRAME_VERSION_2)
> + return SFRAME_V2_S390X_OFFSET_IS_REGNUM (offset);
> + else if (ver == SFRAME_VERSION_3)
> + return SFRAME_V3_S390X_OFFSET_IS_REGNUM (offset);
> + else
> + /* No other version is supported yet. */
> + sframe_assert (false);
> +}
> +
> +static int
> +sframe_s390x_offset_decode_regnum (int32_t offset, uint8_t ver)
> +{
> + if (ver == SFRAME_VERSION_2)
> + return SFRAME_V2_S390X_OFFSET_DECODE_REGNUM (offset);
> + else if (ver == SFRAME_VERSION_3)
> + return SFRAME_V3_S390X_OFFSET_DECODE_REGNUM (offset);
> + else
> + /* No other version is supported yet. */
> + sframe_assert (false);
> +}
> +
> static void
> dump_sframe_header_flags (const sframe_decoder_ctx *sfd_ctx)
> {
> @@ -230,8 +254,9 @@ dump_sframe_func_with_fres (const sframe_decoder_ctx *sfd_ctx,
> if (err[1] == 0)
> {
> if (is_sframe_abi_arch_s390x (sfd_ctx)
> - && SFRAME_V2_S390X_OFFSET_IS_REGNUM (fp_offset))
> - sprintf (temp, "r%d", SFRAME_V2_S390X_OFFSET_DECODE_REGNUM (fp_offset));
> + && sframe_s390x_offset_regnum_p (fp_offset, ver))
> + sprintf (temp, "r%d",
> + sframe_s390x_offset_decode_regnum (fp_offset, ver));
> else
> sprintf (temp, "c%+d", fp_offset);
> }
> @@ -253,7 +278,8 @@ dump_sframe_func_with_fres (const sframe_decoder_ctx *sfd_ctx,
> {
> if (is_sframe_abi_arch_s390x (sfd_ctx)
> && SFRAME_V2_S390X_OFFSET_IS_REGNUM (ra_offset))
&& sframe_s390x_offset_regnum_p (ra_offset, ver))
> - sprintf (temp, "r%d", SFRAME_V2_S390X_OFFSET_DECODE_REGNUM (ra_offset));
> + sprintf (temp, "r%d",
> + sframe_s390x_offset_decode_regnum (ra_offset, ver));
> else
> sprintf (temp, "c%+d", ra_offset);
> }
Regards,
Jens
--
Jens Remus
Linux on Z Development (D3303)
+49-7031-16-1128 Office
jremus@de.ibm.com
IBM
IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
IBM Data Privacy Statement: https://www.ibm.com/privacy/
More information about the Binutils
mailing list