From 48337e3817f884f3ce8e7632b984a564a0703047 Mon Sep 17 00:00:00 2001 From: "H. Peter Anvin" Date: Mon, 25 May 2009 18:31:13 -0700 Subject: [PATCH] dos installer: reuse ldlinux_seg Make ldlinux_seg a global variable, and use it in syslxmod.c. This reduces the size of syslxmod.o fairly significantly. Signed-off-by: H. Peter Anvin --- dos/syslinux.c | 2 +- libinstaller/syslxmod.c | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/dos/syslinux.c b/dos/syslinux.c index ecb7c07..6bbdada 100644 --- a/dos/syslinux.c +++ b/dos/syslinux.c @@ -115,7 +115,7 @@ int rename(const char *oldname, const char *newname) } extern const char __payload_sseg[]; -static uint16_t ldlinux_seg; +uint16_t ldlinux_seg; ssize_t write_ldlinux(int fd) { diff --git a/libinstaller/syslxmod.c b/libinstaller/syslxmod.c index 969ce8b..4abfb38 100644 --- a/libinstaller/syslxmod.c +++ b/libinstaller/syslxmod.c @@ -127,7 +127,7 @@ const char *syslinux_check_bootsect(const void *bs) */ #ifdef __MSDOS__ -extern const char __payload_sseg[]; /* Symbol from linker */ +extern uint16_t ldlinux_seg; /* Defined in dos/syslinux.c */ static inline __attribute__((const)) uint16_t ds(void) { @@ -140,8 +140,7 @@ static inline void *set_fs(const void *p) { uint16_t seg; - seg = ds() + (size_t)__payload_sseg; - seg += (size_t)p >> 4; + seg = ldlinux_seg + ((size_t)p >> 4); asm volatile("movw %0,%%fs" : : "rm" (seg)); return (void *)((size_t)p & 0xf); } -- 2.7.4