• Damian Gryski's avatar
    runtime: add runtime.cputicks() and seed fastrand with it · 8e765da9
    Damian Gryski authored
    This patch adds a function to get the current cpu ticks.  This is
    deemed to be 'sufficiently random' to use to seed fastrand to mitigate
    the algorithmic complexity attacks on the hash table implementation.
    
    On AMD64 we use the RDTSC instruction.  For 386, this instruction,
    while valid, is not recognized by 8a so I've inserted the opcode by
    hand.  For ARM, this routine is currently stubbed to return a constant
    0 value.
    
    Future work: update 8a to recognize RDTSC.
    
    Fixes #2630.
    
    R=rsc
    CC=golang-dev
    https://golang.org/cl/5606048
    8e765da9
Name
Last commit
Last update
doc Loading commit data...
include Loading commit data...
lib Loading commit data...
misc Loading commit data...
src Loading commit data...
test Loading commit data...
.hgignore Loading commit data...
.hgtags Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
favicon.ico Loading commit data...
robots.txt Loading commit data...