[PATCH RFC v0] random: block in /dev/urandom

David Laight David.Laight at ACULAB.COM
Mon Feb 14 06:57:05 PST 2022


From: Geert Uytterhoeven
> Sent: 14 February 2022 14:26
...
> I'm afraid you missed one important detail.  You wrote:
> 
> > On every platform, random_get_entropy() is connected to get_cycles(),
> > except for three: m68k, MIPS, and RISC-V.
> 
> The default implementation in include/asm-generic/timex.h is:
> 
>     static inline cycles_t get_cycles(void)
>     {
>             return 0;
>     }
> 
> Several architectures do not implement get_cycles(), or implement it
> with a variant that's very similar or identical to the generic version.

Add to the list nios2 and old x86 (I think rdtsc is a pentium instruction)
I can't see it in my 386 book, and i don't think 486 added it.

I'm not sure if/when sparc added one.
I don't remember it being there in the late 1980s.

nios2 (soft cpu on Altera/Intel fpga) is annoying.
There is a 'read control register' instruction and plenty of space ones.
But you can't define your own and one isn't a clock counter.
You can add one as the result of a custom instruction.
(Even the same custom instruction that does byteswap.)

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


More information about the linux-riscv mailing list