blob: 6afd05e819d26831d739bb6c6aba27f4ba0c2137 [file] [log] [blame]
Thomas Gleixner97873a32019-06-04 10:11:30 +02001/* SPDX-License-Identifier: GPL-2.0-only */
H. Peter Anvin5be86562007-07-11 12:18:41 -07002/* ----------------------------------------------------------------------- *
3 *
4 * Copyright (C) 1991, 1992 Linus Torvalds
5 * Copyright 2007 rPath, Inc. - All Rights Reserved
6 *
H. Peter Anvin5be86562007-07-11 12:18:41 -07007 * ----------------------------------------------------------------------- */
8
Cyrill Gorcunov2f795552009-02-14 00:50:20 +03009#include <linux/linkage.h>
10
H. Peter Anvin5be86562007-07-11 12:18:41 -070011/*
H. Peter Anvin5be86562007-07-11 12:18:41 -070012 * Memory copy routines
13 */
14
David Woodhousee24df922014-01-03 22:30:42 +000015 .code16
H. Peter Anvin5be86562007-07-11 12:18:41 -070016 .text
17
Jiri Slaby37818af2019-10-11 13:50:56 +020018SYM_FUNC_START_NOALIGN(memcpy)
H. Peter Anvin5be86562007-07-11 12:18:41 -070019 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
David Woodhousee24df922014-01-03 22:30:42 +000031 retl
Jiri Slaby37818af2019-10-11 13:50:56 +020032SYM_FUNC_END(memcpy)
H. Peter Anvin5be86562007-07-11 12:18:41 -070033
Jiri Slaby37818af2019-10-11 13:50:56 +020034SYM_FUNC_START_NOALIGN(memset)
H. Peter Anvin5be86562007-07-11 12:18:41 -070035 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
David Woodhousee24df922014-01-03 22:30:42 +000046 retl
Jiri Slaby37818af2019-10-11 13:50:56 +020047SYM_FUNC_END(memset)
H. Peter Anvin5be86562007-07-11 12:18:41 -070048
Jiri Slaby37818af2019-10-11 13:50:56 +020049SYM_FUNC_START_NOALIGN(copy_from_fs)
H. Peter Anvin5be86562007-07-11 12:18:41 -070050 pushw %ds
51 pushw %fs
52 popw %ds
David Woodhousee24df922014-01-03 22:30:42 +000053 calll memcpy
H. Peter Anvin5be86562007-07-11 12:18:41 -070054 popw %ds
David Woodhousee24df922014-01-03 22:30:42 +000055 retl
Jiri Slaby37818af2019-10-11 13:50:56 +020056SYM_FUNC_END(copy_from_fs)
H. Peter Anvin5be86562007-07-11 12:18:41 -070057
Jiri Slaby37818af2019-10-11 13:50:56 +020058SYM_FUNC_START_NOALIGN(copy_to_fs)
H. Peter Anvin5be86562007-07-11 12:18:41 -070059 pushw %es
60 pushw %fs
61 popw %es
David Woodhousee24df922014-01-03 22:30:42 +000062 calll memcpy
H. Peter Anvin5be86562007-07-11 12:18:41 -070063 popw %es
David Woodhousee24df922014-01-03 22:30:42 +000064 retl
Jiri Slaby37818af2019-10-11 13:50:56 +020065SYM_FUNC_END(copy_to_fs)