summaryrefslogtreecommitdiff
path: root/dos/memmove.S
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2010-06-22 17:07:03 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2010-06-22 17:07:03 -0700
commit0b014e446285b7aad1e19163a15b9cc8936047d3 (patch)
tree3270ef7d7d94cbdf640bfc8f74fd679087f54abf /dos/memmove.S
parentbdf96656c4418a691868b85cb90a80f353b0cb0b (diff)
downloadsyslinux-0b014e446285b7aad1e19163a15b9cc8936047d3.tar.gz
dos: vacuous ADV support
Vacuous ADV support: install an empty ADV. Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'dos/memmove.S')
-rw-r--r--dos/memmove.S36
1 files changed, 36 insertions, 0 deletions
diff --git a/dos/memmove.S b/dos/memmove.S
new file mode 100644
index 00000000..1ab2cb23
--- /dev/null
+++ b/dos/memmove.S
@@ -0,0 +1,36 @@
+#
+# memmove.S
+#
+# Simple 16-bit memmove() implementation
+#
+
+ .text
+ .code16gcc
+ .globl memmove
+ .type memmove, @function
+memmove:
+ pushw %di
+ pushw %si
+ movw %ax,%di
+ movw %dx,%si
+ cmpw %si,%di
+ ja 1f
+ # The third argument is already in cx
+ cld
+ rep ; movsb
+2:
+ popw %si
+ popw %di
+ ret
+
+1: /* si <= di, need reverse copy */
+ add %cx,%di
+ add %cx,%si
+ dec %di
+ dec %si
+ std
+ rep ; movsb
+ cld
+ jmp 2b
+
+ .size memmove,.-memmove