Merge branch 'master' into fsc
authorH. Peter Anvin <hpa@zytor.com>
Tue, 22 Dec 2009 17:38:43 +0000 (09:38 -0800)
committerH. Peter Anvin <hpa@zytor.com>
Tue, 22 Dec 2009 17:38:43 +0000 (09:38 -0800)
Resolved Conflicts:
com32/Makefile
com32/lib/sys/open.c
com32/modules/Makefile
dos/Makefile
dos/com16.ld
dos/syslinux.c
version

Signed-off-by: H. Peter Anvin <hpa@zytor.com>
1  2 
MCONFIG
Makefile
com32/Makefile
com32/lib/Makefile
com32/lib/sys/open.c
com32/mboot/mboot.c
com32/modules/Makefile
doc/comboot.txt
dos/Makefile
dos/syslinux.c

diff --cc MCONFIG
Simple merge
diff --cc Makefile
Simple merge
diff --cc com32/Makefile
@@@ -1,3 -1,3 +1,3 @@@
- SUBDIRS = tools lib gpllib libutil modules mboot menu samples rosh cmenu hdt
 -SUBDIRS = lib gpllib libutil modules mboot menu samples rosh cmenu hdt gfxboot
++SUBDIRS = tools lib gpllib libutil modules mboot menu samples rosh cmenu hdt gfxboot
  all tidy dist clean spotless install:
        set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d $@; done
Simple merge
@@@ -78,7 -79,7 +79,7 @@@ int open(const char *pathname, int flag
  
      {
        uint16_t blklg2;
-       asm("bsrw %1,%0" : "=r"(blklg2) : "rm"(regs.ecx.w[0]));
 -      asm("bsrw %1,%0" :  "=r" (blklg2) : "rm" (regs.ecx.w[0]));
++      asm("bsrw %1,%0" : "=r" (blklg2) : "rm" (regs.ecx.w[0]));
        fp->i.blocklg2 = blklg2;
      }
      fp->i.length = regs.eax.l;
Simple merge
@@@ -21,7 -21,7 +21,8 @@@ include ../MCONFI
  MODULES         = chain.c32 config.c32 ethersel.c32 dmitest.c32 cpuidtest.c32 \
            disk.c32 pcitest.c32 elf.c32 linux.c32 reboot.c32 pmload.c32 \
            meminfo.c32 sdi.c32 sanboot.c32 ifcpu64.c32 vesainfo.c32 \
-           kbdmap.c32 cmd.c32 vpdtest.c32 host.c32 dir.c32 gpxecmd.c32
 -          kbdmap.c32 cmd.c32 vpdtest.c32 gpxecmd.c32 ifcpu.c32
++          kbdmap.c32 cmd.c32 vpdtest.c32 host.c32 dir.c32 gpxecmd.c32 \
++          ifcpu.c32
  
  TESTFILES =
  
diff --cc doc/comboot.txt
Simple merge
diff --cc dos/Makefile
  topdir = ..
  include $(topdir)/MCONFIG.embedded
  
 -LDFLAGS        = -T com16.ld
 +CFLAGS        += -D__MSDOS__
+ # CFLAGS  += -DDEBUG
 +
 +LDFLAGS        = -T dosexe.ld
  OPTFLAGS = -g
  INCLUDES = -include code16.h -nostdinc -iwithprefix include \
           -I. -I.. -I../libfat -I ../libinstaller
@@@ -30,8 -29,9 +31,9 @@@ SRCS     = syslinux.c 
           ../libinstaller/ldlinux_bin.c \
           ../libinstaller/mbr_bin.c \
             $(wildcard ../libfat/*.c)
 -OBJS   = crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
 +OBJS   = header.o crt0.o $(patsubst %.c,%.o,$(notdir $(SRCS)))
- LIBOBJS        = conio.o memcpy.o memset.o  skipatou.o atou.o malloc.o free.o \
+ LIBOBJS        = int2526.o conio.o memcpy.o memset.o  skipatou.o atou.o \
+          malloc.o free.o \
           argv.o printf.o __divdi3.o __udivmoddi4.o
  
  VPATH = .:../libfat:../libinstaller
diff --cc dos/syslinux.c
@@@ -587,10 -651,11 +682,11 @@@ int main(int argc, char *argv[]
  
      ldlinux_name[0] = dev_fd | 0x40;
  
 -    set_attributes(ldlinux_name, 0x00);
 -    fd = creat(ldlinux_name, 0);
 -    write_file(fd, syslinux_ldlinux, syslinux_ldlinux_len);
 +    set_attributes(ldlinux_name, 0);
-     fd = creat(ldlinux_name, 0x07);   /* SYSTEM HIDDEN READONLY */
++    fd = creat(ldlinux_name, 0);      /* SYSTEM HIDDEN READONLY */
 +    write_ldlinux(fd);
      close(fd);
+     set_attributes(ldlinux_name, 0x07);       /* SYSTEM HIDDEN READONLY */
  
      /*
       * Now, use libfat to create a block map.  This probably
      /*
       * Patch ldlinux.sys and the boot sector
       */
 -    syslinux_patch(sectors, nsectors, stupid, raid_mode);
 +    i = syslinux_patch(sectors, nsectors, stupid, raid_mode);
 +    patch_sectors = (i + SECTOR_SIZE - 1) >> SECTOR_SHIFT;
  
      /*
 -     * Write the now-patched first sector of ldlinux.sys
 +     * Overwrite the now-patched ldlinux.sys
       */
-     lock_device(3);
+     /* lock_device(3); -- doesn't seem to be needed */
 -    write_device(dev_fd, syslinux_ldlinux, 1, sectors[0]);
 +    for (i = 0; i < patch_sectors; i++) {
 +      uint16_t si, di, cx;
 +      si = 0;
 +      di = (size_t) sectbuf;
 +      cx = SECTOR_SIZE >> 2;
 +      asm volatile ("movw %3,%%fs ; fs ; rep ; movsl":"+S" (si), "+D"(di),
 +                    "+c"(cx)
 +                    :"abd"((uint16_t)
 +                           (ldlinux_seg + (i << (SECTOR_SHIFT - 4)))));
 +      write_device(dev_fd, sectbuf, 1, sectors[i]);
 +    }
  
      /*
       * Muck with the MBR, if desired, while we hold the lock