[PATCH v2 04/11] s390: Represent FP/RA saved in register in SFrame
Jens Remus
jremus@linux.ibm.com
Fri Jun 6 12:30:20 GMT 2025
On 27.05.2025 13:07, Jens Remus wrote:
> include/
> * sframe.h (SFRAME_S390X_OFFSET_IS_REGNUM): New s390x-specific
> macro to test whether an SFrame FP/RA offset is a DWARF register
> number.
> (SFRAME_S390X_OFFSET_ENCODE_REGNUM): New s390x-specific macro to
> encode a DWARF register number into an SFrame FP/RA offset.
> (SFRAME_S390X_OFFSET_DECODE_REGNUM): New s390x-specific macro to
> decode an SFrame FP/RA offset into a DWARF register number.
> * sframe-api.h (sframe_fre_get_fp_offset,
> sframe_fre_get_fp_offset): Add comment that for s390x the offset
> may be an encoded register number.
> (sframe_fre_get_ra_offset): Add comment that for s390x an offset
> value of SFRAME_FRE_RA_OFFSET_INVALID indicates that the RA is
> not saved.
SFRAME_FRE_RA_OFFSET_INVALID is introduced in the next patch. I'll move
this accordingly in V3 of my series.
> libsframe/
> * sframe.c (sframe_fre_get_fp_offset, sframe_fre_get_fp_offset):
> Add comment that for s390x the offset may be an encoded register
> number.
> (sframe_fre_get_ra_offset): Add comment that for s390x an offset
> value of SFRAME_FRE_RA_OFFSET_INVALID indicates that the RA is
> not saved.
Ditto.
> * sframe-dump.c (is_sframe_abi_arch_s390x): New helper to test
> whether ABI/arch is s390x.
> (dump_sframe_func_with_fres): Use SFRAME_S390X_OFFSET_IS_REGNUM
> and SFRAME_S390X_OFFSET_DECODE_REGNUM to dump FP/RA saved in
> another register on s390x.
> * doc/sframe-spec.texi (s390x): Document s390x-specific
> representation of FP/RA saved in another register.
> Notes (jremus):
> Changes in V2:
> - Reword commit message (s390 to s390x). (Indu)
> - Rename s390x-specific macros from *_S390_* to *_S390X_*. (Indu)
> - Use "s390x" instead of "S390" in comments and SFrame spec. (Indu)
> - Add comment on sframe_fre_get_{fp|ra}_offset that for s390x the offset
> may be an encoded register number. (Indu)
> - Add documentation that for s390x stack tracers need to implement
> checks when restoring FP and RA from registers. (Indu)
> - Add comment on sframe_fre_get_ra_offset that for s390x the offset may
> be SFRAME_FRE_RA_OFFSET_INVALID when FP without RA saved.
Ditto.
> - Reword test names.
> - Adjust tests to commit bd9dc0a281a4 ("gas: sframe: reword diagnostic
> to address ambiguity")
> - Rename CFI SFrame test file names from s390 to s390x. (Indu)
> - Reword test names.
> diff --git a/include/sframe-api.h b/include/sframe-api.h
> @@ -198,12 +198,20 @@ extern int32_t
> sframe_fre_get_cfa_offset (sframe_decoder_ctx *dtcx,
> sframe_frame_row_entry *fre, int *errp);
>
> -/* Get the FP offset from the FRE. If the offset is invalid, sets errp. */
> +/* Get the FP offset from the FRE. If the offset is invalid, sets errp.
> +
> + For s390x the offset may be an encoded register number, indicated by
> + LSB set to one, which is only valid in the topmost frame. */
> extern int32_t
> sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx,
> sframe_frame_row_entry *fre, int *errp);
>
> -/* Get the RA offset from the FRE. If the offset is invalid, sets errp. */
> +/* Get the RA offset from the FRE. If the offset is invalid, sets errp.
> +
> + For s390x a RA offset value of SFRAME_FRE_RA_OFFSET_INVALID indicates
> + that the RA is not saved, which is only valid in the topmost frame.
Ditto.
> + For s390x the offset may be an encoded register number, indicated by
> + LSB set to one, which is only valid in the topmost frame. */
> extern int32_t
> sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx,
> sframe_frame_row_entry *fre, int *errp);
> diff --git a/libsframe/sframe.c b/libsframe/sframe.c
> @@ -706,7 +709,12 @@ sframe_fre_get_fp_offset (sframe_decoder_ctx *dctx,
> return sframe_get_fre_offset (fre, fp_offset_idx, errp);
> }
>
> -/* Get the RA offset from the FRE. If the offset is invalid, sets errp. */
> +/* Get the RA offset from the FRE. If the offset is invalid, sets errp.
> +
> + For s390x a RA offset value of SFRAME_FRE_RA_OFFSET_INVALID indicates
> + that the RA is not saved, which is only valid in the topmost frame.
Ditto.
> + For s390x the offset may be an encoded register number, indicated by
> + LSB set to one, which is only valid in the topmost frame. */
>
> int32_t
> sframe_fre_get_ra_offset (sframe_decoder_ctx *dctx,
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