Last change
on this file since 444 was
444,
checked in by satin@…, 6 years ago
|
add newlib,libalmos-mkh, restructure shared_syscalls.h and mini-libc
|
File size:
1.5 KB
|
Line | |
---|
1 | /* |
---|
2 | * ==================================================== |
---|
3 | * Copyright (C) 1998, 2002, 2008 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 | |
---|
16 | SYM (memset): |
---|
17 | |
---|
18 | #ifdef __iamcu__ |
---|
19 | pushl edi |
---|
20 | movl eax,edi |
---|
21 | movzbl dl,eax |
---|
22 | mov edi,edx |
---|
23 | rep stosb |
---|
24 | mov edx,eax |
---|
25 | popl edi |
---|
26 | #else |
---|
27 | pushl ebp |
---|
28 | movl esp,ebp |
---|
29 | pushl edi |
---|
30 | movl 8(ebp),edi |
---|
31 | movzbl 12(ebp),eax |
---|
32 | movl 16(ebp),ecx |
---|
33 | cld |
---|
34 | |
---|
35 | #ifndef __OPTIMIZE_SIZE__ |
---|
36 | /* Less than 16 bytes won't benefit from the 'rep stosl' loop. */ |
---|
37 | cmpl $16,ecx |
---|
38 | jbe .L19 |
---|
39 | testl $7,edi |
---|
40 | je .L10 |
---|
41 | |
---|
42 | /* It turns out that 8-byte aligned 'rep stosl' outperforms |
---|
43 | 4-byte aligned on some x86 platforms. */ |
---|
44 | movb al,(edi) |
---|
45 | incl edi |
---|
46 | decl ecx |
---|
47 | testl $7,edi |
---|
48 | je .L10 |
---|
49 | |
---|
50 | movb al,(edi) |
---|
51 | incl edi |
---|
52 | decl ecx |
---|
53 | testl $7,edi |
---|
54 | je .L10 |
---|
55 | |
---|
56 | movb al,(edi) |
---|
57 | incl edi |
---|
58 | decl ecx |
---|
59 | testl $7,edi |
---|
60 | je .L10 |
---|
61 | |
---|
62 | movb al,(edi) |
---|
63 | incl edi |
---|
64 | decl ecx |
---|
65 | testl $7,edi |
---|
66 | je .L10 |
---|
67 | |
---|
68 | movb al,(edi) |
---|
69 | incl edi |
---|
70 | decl ecx |
---|
71 | testl $7,edi |
---|
72 | je .L10 |
---|
73 | |
---|
74 | movb al,(edi) |
---|
75 | incl edi |
---|
76 | decl ecx |
---|
77 | testl $7,edi |
---|
78 | je .L10 |
---|
79 | |
---|
80 | movb al,(edi) |
---|
81 | incl edi |
---|
82 | decl ecx |
---|
83 | |
---|
84 | /* At this point, ecx>8 and edi%8==0. */ |
---|
85 | .L10: |
---|
86 | movb al,ah |
---|
87 | movl eax,edx |
---|
88 | sall $16,edx |
---|
89 | orl edx,eax |
---|
90 | |
---|
91 | movl ecx,edx |
---|
92 | shrl $2,ecx |
---|
93 | andl $3,edx |
---|
94 | rep |
---|
95 | stosl |
---|
96 | movl edx,ecx |
---|
97 | #endif /* not __OPTIMIZE_SIZE__ */ |
---|
98 | |
---|
99 | .L19: |
---|
100 | rep |
---|
101 | stosb |
---|
102 | |
---|
103 | movl 8(ebp),eax |
---|
104 | |
---|
105 | leal -4(ebp),esp |
---|
106 | popl edi |
---|
107 | leave |
---|
108 | #endif |
---|
109 | ret |
---|
Note: See
TracBrowser
for help on using the repository browser.