summaryrefslogtreecommitdiff
path: root/dos
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2014-01-16 10:54:02 -0800
committerH. Peter Anvin <hpa@zytor.com>2014-01-16 10:56:29 -0800
commit1d01a26f07910da394a733421f1308830d490e94 (patch)
tree243fefe7d518fd4217879f419134c7aa9cc5d86e /dos
parent9ab3608ba4a51e234f251d84f764f39f20e4ded3 (diff)
downloadsyslinux-1d01a26f07910da394a733421f1308830d490e94.tar.gz
dos: We cannot use memset() for a far object, introduce memset_sl()
We started using memset() on the extents buffer in ldlinux.sys, which doesn't reside in the main segment, which worked on all the installer platforms except DOS. Fix DOS by introducing memset_sl() for this case. Reported-by: Ady <ady-sf@hotmail.com> Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'dos')
-rw-r--r--dos/getsetsl.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/dos/getsetsl.c b/dos/getsetsl.c
index fadef438..5260a2a1 100644
--- a/dos/getsetsl.c
+++ b/dos/getsetsl.c
@@ -123,3 +123,20 @@ void memcpy_from_sl(void *dst, const void *src, size_t len)
: "r" (seg)
: "memory");
}
+
+void memset_sl(void *dst, int c, size_t len)
+{
+ uint16_t seg;
+ uint16_t off;
+
+ seg = ds() + ((size_t)dst >> 4);
+ off = (size_t)dst & 15;
+
+ asm volatile("pushw %%es ; "
+ "movw %3,%%es ; "
+ "rep ; stosb ; "
+ "popw %%es"
+ : "+D" (off), "+c" (len)
+ : "a" (c), "r" (seg)
+ : "memory");
+}