HomeFreeBSD

random: Define a macro for getting the CPU cycle count

Description

random: Define a macro for getting the CPU cycle count

Entropy queue entries always include the low 32 bits of a CPU cycle
count reading. Introduce a macro for this instead of hard-coding
get_cyclecount() calls everywhere; this is handy for testing purposes
since this way, random(4)'s use of the cycle counter (e.g., the number
of bits we use) can be changed in one place.

No functional change intended.

Reviewed by: cem, delphij
MFC after: 1 week
Sponsored by: Stormshield
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D51113

(cherry picked from commit e2a96b83404fcee0a079a3c3adbb448b86a38d1e)

Details

Provenance
markjAuthored on Jul 3 2025, 5:27 PM
Reviewer
cem
Differential Revision
D51113: random: Define a macro for getting the CPU cycle count
Parents
rG11d1a5c57900: random: Move entropy harvest queue lock macros to random_harvestq.c
Branches
Unknown
Tags
Unknown