Re:Proposal: Add bare metal support to Go
by timewizard on Wednesday May 07, 2025 @05:13PM
(#43920616)
> Here, they seem to acknowledge that it can be faster to make a single call.
It calls the internal Fill function to fill 4 bytes of the slice at a time. That calls the rng assembly stub function which uses 'rdrand' to get 32bits of random data. Which gets called len(b)/4 times.
I don't think they did it for speed but rather to be more idiomatic.
Anyways, OSDev has had a "Go Bare Bones" page for quite a while:
It calls the internal Fill function to fill 4 bytes of the slice at a time. That calls the rng assembly stub function which uses 'rdrand' to get 32bits of random data. Which gets called len(b)/4 times.
I don't think they did it for speed but rather to be more idiomatic.
Anyways, OSDev has had a "Go Bare Bones" page for quite a while:
https://wiki.osdev.org/Go_Bare_Bones