[PATCH 1/2] aarch64: add Branch Record Buffer extension instructions

Richard Earnshaw (lists) Richard.Earnshaw@arm.com
Tue Jun 25 17:00:55 GMT 2024


On 10/06/2024 12:00, Claudio Bantaloukas wrote:
> 
> 
> On 10/06/2024 07:58, Jan Beulich wrote:
>> On 07.06.2024 15:59, Claudio Bantaloukas wrote:
>>>
>>> The FEAT_BRBE extension provides two aliases of sys:
>>> - brb iall (Invalidates all Branch records in the Branch Record Buffer)
>>> - brb inj (Injects the Branch Record held in BRBINFINJ_EL1,
>>>    BRBSRCINJ_EL1, and BRBTGTINJ_EL1 into the Branch Record Buffer)
>>>
>>> This patch adds:
>>> - the feature option "brbe" that must be added for the aliases to be available
>>> - a new operand flag AARCH64_OPND_Rt_IN_SYS_ALIASES that warns in a comment
>>>    when Rt is set to the non default value 0b11111 (it is constrained
>>>    unpredictable whether the instruction is undefined or behaves as if the Rt
>>>    field is set to 0b11111).
>>
>> Hmm, shouldn't gas nevertheless accept the optional operand, and shouldn't
>> the disassembler nevertheless print it (with said comment still there, just
>> perhaps with the then-redundant register number omitted)?
> 
> Hi Jan,
> thank you for pushing the patch through the filter (if that was you) and 
> for reviewing it.

Apologies, I pushed the patch, but somehow forgot to reply.

R.

> 
>  From an architectural perspective, brb is an alias of sys that always 
> outputs the default Rt value and has no provision for setting Rt.
> 
> If a user ignores the language in the architecture docs that is about as 
> close as it gets to "don't do that" and knows what they are doing, they 
> can use sys with the equivalent operands, set a non-default Rt value and 
> play the dice on whether the non-default Rt will be ignored or 
> "something else" happens.
> 
> We had a bit of internal debate whether to:
> - output brb ignoring Rt completely
> - output sys
> - output invalid syntax
> - output brb with a comment that the instruction is not "as it should 
> be" when Rt!=31
> 
> In the end, we settled with the last option as we don't expect the 
> specific sys arguments that translate to brb to be used with a non 
> default Rt.
> 
>> Jan
> 
> Cheers,
> Claudio



More information about the Binutils mailing list