xref: /freebsd/sys/crypto/openssl/arm/armv4cpuid.S (revision c0855eaa3ee9614804b6bd6a255aa9f71e095f43)
1bc3d5698SJohn Baldwin/* Do not modify. This file is auto-generated from armv4cpuid.pl. */
2bc3d5698SJohn Baldwin#include "arm_arch.h"
3bc3d5698SJohn Baldwin
4bc3d5698SJohn Baldwin#if defined(__thumb2__) && !defined(__APPLE__)
5bc3d5698SJohn Baldwin.syntax	unified
6bc3d5698SJohn Baldwin.thumb
7bc3d5698SJohn Baldwin#else
8bc3d5698SJohn Baldwin.code	32
9bc3d5698SJohn Baldwin#undef	__thumb2__
10bc3d5698SJohn Baldwin#endif
11bc3d5698SJohn Baldwin
12*c0855eaaSJohn Baldwin.text
13*c0855eaaSJohn Baldwin
14bc3d5698SJohn Baldwin.align	5
15bc3d5698SJohn Baldwin.globl	OPENSSL_atomic_add
16bc3d5698SJohn Baldwin.type	OPENSSL_atomic_add,%function
17bc3d5698SJohn BaldwinOPENSSL_atomic_add:
18bc3d5698SJohn Baldwin#if __ARM_ARCH__>=6
19bc3d5698SJohn Baldwin.Ladd:	ldrex	r2,[r0]
20bc3d5698SJohn Baldwin	add	r3,r2,r1
21bc3d5698SJohn Baldwin	strex	r2,r3,[r0]
22bc3d5698SJohn Baldwin	cmp	r2,#0
23bc3d5698SJohn Baldwin	bne	.Ladd
24bc3d5698SJohn Baldwin	mov	r0,r3
25bc3d5698SJohn Baldwin	bx	lr
26bc3d5698SJohn Baldwin#else
27bc3d5698SJohn Baldwin	stmdb	sp!,{r4,r5,r6,lr}
28bc3d5698SJohn Baldwin	ldr	r2,.Lspinlock
29bc3d5698SJohn Baldwin	adr	r3,.Lspinlock
30bc3d5698SJohn Baldwin	mov	r4,r0
31bc3d5698SJohn Baldwin	mov	r5,r1
32bc3d5698SJohn Baldwin	add	r6,r3,r2	@ &spinlock
33bc3d5698SJohn Baldwin	b	.+8
34bc3d5698SJohn Baldwin.Lspin:	bl	sched_yield
35bc3d5698SJohn Baldwin	mov	r0,#-1
36bc3d5698SJohn Baldwin	swp	r0,r0,[r6]
37bc3d5698SJohn Baldwin	cmp	r0,#0
38bc3d5698SJohn Baldwin	bne	.Lspin
39bc3d5698SJohn Baldwin
40bc3d5698SJohn Baldwin	ldr	r2,[r4]
41bc3d5698SJohn Baldwin	add	r2,r2,r5
42bc3d5698SJohn Baldwin	str	r2,[r4]
43bc3d5698SJohn Baldwin	str	r0,[r6]		@ release spinlock
44bc3d5698SJohn Baldwin	ldmia	sp!,{r4,r5,r6,lr}
45bc3d5698SJohn Baldwin	tst	lr,#1
46bc3d5698SJohn Baldwin	moveq	pc,lr
47bc3d5698SJohn Baldwin.word	0xe12fff1e	@ bx	lr
48bc3d5698SJohn Baldwin#endif
49bc3d5698SJohn Baldwin.size	OPENSSL_atomic_add,.-OPENSSL_atomic_add
50bc3d5698SJohn Baldwin
51bc3d5698SJohn Baldwin.globl	OPENSSL_cleanse
52bc3d5698SJohn Baldwin.type	OPENSSL_cleanse,%function
53bc3d5698SJohn BaldwinOPENSSL_cleanse:
54bc3d5698SJohn Baldwin	eor	ip,ip,ip
55bc3d5698SJohn Baldwin	cmp	r1,#7
56bc3d5698SJohn Baldwin#ifdef	__thumb2__
57bc3d5698SJohn Baldwin	itt	hs
58bc3d5698SJohn Baldwin#endif
59bc3d5698SJohn Baldwin	subhs	r1,r1,#4
60bc3d5698SJohn Baldwin	bhs	.Lot
61bc3d5698SJohn Baldwin	cmp	r1,#0
62bc3d5698SJohn Baldwin	beq	.Lcleanse_done
63bc3d5698SJohn Baldwin.Little:
64bc3d5698SJohn Baldwin	strb	ip,[r0],#1
65bc3d5698SJohn Baldwin	subs	r1,r1,#1
66bc3d5698SJohn Baldwin	bhi	.Little
67bc3d5698SJohn Baldwin	b	.Lcleanse_done
68bc3d5698SJohn Baldwin
69bc3d5698SJohn Baldwin.Lot:	tst	r0,#3
70bc3d5698SJohn Baldwin	beq	.Laligned
71bc3d5698SJohn Baldwin	strb	ip,[r0],#1
72bc3d5698SJohn Baldwin	sub	r1,r1,#1
73bc3d5698SJohn Baldwin	b	.Lot
74bc3d5698SJohn Baldwin.Laligned:
75bc3d5698SJohn Baldwin	str	ip,[r0],#4
76bc3d5698SJohn Baldwin	subs	r1,r1,#4
77bc3d5698SJohn Baldwin	bhs	.Laligned
78bc3d5698SJohn Baldwin	adds	r1,r1,#4
79bc3d5698SJohn Baldwin	bne	.Little
80bc3d5698SJohn Baldwin.Lcleanse_done:
81bc3d5698SJohn Baldwin#if __ARM_ARCH__>=5
82bc3d5698SJohn Baldwin	bx	lr
83bc3d5698SJohn Baldwin#else
84bc3d5698SJohn Baldwin	tst	lr,#1
85bc3d5698SJohn Baldwin	moveq	pc,lr
86bc3d5698SJohn Baldwin.word	0xe12fff1e	@ bx	lr
87bc3d5698SJohn Baldwin#endif
88bc3d5698SJohn Baldwin.size	OPENSSL_cleanse,.-OPENSSL_cleanse
89bc3d5698SJohn Baldwin
90bc3d5698SJohn Baldwin.globl	CRYPTO_memcmp
91bc3d5698SJohn Baldwin.type	CRYPTO_memcmp,%function
92bc3d5698SJohn Baldwin.align	4
93bc3d5698SJohn BaldwinCRYPTO_memcmp:
94bc3d5698SJohn Baldwin	eor	ip,ip,ip
95bc3d5698SJohn Baldwin	cmp	r2,#0
96bc3d5698SJohn Baldwin	beq	.Lno_data
97bc3d5698SJohn Baldwin	stmdb	sp!,{r4,r5}
98bc3d5698SJohn Baldwin
99bc3d5698SJohn Baldwin.Loop_cmp:
100bc3d5698SJohn Baldwin	ldrb	r4,[r0],#1
101bc3d5698SJohn Baldwin	ldrb	r5,[r1],#1
102bc3d5698SJohn Baldwin	eor	r4,r4,r5
103bc3d5698SJohn Baldwin	orr	ip,ip,r4
104bc3d5698SJohn Baldwin	subs	r2,r2,#1
105bc3d5698SJohn Baldwin	bne	.Loop_cmp
106bc3d5698SJohn Baldwin
107bc3d5698SJohn Baldwin	ldmia	sp!,{r4,r5}
108bc3d5698SJohn Baldwin.Lno_data:
109bc3d5698SJohn Baldwin	rsb	r0,ip,#0
110bc3d5698SJohn Baldwin	mov	r0,r0,lsr#31
111bc3d5698SJohn Baldwin#if __ARM_ARCH__>=5
112bc3d5698SJohn Baldwin	bx	lr
113bc3d5698SJohn Baldwin#else
114bc3d5698SJohn Baldwin	tst	lr,#1
115bc3d5698SJohn Baldwin	moveq	pc,lr
116bc3d5698SJohn Baldwin.word	0xe12fff1e	@ bx	lr
117bc3d5698SJohn Baldwin#endif
118bc3d5698SJohn Baldwin.size	CRYPTO_memcmp,.-CRYPTO_memcmp
119bc3d5698SJohn Baldwin
120bc3d5698SJohn Baldwin#if __ARM_MAX_ARCH__>=7
121bc3d5698SJohn Baldwin.arch	armv7-a
122bc3d5698SJohn Baldwin.fpu	neon
123bc3d5698SJohn Baldwin
124bc3d5698SJohn Baldwin.align	5
125bc3d5698SJohn Baldwin.globl	_armv7_neon_probe
126bc3d5698SJohn Baldwin.type	_armv7_neon_probe,%function
127bc3d5698SJohn Baldwin_armv7_neon_probe:
128bc3d5698SJohn Baldwin	vorr	q0,q0,q0
129bc3d5698SJohn Baldwin	bx	lr
130bc3d5698SJohn Baldwin.size	_armv7_neon_probe,.-_armv7_neon_probe
131bc3d5698SJohn Baldwin
132bc3d5698SJohn Baldwin.globl	_armv7_tick
133bc3d5698SJohn Baldwin.type	_armv7_tick,%function
134bc3d5698SJohn Baldwin_armv7_tick:
135bc3d5698SJohn Baldwin#ifdef	__APPLE__
136bc3d5698SJohn Baldwin	mrrc	p15,0,r0,r1,c14		@ CNTPCT
137bc3d5698SJohn Baldwin#else
138bc3d5698SJohn Baldwin	mrrc	p15,1,r0,r1,c14		@ CNTVCT
139bc3d5698SJohn Baldwin#endif
140bc3d5698SJohn Baldwin	bx	lr
141bc3d5698SJohn Baldwin.size	_armv7_tick,.-_armv7_tick
142bc3d5698SJohn Baldwin
143bc3d5698SJohn Baldwin.globl	_armv8_aes_probe
144bc3d5698SJohn Baldwin.type	_armv8_aes_probe,%function
145bc3d5698SJohn Baldwin_armv8_aes_probe:
146bc3d5698SJohn Baldwin#if defined(__thumb2__) && !defined(__APPLE__)
147bc3d5698SJohn Baldwin.byte	0xb0,0xff,0x00,0x03	@ aese.8	q0,q0
148bc3d5698SJohn Baldwin#else
149bc3d5698SJohn Baldwin.byte	0x00,0x03,0xb0,0xf3	@ aese.8	q0,q0
150bc3d5698SJohn Baldwin#endif
151bc3d5698SJohn Baldwin	bx	lr
152bc3d5698SJohn Baldwin.size	_armv8_aes_probe,.-_armv8_aes_probe
153bc3d5698SJohn Baldwin
154bc3d5698SJohn Baldwin.globl	_armv8_sha1_probe
155bc3d5698SJohn Baldwin.type	_armv8_sha1_probe,%function
156bc3d5698SJohn Baldwin_armv8_sha1_probe:
157bc3d5698SJohn Baldwin#if defined(__thumb2__) && !defined(__APPLE__)
158bc3d5698SJohn Baldwin.byte	0x00,0xef,0x40,0x0c	@ sha1c.32	q0,q0,q0
159bc3d5698SJohn Baldwin#else
160bc3d5698SJohn Baldwin.byte	0x40,0x0c,0x00,0xf2	@ sha1c.32	q0,q0,q0
161bc3d5698SJohn Baldwin#endif
162bc3d5698SJohn Baldwin	bx	lr
163bc3d5698SJohn Baldwin.size	_armv8_sha1_probe,.-_armv8_sha1_probe
164bc3d5698SJohn Baldwin
165bc3d5698SJohn Baldwin.globl	_armv8_sha256_probe
166bc3d5698SJohn Baldwin.type	_armv8_sha256_probe,%function
167bc3d5698SJohn Baldwin_armv8_sha256_probe:
168bc3d5698SJohn Baldwin#if defined(__thumb2__) && !defined(__APPLE__)
169bc3d5698SJohn Baldwin.byte	0x00,0xff,0x40,0x0c	@ sha256h.32	q0,q0,q0
170bc3d5698SJohn Baldwin#else
171bc3d5698SJohn Baldwin.byte	0x40,0x0c,0x00,0xf3	@ sha256h.32	q0,q0,q0
172bc3d5698SJohn Baldwin#endif
173bc3d5698SJohn Baldwin	bx	lr
174bc3d5698SJohn Baldwin.size	_armv8_sha256_probe,.-_armv8_sha256_probe
175bc3d5698SJohn Baldwin.globl	_armv8_pmull_probe
176bc3d5698SJohn Baldwin.type	_armv8_pmull_probe,%function
177bc3d5698SJohn Baldwin_armv8_pmull_probe:
178bc3d5698SJohn Baldwin#if defined(__thumb2__) && !defined(__APPLE__)
179bc3d5698SJohn Baldwin.byte	0xa0,0xef,0x00,0x0e	@ vmull.p64	q0,d0,d0
180bc3d5698SJohn Baldwin#else
181bc3d5698SJohn Baldwin.byte	0x00,0x0e,0xa0,0xf2	@ vmull.p64	q0,d0,d0
182bc3d5698SJohn Baldwin#endif
183bc3d5698SJohn Baldwin	bx	lr
184bc3d5698SJohn Baldwin.size	_armv8_pmull_probe,.-_armv8_pmull_probe
185bc3d5698SJohn Baldwin#endif
186bc3d5698SJohn Baldwin
187bc3d5698SJohn Baldwin.globl	OPENSSL_wipe_cpu
188bc3d5698SJohn Baldwin.type	OPENSSL_wipe_cpu,%function
189bc3d5698SJohn BaldwinOPENSSL_wipe_cpu:
190bc3d5698SJohn Baldwin#if __ARM_MAX_ARCH__>=7
191bc3d5698SJohn Baldwin	ldr	r0,.LOPENSSL_armcap
192bc3d5698SJohn Baldwin	adr	r1,.LOPENSSL_armcap
193bc3d5698SJohn Baldwin	ldr	r0,[r1,r0]
194bc3d5698SJohn Baldwin#ifdef	__APPLE__
195bc3d5698SJohn Baldwin	ldr	r0,[r0]
196bc3d5698SJohn Baldwin#endif
197bc3d5698SJohn Baldwin#endif
198bc3d5698SJohn Baldwin	eor	r2,r2,r2
199bc3d5698SJohn Baldwin	eor	r3,r3,r3
200bc3d5698SJohn Baldwin	eor	ip,ip,ip
201bc3d5698SJohn Baldwin#if __ARM_MAX_ARCH__>=7
202bc3d5698SJohn Baldwin	tst	r0,#1
203bc3d5698SJohn Baldwin	beq	.Lwipe_done
204bc3d5698SJohn Baldwin	veor	q0, q0, q0
205bc3d5698SJohn Baldwin	veor	q1, q1, q1
206bc3d5698SJohn Baldwin	veor	q2, q2, q2
207bc3d5698SJohn Baldwin	veor	q3, q3, q3
208bc3d5698SJohn Baldwin	veor	q8, q8, q8
209bc3d5698SJohn Baldwin	veor	q9, q9, q9
210bc3d5698SJohn Baldwin	veor	q10, q10, q10
211bc3d5698SJohn Baldwin	veor	q11, q11, q11
212bc3d5698SJohn Baldwin	veor	q12, q12, q12
213bc3d5698SJohn Baldwin	veor	q13, q13, q13
214bc3d5698SJohn Baldwin	veor	q14, q14, q14
215bc3d5698SJohn Baldwin	veor	q15, q15, q15
216bc3d5698SJohn Baldwin.Lwipe_done:
217bc3d5698SJohn Baldwin#endif
218bc3d5698SJohn Baldwin	mov	r0,sp
219bc3d5698SJohn Baldwin#if __ARM_ARCH__>=5
220bc3d5698SJohn Baldwin	bx	lr
221bc3d5698SJohn Baldwin#else
222bc3d5698SJohn Baldwin	tst	lr,#1
223bc3d5698SJohn Baldwin	moveq	pc,lr
224bc3d5698SJohn Baldwin.word	0xe12fff1e	@ bx	lr
225bc3d5698SJohn Baldwin#endif
226bc3d5698SJohn Baldwin.size	OPENSSL_wipe_cpu,.-OPENSSL_wipe_cpu
227bc3d5698SJohn Baldwin
228bc3d5698SJohn Baldwin.globl	OPENSSL_instrument_bus
229bc3d5698SJohn Baldwin.type	OPENSSL_instrument_bus,%function
230bc3d5698SJohn BaldwinOPENSSL_instrument_bus:
231bc3d5698SJohn Baldwin	eor	r0,r0,r0
232bc3d5698SJohn Baldwin#if __ARM_ARCH__>=5
233bc3d5698SJohn Baldwin	bx	lr
234bc3d5698SJohn Baldwin#else
235bc3d5698SJohn Baldwin	tst	lr,#1
236bc3d5698SJohn Baldwin	moveq	pc,lr
237bc3d5698SJohn Baldwin.word	0xe12fff1e	@ bx	lr
238bc3d5698SJohn Baldwin#endif
239bc3d5698SJohn Baldwin.size	OPENSSL_instrument_bus,.-OPENSSL_instrument_bus
240bc3d5698SJohn Baldwin
241bc3d5698SJohn Baldwin.globl	OPENSSL_instrument_bus2
242bc3d5698SJohn Baldwin.type	OPENSSL_instrument_bus2,%function
243bc3d5698SJohn BaldwinOPENSSL_instrument_bus2:
244bc3d5698SJohn Baldwin	eor	r0,r0,r0
245bc3d5698SJohn Baldwin#if __ARM_ARCH__>=5
246bc3d5698SJohn Baldwin	bx	lr
247bc3d5698SJohn Baldwin#else
248bc3d5698SJohn Baldwin	tst	lr,#1
249bc3d5698SJohn Baldwin	moveq	pc,lr
250bc3d5698SJohn Baldwin.word	0xe12fff1e	@ bx	lr
251bc3d5698SJohn Baldwin#endif
252bc3d5698SJohn Baldwin.size	OPENSSL_instrument_bus2,.-OPENSSL_instrument_bus2
253bc3d5698SJohn Baldwin
254bc3d5698SJohn Baldwin.align	5
255bc3d5698SJohn Baldwin#if __ARM_MAX_ARCH__>=7
256bc3d5698SJohn Baldwin.LOPENSSL_armcap:
257bc3d5698SJohn Baldwin.word	OPENSSL_armcap_P-.
258bc3d5698SJohn Baldwin#endif
259bc3d5698SJohn Baldwin#if __ARM_ARCH__>=6
260bc3d5698SJohn Baldwin.align	5
261bc3d5698SJohn Baldwin#else
262bc3d5698SJohn Baldwin.Lspinlock:
263bc3d5698SJohn Baldwin.word	atomic_add_spinlock-.Lspinlock
264bc3d5698SJohn Baldwin.align	5
265bc3d5698SJohn Baldwin
266bc3d5698SJohn Baldwin.data
267bc3d5698SJohn Baldwin.align	2
268bc3d5698SJohn Baldwinatomic_add_spinlock:
269bc3d5698SJohn Baldwin.word	0
270bc3d5698SJohn Baldwin#endif
271bc3d5698SJohn Baldwin
272bc3d5698SJohn Baldwin.comm	OPENSSL_armcap_P,4,4
273bc3d5698SJohn Baldwin.hidden	OPENSSL_armcap_P
274