PR/53838: Scole Mail: OPENSSL_rdtsc() is reading a time counter

for randomness, and the powerpc code uses mftbu and mftb for access.
The 601 is different than other powerpcs. It doesn't have a time
base register (TBR), but a real time clock (RTC) so it needs to
use different calls like mfrtcu/mfrtcl instead.
This commit is contained in:
christos 2019-01-06 22:20:50 +00:00
parent 06c9aa1116
commit 6210d3c848
1 changed files with 11 additions and 0 deletions

View File

@ -132,6 +132,17 @@ $code.=<<___ if ($flavour =~ /64/);
mftb r3
___
$code.=<<___ if ($flavour !~ /64/);
mfspr r0,287
srwi r0,r0,0x10
cmplwi r0,0x1
bgt .Loop_rdtsc
.Loop_rdtsc_601:
mfrtcu r5
mfrtcl r3
mfrtcu r4
cmplw r4,r5
bne .Loop_rdtsc_601
blr
Loop_rdtsc:
mftbu r5
mftb r3