1/*
2 * ====================================================
3 * Copyright (C) 1998, 2002 by Red Hat Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and distribute this
6 * software is freely granted, provided that this notice
7 * is preserved.
8 * ====================================================
9 */
10
11	#include "i386mach.h"
12
13	.global SYM (memset)
14       SOTYPE_FUNCTION(memset)
15
16SYM (memset):
17
18	pushl ebp
19	movl esp,ebp
20	pushl edi
21	pushl ebx
22	movl 8(ebp),edi
23	movl 12(ebp),eax
24	movl 16(ebp),ecx
25	cld
26
27#ifndef __OPTIMIZE_SIZE__
28	andl $255,eax
29	movl ecx,ebx
30	testl $3,edi
31	jne .L19
32	cmpl $16,ecx
33	jbe .L19
34
35	movl eax,edx
36	sall $8,eax
37	orl edx,eax
38
39	movl eax,edx
40	sall $16,edx
41	orl edx,eax
42
43	shrl $2,ecx
44	andl $3,ebx
45	rep
46	stosl
47	movl ebx,ecx
48#endif /* not __OPTIMIZE_SIZE__ */
49
50.L19:
51	rep
52	stosb
53
54	movl 8(ebp),eax
55
56	leal -8(ebp),esp
57	popl ebx
58	popl edi
59	leave
60	ret
61