2007-07-11 21:18:41 +02:00
|
|
|
/* ----------------------------------------------------------------------- *
|
|
|
|
*
|
|
|
|
* Copyright (C) 1991, 1992 Linus Torvalds
|
|
|
|
* Copyright 2007 rPath, Inc. - All Rights Reserved
|
|
|
|
*
|
|
|
|
* This file is part of the Linux kernel, and is made available under
|
|
|
|
* the terms of the GNU General Public License version 2.
|
|
|
|
*
|
|
|
|
* ----------------------------------------------------------------------- */
|
|
|
|
|
2009-02-13 22:50:20 +01:00
|
|
|
#include <linux/linkage.h>
|
|
|
|
|
2007-07-11 21:18:41 +02:00
|
|
|
/*
|
|
|
|
* Memory copy routines
|
|
|
|
*/
|
|
|
|
|
|
|
|
.code16gcc
|
|
|
|
.text
|
|
|
|
|
2009-02-13 22:50:20 +01:00
|
|
|
GLOBAL(memcpy)
|
2007-07-11 21:18:41 +02:00
|
|
|
pushw %si
|
|
|
|
pushw %di
|
|
|
|
movw %ax, %di
|
|
|
|
movw %dx, %si
|
|
|
|
pushw %cx
|
|
|
|
shrw $2, %cx
|
|
|
|
rep; movsl
|
|
|
|
popw %cx
|
|
|
|
andw $3, %cx
|
|
|
|
rep; movsb
|
|
|
|
popw %di
|
|
|
|
popw %si
|
|
|
|
ret
|
2009-02-13 22:50:20 +01:00
|
|
|
ENDPROC(memcpy)
|
2007-07-11 21:18:41 +02:00
|
|
|
|
2009-02-13 22:50:20 +01:00
|
|
|
GLOBAL(memset)
|
2007-07-11 21:18:41 +02:00
|
|
|
pushw %di
|
|
|
|
movw %ax, %di
|
|
|
|
movzbl %dl, %eax
|
|
|
|
imull $0x01010101,%eax
|
|
|
|
pushw %cx
|
|
|
|
shrw $2, %cx
|
|
|
|
rep; stosl
|
|
|
|
popw %cx
|
|
|
|
andw $3, %cx
|
|
|
|
rep; stosb
|
|
|
|
popw %di
|
|
|
|
ret
|
2009-02-13 22:50:20 +01:00
|
|
|
ENDPROC(memset)
|
2007-07-11 21:18:41 +02:00
|
|
|
|
2009-02-13 22:50:20 +01:00
|
|
|
GLOBAL(copy_from_fs)
|
2007-07-11 21:18:41 +02:00
|
|
|
pushw %ds
|
|
|
|
pushw %fs
|
|
|
|
popw %ds
|
|
|
|
call memcpy
|
|
|
|
popw %ds
|
|
|
|
ret
|
2009-02-13 22:50:20 +01:00
|
|
|
ENDPROC(copy_from_fs)
|
2007-07-11 21:18:41 +02:00
|
|
|
|
2009-02-13 22:50:20 +01:00
|
|
|
GLOBAL(copy_to_fs)
|
2007-07-11 21:18:41 +02:00
|
|
|
pushw %es
|
|
|
|
pushw %fs
|
|
|
|
popw %es
|
|
|
|
call memcpy
|
|
|
|
popw %es
|
|
|
|
ret
|
2009-02-13 22:50:20 +01:00
|
|
|
ENDPROC(copy_to_fs)
|
2007-07-11 21:18:41 +02:00
|
|
|
|
|
|
|
#if 0 /* Not currently used, but can be enabled as needed */
|
2009-02-13 22:50:20 +01:00
|
|
|
GLOBAL(copy_from_gs)
|
2007-07-11 21:18:41 +02:00
|
|
|
pushw %ds
|
|
|
|
pushw %gs
|
|
|
|
popw %ds
|
|
|
|
call memcpy
|
|
|
|
popw %ds
|
|
|
|
ret
|
2009-02-13 22:50:20 +01:00
|
|
|
ENDPROC(copy_from_gs)
|
2007-07-11 21:18:41 +02:00
|
|
|
|
2009-02-13 22:50:20 +01:00
|
|
|
GLOBAL(copy_to_gs)
|
2007-07-11 21:18:41 +02:00
|
|
|
pushw %es
|
|
|
|
pushw %gs
|
|
|
|
popw %es
|
|
|
|
call memcpy
|
|
|
|
popw %es
|
|
|
|
ret
|
2009-02-13 22:50:20 +01:00
|
|
|
ENDPROC(copy_to_gs)
|
2007-07-11 21:18:41 +02:00
|
|
|
#endif
|