xref: /openbmc/linux/arch/x86/boot/copy.S (revision c95baf12f5077419db01313ab61c2aac007d40cd)
197873a3dSThomas Gleixner/* SPDX-License-Identifier: GPL-2.0-only */
296ae6ea0SThomas Gleixner/* ----------------------------------------------------------------------- *
396ae6ea0SThomas Gleixner *
496ae6ea0SThomas Gleixner *   Copyright (C) 1991, 1992 Linus Torvalds
596ae6ea0SThomas Gleixner *   Copyright 2007 rPath, Inc. - All Rights Reserved
696ae6ea0SThomas Gleixner *
796ae6ea0SThomas Gleixner * ----------------------------------------------------------------------- */
896ae6ea0SThomas Gleixner
92f795550SCyrill Gorcunov#include <linux/linkage.h>
102f795550SCyrill Gorcunov
1196ae6ea0SThomas Gleixner/*
1296ae6ea0SThomas Gleixner * Memory copy routines
1396ae6ea0SThomas Gleixner */
1496ae6ea0SThomas Gleixner
15e24df921SDavid Woodhouse	.code16
1696ae6ea0SThomas Gleixner	.text
1796ae6ea0SThomas Gleixner
18*37818afdSJiri SlabySYM_FUNC_START_NOALIGN(memcpy)
1996ae6ea0SThomas Gleixner	pushw	%si
2096ae6ea0SThomas Gleixner	pushw	%di
2196ae6ea0SThomas Gleixner	movw	%ax, %di
2296ae6ea0SThomas Gleixner	movw	%dx, %si
2396ae6ea0SThomas Gleixner	pushw	%cx
2496ae6ea0SThomas Gleixner	shrw	$2, %cx
2596ae6ea0SThomas Gleixner	rep; movsl
2696ae6ea0SThomas Gleixner	popw	%cx
2796ae6ea0SThomas Gleixner	andw	$3, %cx
2896ae6ea0SThomas Gleixner	rep; movsb
2996ae6ea0SThomas Gleixner	popw	%di
3096ae6ea0SThomas Gleixner	popw	%si
31e24df921SDavid Woodhouse	retl
32*37818afdSJiri SlabySYM_FUNC_END(memcpy)
3396ae6ea0SThomas Gleixner
34*37818afdSJiri SlabySYM_FUNC_START_NOALIGN(memset)
3596ae6ea0SThomas Gleixner	pushw	%di
3696ae6ea0SThomas Gleixner	movw	%ax, %di
3796ae6ea0SThomas Gleixner	movzbl	%dl, %eax
3896ae6ea0SThomas Gleixner	imull	$0x01010101,%eax
3996ae6ea0SThomas Gleixner	pushw	%cx
4096ae6ea0SThomas Gleixner	shrw	$2, %cx
4196ae6ea0SThomas Gleixner	rep; stosl
4296ae6ea0SThomas Gleixner	popw	%cx
4396ae6ea0SThomas Gleixner	andw	$3, %cx
4496ae6ea0SThomas Gleixner	rep; stosb
4596ae6ea0SThomas Gleixner	popw	%di
46e24df921SDavid Woodhouse	retl
47*37818afdSJiri SlabySYM_FUNC_END(memset)
4896ae6ea0SThomas Gleixner
49*37818afdSJiri SlabySYM_FUNC_START_NOALIGN(copy_from_fs)
5096ae6ea0SThomas Gleixner	pushw	%ds
5196ae6ea0SThomas Gleixner	pushw	%fs
5296ae6ea0SThomas Gleixner	popw	%ds
53e24df921SDavid Woodhouse	calll	memcpy
5496ae6ea0SThomas Gleixner	popw	%ds
55e24df921SDavid Woodhouse	retl
56*37818afdSJiri SlabySYM_FUNC_END(copy_from_fs)
5796ae6ea0SThomas Gleixner
58*37818afdSJiri SlabySYM_FUNC_START_NOALIGN(copy_to_fs)
5996ae6ea0SThomas Gleixner	pushw	%es
6096ae6ea0SThomas Gleixner	pushw	%fs
6196ae6ea0SThomas Gleixner	popw	%es
62e24df921SDavid Woodhouse	calll	memcpy
6396ae6ea0SThomas Gleixner	popw	%es
64e24df921SDavid Woodhouse	retl
65*37818afdSJiri SlabySYM_FUNC_END(copy_to_fs)
66