summaryrefslogtreecommitdiffstats
path: root/linux-x86_64/crypto/rand/rdrand-x86_64.S
blob: 94aab9c19b7ef5fd98cbe8c3c87dd5904fe99cc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#if defined(__x86_64__)
.text	




.globl	CRYPTO_rdrand
.hidden CRYPTO_rdrand
.type	CRYPTO_rdrand,@function
.align	16
CRYPTO_rdrand:
	xorq	%rax,%rax


.byte	0x48, 0x0f, 0xc7, 0xf1

	adcq	%rax,%rax
	movq	%rcx,0(%rdi)
	.byte	0xf3,0xc3





.globl	CRYPTO_rdrand_multiple8_buf
.hidden CRYPTO_rdrand_multiple8_buf
.type	CRYPTO_rdrand_multiple8_buf,@function
.align	16
CRYPTO_rdrand_multiple8_buf:
	testq	%rsi,%rsi
	jz	.Lout
	movq	$8,%rdx
.Lloop:


.byte	0x48, 0x0f, 0xc7, 0xf1
	jnc	.Lerr
	movq	%rcx,0(%rdi)
	addq	%rdx,%rdi
	subq	%rdx,%rsi
	jnz	.Lloop
.Lout:
	movq	$1,%rax
	.byte	0xf3,0xc3
.Lerr:
	xorq	%rax,%rax
	.byte	0xf3,0xc3
#endif