diff options
author | hpa <hpa> | 2001-12-17 02:08:56 +0000 |
---|---|---|
committer | hpa <hpa> | 2001-12-17 02:08:56 +0000 |
commit | eaed19412ec5964fd31ae7a0b365c81fa0321c52 (patch) | |
tree | 4c6cf677e1d41379fdd2e59fe3f96482c06e18ed | |
parent | 9d0869d27f663580d408e76cb2ea210714dea553 (diff) | |
download | syslinux-eaed19412ec5964fd31ae7a0b365c81fa0321c52.tar.gz syslinux-eaed19412ec5964fd31ae7a0b365c81fa0321c52.tar.xz syslinux-eaed19412ec5964fd31ae7a0b365c81fa0321c52.zip |
Clean up gcc version dependencies, mostly related to asm() statements.
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | gethostip.c | 1 | ||||
-rw-r--r-- | memdisk/Makefile | 4 | ||||
-rw-r--r-- | memdisk/conio.c | 14 | ||||
-rw-r--r-- | memdisk/e820func.c | 10 | ||||
-rw-r--r-- | memdisk/e820test.c | 1 | ||||
-rw-r--r-- | memdisk/msetup.c | 28 | ||||
-rw-r--r-- | memdisk/setup.c | 29 | ||||
-rw-r--r-- | version | 2 |
9 files changed, 57 insertions, 35 deletions
@@ -1,6 +1,9 @@ Starting with 1.47, changes marked with SYSLINUX/PXELINUX/ISOLINUX apply to that specific program only; other changes apply to both. +Changes in 1.66: + * MEMDISK: Make compile with newer versions of gcc. + Changes in 1.65: * ISOLINUX: Support booting disk image files (to boot DOS or other non-Linux operating systems), *IF* the BIOS works diff --git a/gethostip.c b/gethostip.c index 21131d78..bebcf794 100644 --- a/gethostip.c +++ b/gethostip.c @@ -19,6 +19,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <netdb.h> #include <sys/socket.h> #include <unistd.h> diff --git a/memdisk/Makefile b/memdisk/Makefile index 9dfa9b68..cdd87d5c 100644 --- a/memdisk/Makefile +++ b/memdisk/Makefile @@ -44,10 +44,10 @@ clean: tidy echo '.code16gcc' | cat - $< > $@ %.s: %.S - $(CC) -x c $(CFLAGS) -Wp,-traditional -E -o $@ $< + $(CC) -x c $(CFLAGS) -traditional -E -o $@ $< %.s16: %.S16 - $(CC) -x c $(CFLAGS) -Wp,-traditional -E -o $@ $< + $(CC) -x c $(CFLAGS) -traditional -E -o $@ $< %.s: %.c $(CC) $(CFLAGS) -S -o $@ $< diff --git a/memdisk/conio.c b/memdisk/conio.c index f1ca699e..1efe724e 100644 --- a/memdisk/conio.c +++ b/memdisk/conio.c @@ -30,12 +30,14 @@ int putchar(int ch) ::: "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp"); } - - asm volatile("movw $0x0007,%%bx ; " - "int $0x10" - :: "a" ((uint16_t)(0x0e00|(ch&0xff))) - : "eax", "ebx", "ecx", "edx", - "esi", "edi", "ebp"); + + { + uint16_t ax = 0x0e00|(ch&0xff); + asm volatile("movw $0x0007,%%bx ; " + "int $0x10" + : "+a" (ax) + :: "ebx", "ecx", "edx", "esi", "edi", "ebp"); + } return ch; } diff --git a/memdisk/e820func.c b/memdisk/e820func.c index 3087d33e..57ab0fca 100644 --- a/memdisk/e820func.c +++ b/memdisk/e820func.c @@ -28,10 +28,14 @@ int nranges; void e820map_init(void) { + struct e820range *rp = ranges; + unsigned int rdw = sizeof(ranges) >> 2; nranges = 1; - asm volatile("cld ; rep ; stosl %0,%%es:(%1)" - :: "a" (0), "D" (ranges), "c" (sizeof(ranges) >> 2) - : "edi", "ecx"); + + asm volatile("cld ; rep ; stosl %2,%%es:(%0)" + : "+D" (rp), "+c" (rdw) + : "a" (0) + : "memory"); ranges[1].type = -1; } diff --git a/memdisk/e820test.c b/memdisk/e820test.c index 2d8be07a..2d10a35e 100644 --- a/memdisk/e820test.c +++ b/memdisk/e820test.c @@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <inttypes.h> #include "e820.h" diff --git a/memdisk/msetup.c b/memdisk/msetup.c index d5036d8f..f9ed0712 100644 --- a/memdisk/msetup.c +++ b/memdisk/msetup.c @@ -33,23 +33,25 @@ static inline int get_e820(void) uint32_t lastptr = 0; uint32_t copied; int range_count = 0; - + uint32_t eax, edx; + do { + copied = sizeof(buf); + eax = 0x0000e820; + edx = 0x534d4150; + asm volatile("int $0x15 ; " - "jc 1f ; " - "cmpl $0x534d4150, %%eax ; " - "je 2f\n" - "1:\n\t" + "jnc 1f ; " "xorl %0,%0\n" - "2:" - : "=c" (copied), "+b" (lastptr) - : "a" (0x0000e820), "d" (0x534d4150), - "c" (sizeof(buf)), "D" (&buf) - : "eax", "edx", "esi", "edi", "ebp"); - - if ( copied < 20 ) + "1:" + : "+c" (copied), "+b" (lastptr), + "+a" (eax), "+d" (edx) + : "D" (&buf) + : "esi", "ebp"); + + if ( eax != 0x534d4150 || copied < 20 ) break; - + insertrange(buf.base, buf.len, buf.type); range_count++; diff --git a/memdisk/setup.c b/memdisk/setup.c index 2ab5b98d..e72f4b64 100644 --- a/memdisk/setup.c +++ b/memdisk/setup.c @@ -151,10 +151,14 @@ static void high_bcopy(uint32_t dst, uint32_t src, uint16_t len) high_mover.dst2 = dst >> 16; high_mover.dst3 = dst >> 24; - asm volatile("pushfl ; movb $0x87,%%ah ; int $0x15 ; popfl" + asm volatile("pushal ; " + "pushfl ; " + "movb $0x87,%%ah ; " + "int $0x15 ; " + "popfl ; " + "popal" :: "S" (&high_mover), "c" (len >> 1) - : "eax", "ebx", "ecx", "edx", - "ebp", "esi", "edi", "memory"); + : "memory"); } #define LOWSEG 0x0800 /* Should match init.S16 */ @@ -594,21 +598,22 @@ uint32_t setup(void) } /* Copy driver followed by E820 table */ - asm volatile("pushw %%es ; " + asm volatile("pushal ; " + "pushw %%es ; " "movw %0,%%es ; " "cld ; " "rep ; movsl %%ds:(%%si), %%es:(%%di) ; " "movw %1,%%cx ; " "movw %2,%%si ; " "rep ; movsl %%ds:(%%si), %%es:(%%di) ; " - "popw %%es" + "popw %%es ; " + "popal" :: "r" (driverseg), "r" ((uint16_t)((nranges+1)*3)), /* 3 dwords/range */ "r" ((uint16_t)&ranges), "c" (bin_size >> 2), "S" (&_binary_memdisk_bin_start), - "D" (0) - : "esi", "edi", "ecx"); + "D" (0)); /* Install the interrupt handlers */ { @@ -644,7 +649,9 @@ uint32_t setup(void) } /* Reboot into the new "disk" */ - asm volatile("pushw %%es ; " + asm volatile("pushl %%ebp ; " + "pushl %%edx ; " + "pushw %%es ; " "xorw %%cx,%%cx ; " "movw %%cx,%%es ; " "incw %%cx ; " @@ -652,10 +659,12 @@ uint32_t setup(void) "movw $0x7c00,%%bx ; " "int $0x13 ; " "popw %%es ; " - "setc %0 " + "popl %%edx ; " + "popl %%ebp ; " + "setc %0" : "=rm" (status), "=a" (exitcode) : "d" ((uint16_t)geometry->driveno) - : "ebx", "ecx", "edx", "esi", "edi", "ebp"); + : "ecx", "ebx", "esi", "edi"); if ( status ) { puts("MEMDISK: Failed to load new boot sector\n"); @@ -1 +1 @@ -1.65 +1.66 |