Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / boringssl / win-x86_64 / crypto / rand / rdrand-x86_64.asm
blob4c03791b48efed0eda7140d590c3da8faeeb9ec9
1 default rel
2 %define XMMWORD
3 %define YMMWORD
4 %define ZMMWORD
5 section .text code align=64
11 global CRYPTO_rdrand
13 ALIGN 16
14 CRYPTO_rdrand:
15 mov QWORD[8+rsp],rdi ;WIN64 prologue
16 mov QWORD[16+rsp],rsi
17 mov rax,rsp
18 $L$SEH_begin_CRYPTO_rdrand:
19 mov rdi,rcx
22 xor rax,rax
25 DB 0x48,0x0f,0xc7,0xf1
27 adc rax,rax
28 mov QWORD[rdi],rcx
29 mov rdi,QWORD[8+rsp] ;WIN64 epilogue
30 mov rsi,QWORD[16+rsp]
31 DB 0F3h,0C3h ;repret
37 global CRYPTO_rdrand_multiple8_buf
39 ALIGN 16
40 CRYPTO_rdrand_multiple8_buf:
41 mov QWORD[8+rsp],rdi ;WIN64 prologue
42 mov QWORD[16+rsp],rsi
43 mov rax,rsp
44 $L$SEH_begin_CRYPTO_rdrand_multiple8_buf:
45 mov rdi,rcx
46 mov rsi,rdx
49 test rsi,rsi
50 jz NEAR $L$out
51 mov rdx,8
52 $L$loop:
55 DB 0x48,0x0f,0xc7,0xf1
56 jnc NEAR $L$err
57 mov QWORD[rdi],rcx
58 add rdi,rdx
59 sub rsi,rdx
60 jnz NEAR $L$loop
61 $L$out:
62 mov rax,1
63 mov rdi,QWORD[8+rsp] ;WIN64 epilogue
64 mov rsi,QWORD[16+rsp]
65 DB 0F3h,0C3h ;repret
66 $L$err:
67 xor rax,rax
68 mov rdi,QWORD[8+rsp] ;WIN64 epilogue
69 mov rsi,QWORD[16+rsp]
70 DB 0F3h,0C3h ;repret