fixes for Power64
[tridge/junkcode.git] / memcopy.c
1 /*
2 ** Assumptions:
3 **
4 ** + dst and src are 8-byte aligned.
5 ** + Copying at least 8 bytes of data
6 */
7
8 void
9 dlmemcpy(char *dst, char *src, int nbytes)
10         {
11
12         __asm__("
13         pushal
14         movl %0,%%edi
15         movl %1,%%esi
16         movl %2,%%eax
17         movl %%eax,%%ecx
18         and  $7, %%eax
19         shr  $3, %%ecx
20 .align 32
21 1:
22         fldl  (%%esi)
23         fstpl (%%edi)
24         add    $8,%%esi
25         add    $8,%%edi
26         dec    %%ecx
27         jne    1b
28 2:
29         movl %%eax,%%ecx
30         rep
31         movsb
32         popal
33           " :: "g"(dst), "g"(src), "g"(nbytes));
34
35         }