From 6436a4851d85dfc4e38707b63aec8a5afc493fb8 Mon Sep 17 00:00:00 2001 From: CyrIng Date: Fri, 22 Nov 2024 19:02:52 +0100 Subject: [PATCH] [AArch64] Access `HCR_EL2` based on `CurrentEL` bits --- Makefile | 2 +- aarch64/corefreqk.c | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index b2e4a18e..f280d2c4 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ COREFREQ_MAJOR = 1 COREFREQ_MINOR = 98 -COREFREQ_REV = 7 +COREFREQ_REV = 8 HW = $(shell uname -m) CC ?= cc WARNING = -Wall -Wfatal-errors diff --git a/aarch64/corefreqk.c b/aarch64/corefreqk.c index b664b9b6..a0c702cb 100644 --- a/aarch64/corefreqk.c +++ b/aarch64/corefreqk.c @@ -2449,14 +2449,6 @@ static void SystemRegisters(CORE_RO *Core) isar2.value = SysRegRead(ID_AA64ISAR2_EL1); - if (Experimental) { - __asm__ __volatile__( - "mrs %[hcr] , hcr_el2" - : [hcr] "=r" (Core->SystemRegister.HCR) - : - : "cc", "memory" - ); - } __asm__ __volatile__( "mrs %[sctlr], sctlr_el1" "\n\t" "mrs %[mmfr1], id_aa64mmfr1_el1""\n\t" @@ -2604,6 +2596,14 @@ static void SystemRegisters(CORE_RO *Core) if (PUBLIC(RO(Proc))->Features.SME) { Core->SystemRegister.SVCR = SysRegRead(MRS_SVCR); } + if (BITEXTRZ(Core->SystemRegister.FLAGS, FLAG_EL, 2) >= 2) { + __asm__ __volatile__( + "mrs %[hcr] , hcr_el2" + : [hcr] "=r" (Core->SystemRegister.HCR) + : + : "cc", "memory" + ); + } BITSET_CC(LOCKLESS, PUBLIC(RO(Proc))->CR_Mask, Core->Bind); }