]> git.ipfire.org Git - thirdparty/ipxe.git/commit
[arm] Check PMCCNTR availability before use for profiling
authorMichael Brown <mcb30@ipxe.org>
Tue, 24 Sep 2024 10:52:16 +0000 (11:52 +0100)
committerMichael Brown <mcb30@ipxe.org>
Tue, 24 Sep 2024 15:14:33 +0000 (16:14 +0100)
commite0282688c1d9795a1400718b8c9e3f468530ae97
tree382151f086d5eb3045c08e5386721097817bdba2
parent5f7c6bd95bd6089473db3ba4f033584f5de0ee8a
[arm] Check PMCCNTR availability before use for profiling

Reading from PMCCNTR causes an undefined instruction exception when
running in PL0 (e.g. as a Linux userspace binary), unless the
PMUSERENR.EN bit is set.

Restructure profile_timestamp() for 32-bit ARM to perform an
availability check on the first invocation, with subsequent
invocations returning zero if PMCCNTR could not be enabled.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/arch/arm32/core/pmccntr.S [new file with mode: 0644]
src/arch/arm32/include/bits/profile.h