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
*/
#include <stdio.h>
+#include <stdlib.h>
#include <netdb.h>
#include <sys/socket.h>
#include <unistd.h>
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 $@ $<
::: "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;
}
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;
}
*/
#include <stdio.h>
+#include <stdlib.h>
#include <inttypes.h>
#include "e820.h"
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++;
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 */
}
/* 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 */
{
}
/* 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 ; "
"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");