audk/MdePkg/Library/BaseLib/AArch64/ArmReadCntPctReg.S
Pierre Gondois a72d93e163 MdePkg/BaseLib: AARCH64: Add ArmReadCntPctReg()
To enable AARCH64 native instruction support for Openssl,
some interfaces must be implemented. OPENSSL_rdtsc() requests
an access to a counter to get some non-trusted entropy.

Add ArmReadCntPctReg() to read system count.
A similar ArmReadCntPct() function is available in the ArmPkg,
but the CryptoPkg where OPENSSL_rdtsc will reside cannot rely
on the ArmPkg.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2024-08-01 13:41:01 +00:00

31 lines
622 B
ArmAsm

#------------------------------------------------------------------------------
#
# ArmReadCntPctReg() for AArch64
#
# Copyright (c) 2023 - 2024, Arm Limited. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
#------------------------------------------------------------------------------
.text
.p2align 2
GCC_ASM_EXPORT(ArmReadCntPctReg)
#/**
# Reads the CNTPCT_EL0 Register.
#
# @return The contents of the CNTPCT_EL0 register.
#
#**/
#UINT64
#EFIAPI
#ArmReadCntPctReg (
# VOID
# );
#
ASM_PFX(ArmReadCntPctReg):
AARCH64_BTI(c)
mrs x0, cntpct_el0
ret