flat assembler
Message board for the users of flat assembler.
Index
> Main > RDRAND problem |
Author |
|
magicSqr 16 Dec 2012, 17:15
Hi,
from http://software.intel.com/en-us/articles/intel-digital-random-number-generator-drng-software-implementation-guide If I run the following Code: format PE64 console entry start include '%fasminc%\win64ax.inc' ;************************************************************************************************** section '.text' code readable executable start: xor eax, eax cpuid bt ecx, 30 jnc .noGood .good: cinvoke printf, goodStr jmp .finished .noGood: cinvoke printf, noGoodStr .finished: rdrand eax invoke ExitProcess, 0 ;************************************************************************************************** section '.data' data readable writeable goodStr db "RDRAND available", 00 noGoodStr db "RDRAND not available", 00 ;************************************************************************************************** section '.idata' import data readable writeable library msvcrt, 'msvcrt.dll',\ kernel32, 'kernel32.dll' include '%fasminc%\api\Kernel32.inc' import msvcrt,\ printf, 'printf' I am told bit 30 is set so I have rdrand support but then the code crashes at the Code: rdrand eax Any ideas? thx |
|||
16 Dec 2012, 17:15 |
|
magicSqr 16 Dec 2012, 17:57
thx loco, that was the problem. I should have eax = 1.
|
|||
16 Dec 2012, 17:57 |
|
HaHaAnonymous 17 Dec 2012, 00:24
[ Post removed by author. ]
Last edited by HaHaAnonymous on 28 Feb 2015, 22:10; edited 1 time in total |
|||
17 Dec 2012, 00:24 |
|
BAiC 31 Dec 2012, 23:10
fyi: you're executing the RDRAND opcode when the processor detects that it isn't supported. it falls through:
Code: .noGood: cinvoke printf, noGoodStr .finished: rdrand eax use something like: Code: bt ecx, 30 jnc .noGood cinvoke printf, goodStr rdrand eax invoke ExitProcess, 0 .noGood: cinvoke printf, noGoodStr invoke ExitProcess, 0 _________________ byte me. |
|||
31 Dec 2012, 23:10 |
|
DOS386 07 Feb 2013, 08:32
|
|||
07 Feb 2013, 08:32 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.