POK(kernelpart)
Main Page
Data Structures
Files
File List
Globals
memcpy.c
Go to the documentation of this file.
1
/*
2
* POK header
3
*
4
* The following file is a part of the POK project. Any modification should
5
* made according to the POK licence. You CANNOT use this file or a part of
6
* this file is this part of a file for your own project
7
*
8
* For more information on the POK licence, please see our LICENCE FILE
9
*
10
* Please follow the coding guidelines described in doc/CODING_GUIDELINES
11
*
12
* Copyright (c) 2007-2009 POK team
13
*
14
* Created by julien on Thu Jan 15 23:34:13 2009
15
*/
16
17
18
#include <
libc.h
>
19
20
void
*
memcpy
(
void
* to,
21
const
void
* from,
22
size_t
n)
23
{
24
#ifdef __i386__
25
int
d0;
26
int
d1;
27
int
d2;
28
29
__asm__ __volatile__(
30
"rep ; movsl\n\t"
31
"testb $2,%b4\n\t"
32
"je 1f\n\t"
33
"movsw\n"
34
"1:\ttestb $1,%b4\n\t"
35
"je 2f\n\t"
36
"movsb\n"
37
"2:"
38
:
"=&c"
(d0),
"=&D"
(d1),
"=&S"
(d2)
39
:
"0"
(n/4),
"q"
(n),
"1"
((
long
) to),
"2"
((
long
) from)
40
:
"memory"
);
41
#else
42
char
*cto = (
char
*)to;
43
const
char
*cfrom = (
const
char
*)from;
44
45
for
(; n > 0; n--)
46
{
47
*cto++ = *cfrom++;
48
}
49
#endif
50
return
(to);
51
}
52
kernel
libc
memcpy.c
Generated on Fri Jun 1 2012 19:07:12 for POK(kernelpart) by
1.8.1