Commit | Line | Data |
---|---|---|
5be86566 PA |
1 | /* ----------------------------------------------------------------------- * |
2 | * | |
3 | * Copyright (C) 1991, 1992 Linus Torvalds | |
4 | * Copyright 2007 rPath, Inc. - All Rights Reserved | |
5 | * | |
6 | * This file is part of the Linux kernel, and is made available under | |
7 | * the terms of the GNU General Public License version 2. | |
8 | * | |
9 | * ----------------------------------------------------------------------- */ | |
10 | ||
2f795550 CG |
11 | #include <linux/linkage.h> |
12 | ||
5be86566 | 13 | /* |
5be86566 PA |
14 | * Memory copy routines |
15 | */ | |
16 | ||
17 | .code16gcc | |
18 | .text | |
19 | ||
2f795550 | 20 | GLOBAL(memcpy) |
5be86566 PA |
21 | pushw %si |
22 | pushw %di | |
23 | movw %ax, %di | |
24 | movw %dx, %si | |
25 | pushw %cx | |
26 | shrw $2, %cx | |
27 | rep; movsl | |
28 | popw %cx | |
29 | andw $3, %cx | |
30 | rep; movsb | |
31 | popw %di | |
32 | popw %si | |
33 | ret | |
2f795550 | 34 | ENDPROC(memcpy) |
5be86566 | 35 | |
2f795550 | 36 | GLOBAL(memset) |
5be86566 PA |
37 | pushw %di |
38 | movw %ax, %di | |
39 | movzbl %dl, %eax | |
40 | imull $0x01010101,%eax | |
41 | pushw %cx | |
42 | shrw $2, %cx | |
43 | rep; stosl | |
44 | popw %cx | |
45 | andw $3, %cx | |
46 | rep; stosb | |
47 | popw %di | |
48 | ret | |
2f795550 | 49 | ENDPROC(memset) |
5be86566 | 50 | |
2f795550 | 51 | GLOBAL(copy_from_fs) |
5be86566 PA |
52 | pushw %ds |
53 | pushw %fs | |
54 | popw %ds | |
55 | call memcpy | |
56 | popw %ds | |
57 | ret | |
2f795550 | 58 | ENDPROC(copy_from_fs) |
5be86566 | 59 | |
2f795550 | 60 | GLOBAL(copy_to_fs) |
5be86566 PA |
61 | pushw %es |
62 | pushw %fs | |
63 | popw %es | |
64 | call memcpy | |
65 | popw %es | |
66 | ret | |
2f795550 | 67 | ENDPROC(copy_to_fs) |
5be86566 PA |
68 | |
69 | #if 0 /* Not currently used, but can be enabled as needed */ | |
2f795550 | 70 | GLOBAL(copy_from_gs) |
5be86566 PA |
71 | pushw %ds |
72 | pushw %gs | |
73 | popw %ds | |
74 | call memcpy | |
75 | popw %ds | |
76 | ret | |
2f795550 | 77 | ENDPROC(copy_from_gs) |
5be86566 | 78 | |
2f795550 | 79 | GLOBAL(copy_to_gs) |
5be86566 PA |
80 | pushw %es |
81 | pushw %gs | |
82 | popw %es | |
83 | call memcpy | |
84 | popw %es | |
85 | ret | |
2f795550 | 86 | ENDPROC(copy_to_gs) |
5be86566 | 87 | #endif |