Loading...
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
11#include <linux/linkage.h>
12
13/*
14 * Memory copy routines
15 */
16
17 .code16
18 .text
19
20GLOBAL(memcpy)
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 retl
34ENDPROC(memcpy)
35
36GLOBAL(memset)
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 retl
49ENDPROC(memset)
50
51GLOBAL(copy_from_fs)
52 pushw %ds
53 pushw %fs
54 popw %ds
55 calll memcpy
56 popw %ds
57 retl
58ENDPROC(copy_from_fs)
59
60GLOBAL(copy_to_fs)
61 pushw %es
62 pushw %fs
63 popw %es
64 calll memcpy
65 popw %es
66 retl
67ENDPROC(copy_to_fs)
68
69#if 0 /* Not currently used, but can be enabled as needed */
70GLOBAL(copy_from_gs)
71 pushw %ds
72 pushw %gs
73 popw %ds
74 calll memcpy
75 popw %ds
76 retl
77ENDPROC(copy_from_gs)
78
79GLOBAL(copy_to_gs)
80 pushw %es
81 pushw %gs
82 popw %es
83 calll memcpy
84 popw %es
85 retl
86ENDPROC(copy_to_gs)
87#endif
1/* SPDX-License-Identifier: GPL-2.0-only */
2/* ----------------------------------------------------------------------- *
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 *
7 * ----------------------------------------------------------------------- */
8
9#include <linux/linkage.h>
10
11/*
12 * Memory copy routines
13 */
14
15 .code16
16 .text
17
18SYM_FUNC_START_NOALIGN(memcpy)
19 pushw %si
20 pushw %di
21 movw %ax, %di
22 movw %dx, %si
23 pushw %cx
24 shrw $2, %cx
25 rep; movsl
26 popw %cx
27 andw $3, %cx
28 rep; movsb
29 popw %di
30 popw %si
31 retl
32SYM_FUNC_END(memcpy)
33
34SYM_FUNC_START_NOALIGN(memset)
35 pushw %di
36 movw %ax, %di
37 movzbl %dl, %eax
38 imull $0x01010101,%eax
39 pushw %cx
40 shrw $2, %cx
41 rep; stosl
42 popw %cx
43 andw $3, %cx
44 rep; stosb
45 popw %di
46 retl
47SYM_FUNC_END(memset)
48
49SYM_FUNC_START_NOALIGN(copy_from_fs)
50 pushw %ds
51 pushw %fs
52 popw %ds
53 calll memcpy
54 popw %ds
55 retl
56SYM_FUNC_END(copy_from_fs)
57
58SYM_FUNC_START_NOALIGN(copy_to_fs)
59 pushw %es
60 pushw %fs
61 popw %es
62 calll memcpy
63 popw %es
64 retl
65SYM_FUNC_END(copy_to_fs)