include: sframe: update code comments around SFrame FRE stack offsets

This also amends the incorrect comment:
    offset3 (intrepreted as FP = CFA + offset2)

If RA tracking is enabled,  the offset to recover FP is at the third
index.  The SFrame format (V2) has assumption that if FP is saved on
stack, RA must have been saved as well.  This is true for the currently
supported arch Aarch64.  For AMD64, RA tracking per SFrame FRE is not
necessary.

In future, when extending support for more architectures, this will
likely need to be revisited.

include/
	* sframe.h: Make the comments clearer by enumerating what
	happens per-ABI.
This commit is contained in:
Indu Bhagat
2024-04-19 16:48:17 -07:00
parent 6dacff8a2f
commit 4de9a5ccd6

View File

@@ -282,20 +282,22 @@ typedef struct sframe_fre_info
S is the size of the stack frame offset for the FRE, and
N is the number of stack frame offsets in the FRE
The offsets are interpreted in order as follows:
The interpretation of FRE stack offsets is ABI-specific:
offset1 (interpreted as CFA = BASE_REG + offset1)
if RA is being tracked
offset2 (interpreted as RA = CFA + offset2)
if FP is being tracked
offset3 (intrepreted as FP = CFA + offset2)
fi
else
AMD64:
offset1 (interpreted as CFA = BASE_REG + offset1)
if FP is being tracked
offset2 (intrepreted as FP = CFA + offset2)
fi
fi
AARCH64:
offset1 (interpreted as CFA = BASE_REG + offset1)
if FP is being tracked (in other words, if frame record created)
offset2 (interpreted as RA = CFA + offset2)
offset3 (intrepreted as FP = CFA + offset3)
fi
Note that in AAPCS64, a frame record, if created, will save both FP and
LR on stack.
*/
/* Used when SFRAME_FRE_TYPE_ADDR1 is specified as FRE type. */