Skip to content

Commit

Permalink
[AArch64] Branch Target Identification (BTI)
Browse files Browse the repository at this point in the history
  • Loading branch information
cyring committed Jan 29, 2024
1 parent edfd288 commit 32a33ae
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions aarch64/corefreq-cli-json.c
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,8 @@ void JsonSysInfo(RO(SHM_STRUCT) *RO(Shm))
json_key(&s, "PFR1");
{
json_start_object(&s);
json_key(&s, "BTI");
json_literal(&s, "%u", (unsigned) RO(Shm)->Proc.Features.BTI);
json_key(&s, "MTE");
json_literal(&s, "%u", (unsigned) RO(Shm)->Proc.Features.MTE);
json_key(&s, "NMI");
Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc-en.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,7 @@

#define RSC_FEATURES_ACPI_CODE_EN "Advanced Configuration & Power Interface"
#define RSC_FEATURES_AMU_CODE_EN "Activity Monitor Unit"
#define RSC_FEATURES_BTI_CODE_EN "Branch Target Identification"
#define RSC_FEATURES_EBEP_CODE_EN "Exception-based event profiling"
#define RSC_FEATURES_DIT_CODE_EN "Data Independent Timing"
#define RSC_FEATURES_GIC_CODE_EN "Generic Interrupt Controller"
Expand Down
2 changes: 2 additions & 0 deletions aarch64/corefreq-cli-rsc-fr.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,6 +498,8 @@ do echo -en "$h$l\t""\xc3""\x$h$l""\t"; done; done;echo
#define RSC_FEATURES_AMU_CODE_FR \
"Unit""\xa9"" de surveillance de l'activit""\xa9"

#define RSC_FEATURES_BTI_CODE_FR "Validation des cibles de branche"

#define RSC_FEATURES_EBEP_CODE_FR \
"Profilage d'""\xa9""v""\xa9""nements en fonction des exceptions"

Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,7 @@ RESOURCE_ST Resource[] = {
LDT(RSC_INVARIANT),
LDT(RSC_FEATURES_ACPI),
LDT(RSC_FEATURES_AMU),
LDT(RSC_FEATURES_BTI),
LDT(RSC_FEATURES_EBEP),
LDT(RSC_FEATURES_DIT),
LDT(RSC_FEATURES_GIC),
Expand Down
1 change: 1 addition & 0 deletions aarch64/corefreq-cli-rsc.h
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ enum {
RSC_INVARIANT,
RSC_FEATURES_ACPI,
RSC_FEATURES_AMU,
RSC_FEATURES_BTI,
RSC_FEATURES_EBEP,
RSC_FEATURES_DIT,
RSC_FEATURES_GIC,
Expand Down
8 changes: 8 additions & 0 deletions aarch64/corefreq-cli.c
Original file line number Diff line number Diff line change
Expand Up @@ -1598,6 +1598,14 @@ REASON_CODE SysInfoFeatures( Window *win,
RSC(FEATURES_AMU).CODE(), width - 23 - RSZ(FEATURES_AMU),
NULL
},
{
NULL,
RO(Shm)->Proc.Features.BTI == 1,
attr_Feat,
2, "%s%.*sBTI [%7s]", RSC(FEATURES_BTI).CODE(),
width - 18 - RSZ(FEATURES_BTI),
NULL
},
{
NULL,
RO(Shm)->Proc.Features.EBEP == 1,
Expand Down
10 changes: 10 additions & 0 deletions aarch64/corefreqk.c
Original file line number Diff line number Diff line change
Expand Up @@ -930,6 +930,16 @@ static void Query_Features(void *pArg)
break;
}

switch (pfr1.BT) {
case 0b0001:
iArg->Features->BTI = 1;
break;
case 0b0000:
default:
iArg->Features->BTI = 0;
break;
}

iArg->Features->SSBS = pfr1.SSBS;

switch (pfr1.MTE) {
Expand Down
2 changes: 1 addition & 1 deletion aarch64/coretypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -806,7 +806,7 @@ typedef struct /* BSP features. */
PAN : 9-8,
UAO : 10-9,
DIT : 11-10,
_Unused0_ : 12-11,
BTI : 12-11,
NMI : 13-12,
EBEP : 14-13,
RAS : 15-14,
Expand Down

0 comments on commit 32a33ae

Please sign in to comment.