aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xdos/Makefile4
-rwxr-xr-xdos/dosexe.ld10
-rw-r--r--dos/getsetsl.c2
-rw-r--r--libinstaller/syslxint.h4
4 files changed, 10 insertions, 10 deletions
diff --git a/dos/Makefile b/dos/Makefile
index 3d19ff29..9f48962b 100755
--- a/dos/Makefile
+++ b/dos/Makefile
@@ -31,10 +31,10 @@ SRCS = syslinux.c \
../libinstaller/syslxopt.c \
../libinstaller/setadv.c \
../libinstaller/bootsect_bin.c \
- ../libinstaller/ldlinux_bin.c \
../libinstaller/mbr_bin.c \
$(wildcard ../libfat/*.c)
-OBJS = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
+OBJS = header.o crt0.o ldlinux.o \
+ $(patsubst %.c,%.o,$(notdir $(SRCS)))
LIBOBJS = int2526.o conio.o memcpy.o memset.o memmove.o skipatou.o atou.o \
malloc.o free.o getopt_long.o getsetsl.o strchr.o strtoul.o \
strntoumax.o argv.o printf.o __divdi3.o __udivmoddi4.o
diff --git a/dos/dosexe.ld b/dos/dosexe.ld
index 4612b30a..c67c5060 100755
--- a/dos/dosexe.ld
+++ b/dos/dosexe.ld
@@ -26,20 +26,22 @@ SECTIONS
__header_size = .;
__payload_lma = .;
- . = 0;
+ . = 0x100000000 - syslinux_ldlinux_size;
.payload : AT (__payload_lma) {
__payload_start = .;
- ldlinux_bin.o(.data)
+ *(.payload)
__payload_end = .;
}
__payload_len = __payload_end - __payload_start;
__payload_dwords = __payload_len >> 2;
- . = ALIGN(16);
- __text_lma = __payload_lma + .;
+ __text_lma = __payload_lma + syslinux_ldlinux_size;
__payload_sseg = (__payload_lma - __text_lma) >> 4;
_exe_text_seg = (__text_lma - __header_size) >> 4;
+ __assert1 = ASSERT((__payload_len == syslinux_ldlinux_size),
+ "syslinux_ldlinux_size must equal the size of .payload");
+
. = 0;
.text : AT (__text_lma) {
*(.text .stub .text.* .gnu.linkonce.t.*)
diff --git a/dos/getsetsl.c b/dos/getsetsl.c
index a48f3df2..5c1dbbda 100644
--- a/dos/getsetsl.c
+++ b/dos/getsetsl.c
@@ -87,7 +87,7 @@ 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);
+ seg = ds() + ((size_t)dst >> 4);
off = (size_t)dst & 15;
asm volatile("pushw %%es ; "
diff --git a/libinstaller/syslxint.h b/libinstaller/syslxint.h
index f16c2e5c..b8e872a7 100644
--- a/libinstaller/syslxint.h
+++ b/libinstaller/syslxint.h
@@ -111,8 +111,6 @@ static inline void set_64(uint64_t *p, uint64_t v)
*/
#ifdef __MSDOS__
-extern uint16_t ldlinux_seg; /* Defined in dos/syslinux.c */
-
static inline __attribute__ ((const))
uint16_t ds(void)
{
@@ -125,7 +123,7 @@ static inline void *set_fs(const void *p)
{
uint16_t seg;
- seg = ldlinux_seg + ((size_t) p >> 4);
+ seg = ds() + ((size_t) p >> 4);
asm volatile ("movw %0,%%fs"::"rm" (seg));
return (void *)((size_t) p & 0xf);
}