aboutsummaryrefslogtreecommitdiffstats
path: root/dos
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2010-06-20 15:21:05 -0700
committerH. Peter Anvin <hpa@zytor.com>2010-06-20 15:21:05 -0700
commit8cf2a1fb42a61f6d19afee86f52ff260fabd1cfa (patch)
tree3216feb1bbdae64b1ae471bbec982a667049017e /dos
parent5b0d97899242fda7218db813bb2a8b9ebfbe4637 (diff)
downloadsyslinux-devel-8cf2a1fb42a61f6d19afee86f52ff260fabd1cfa.tar.gz
syslinux-devel-8cf2a1fb42a61f6d19afee86f52ff260fabd1cfa.tar.xz
syslinux-devel-8cf2a1fb42a61f6d19afee86f52ff260fabd1cfa.zip
Reduce sector 1 space pressure; further merge installer codesyslinux-4.00-pre52
Reduce sector 1 space pressure by moving objects that aren't needed by Sector 1 proper into an "extended patch area". While we're mucking with the installer code, make the syslxint and extlinux installer code even more similar. It should now be pretty straightforward to outright merge the code. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'dos')
-rw-r--r--dos/Makefile2
-rw-r--r--dos/getsetsl.c100
2 files changed, 101 insertions, 1 deletions
diff --git a/dos/Makefile b/dos/Makefile
index fbaca6bd..73925711 100644
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -33,7 +33,7 @@ SRCS = syslinux.c \
$(wildcard ../libfat/*.c)
OBJS = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
LIBOBJS = int2526.o conio.o memcpy.o memset.o skipatou.o atou.o \
- malloc.o free.o \
+ malloc.o free.o getsetsl.o \
argv.o printf.o __divdi3.o __udivmoddi4.o
VPATH = .:../libfat:../libinstaller
diff --git a/dos/getsetsl.c b/dos/getsetsl.c
new file mode 100644
index 00000000..a48f3df2
--- /dev/null
+++ b/dos/getsetsl.c
@@ -0,0 +1,100 @@
+/*
+ * Special handling for the MS-DOS derivative: syslinux_ldlinux
+ * is a "far" object...
+ */
+
+#define _XOPEN_SOURCE 500 /* Required on glibc 2.x */
+#define _BSD_SOURCE
+#include <inttypes.h>
+#include <string.h>
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "syslxint.h"
+
+#define __noinline __attribute__((noinline))
+
+#if 0 /* unused */
+uint8_t get_8_sl(const uint8_t * p)
+{
+ uint8_t v;
+
+ p = set_fs(p);
+ asm volatile("movb %%fs:%1,%0":"=q" (v):"m"(*p));
+ return v;
+}
+#endif
+
+uint16_t get_16_sl(const uint16_t * p)
+{
+ uint16_t v;
+
+ p = set_fs(p);
+ asm volatile("movw %%fs:%1,%0":"=r" (v):"m"(*p));
+ return v;
+}
+
+uint32_t get_32_sl(const uint32_t * p)
+{
+ uint32_t v;
+
+ p = set_fs(p);
+ asm volatile("movl %%fs:%1,%0":"=r" (v):"m"(*p));
+ return v;
+}
+
+#if 0 /* unused */
+uint64_t get_64_sl(const uint64_t * p)
+{
+ uint32_t v0, v1;
+ const uint32_t *pp = (const uint32_t *)set_fs(p);
+
+ asm volatile("movl %%fs:%1,%0" : "=r" (v0) : "m" (pp[0]));
+ asm volatile("movl %%fs:%1,%0" : "=r" (v1) : "m" (pp[1]));
+ return v0 + ((uint64_t)v1 << 32);
+}
+#endif
+
+#if 0 /* unused */
+void set_8_sl(uint8_t * p, uint8_t v)
+{
+ p = set_fs(p);
+ asm volatile("movb %1,%%fs:%0":"=m" (*p):"qi"(v));
+}
+#endif
+
+void set_16_sl(uint16_t * p, uint16_t v)
+{
+ p = set_fs(p);
+ asm volatile("movw %1,%%fs:%0":"=m" (*p):"ri"(v));
+}
+
+void set_32_sl(uint32_t * p, uint32_t v)
+{
+ p = set_fs(p);
+ asm volatile("movl %1,%%fs:%0":"=m" (*p):"ri"(v));
+}
+
+void set_64_sl(uint64_t * p, uint64_t v)
+{
+ uint32_t *pp = (uint32_t *)set_fs(p);
+ asm volatile("movl %1,%%fs:%0" : "=m" (pp[0]) : "ri"((uint32_t)v));
+ asm volatile("movl %1,%%fs:%0" : "=m" (pp[1]) : "ri"((uint32_t)(v >> 32)));
+}
+
+void memcpy_to_sl(void *dst, const void *src, size_t len)
+{
+ uint16_t seg;
+ uint16_t off;
+
+ seg = ldlinux_seg + ((size_t)dst >> 4);
+ off = (size_t)dst & 15;
+
+ asm volatile("pushw %%es ; "
+ "movw %3,%%es ; "
+ "rep ; movsb ; "
+ "popw %%es"
+ : "+D" (off), "+S" (src), "+c" (len)
+ : "r" (seg)
+ : "memory");
+}