MErge mainline into intwrap
authorVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 25 Aug 2010 21:39:42 +0000 (23:39 +0200)
committerVladimir 'phcoder' Serbinenko <phcoder@gmail.com>
Wed, 25 Aug 2010 21:39:42 +0000 (23:39 +0200)
30 files changed:
1  2 
grub-core/Makefile.am
grub-core/Makefile.core.def
grub-core/commands/handler.c
grub-core/commands/i386/pc/halt.c
grub-core/disk/i386/pc/biosdisk.c
grub-core/fs/i386/pc/pxe.c
grub-core/kern/efi/efi.c
grub-core/kern/emu/main.c
grub-core/kern/handler.c
grub-core/kern/i386/coreboot/init.c
grub-core/kern/i386/loader.S
grub-core/kern/i386/pc/init.c
grub-core/kern/i386/pc/mmap.c
grub-core/kern/i386/pc/startup.S
grub-core/kern/i386/qemu/mmap.c
grub-core/kern/i386/qemu/startup.S
grub-core/kern/ieee1275/openfw.c
grub-core/lib/efi/halt.c
grub-core/lib/i386/halt.c
grub-core/lib/ieee1275/halt.c
grub-core/loader/i386/bsd.c
grub-core/loader/i386/efi/xnu.c
grub-core/loader/i386/pc/xnu.c
grub-core/normal/handler.c
grub-core/video/i386/pc/vbe.c
grub-core/video/i386/pc/vga.c
include/grub/i386/multiboot/init.h
include/grub/i386/qemu/init.h
include/grub/mips/yeeloong/kernel.h
include/grub/misc.h

index 0000000,7738035..2834664
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,359 +1,354 @@@
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/biosdisk.h
+ AUTOMAKE_OPTIONS = subdir-objects
+ DEPDIR=.deps-core
+ include $(top_srcdir)/conf/Makefile.common
+ CC=$(TARGET_CC)
+ CPP=$(TARGET_CC)
+ CCAS=$(TARGET_CC)
+ if COND_GRUB_MKFONT
+ if COND_HAVE_FONT_SOURCE
+ TARGET_CFLAGS += -DUSE_ASCII_FAILBACK=1 -DHAVE_UNIFONT_WIDTHSPEC=1
+ endif
+ endif
+ AM_CFLAGS = $(TARGET_CFLAGS)
+ AM_LDFLAGS = $(TARGET_LDFLAGS)
+ AM_CPPFLAGS = $(TARGET_CPPFLAGS) $(CPPFLAGS_DEFAULT)
+ AM_CCASFLAGS = $(TARGET_CCASFLAGS) $(CCASFLAGS_DEFAULT)
+ CFLAGS_PROGRAM += $(CFLAGS_PLATFORM)
+ LDFLAGS_PROGRAM += $(LDFLAGS_PLATFORM)
+ CPPFLAGS_PROGRAM += $(CPPFLAGS_PLATFORM)
+ CCASFLAGS_PROGRAM += $(CCASFLAGS_PLATFORM)
+ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
+ CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
+ CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
+ # gentrigtables
+ gentrigtables: gentrigtables.c
+       $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $<
+ CLEANFILES += gentrigtables
+ # trigtables.c
+ trigtables.c: gentrigtables gentrigtables.c $(top_srcdir)/configure.ac
+       $(builddir)/gentrigtables > $@
+ CLEANFILES += trigtables.c
+ # XXX Use Automake's LEX & YACC support
+ grub_script.tab.h: script/parser.y
+       $(YACC) -d -p grub_script_yy -b grub_script $<
+ grub_script.tab.c: grub_script.tab.h
+ CLEANFILES += grub_script.tab.c grub_script.tab.h
+ # For the lexer.
+ grub_script.yy.h: script/yylex.l
+       $(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
+ grub_script.yy.c: grub_script.yy.h
+ CLEANFILES += grub_script.yy.c grub_script.yy.h
+ include $(srcdir)/Makefile.core.am
+ include $(srcdir)/Makefile.gcry.am
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elf.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elfload.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/reader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/symbol.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/types.h
+ if COND_i386_pc
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vga.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vbe.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
++KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_efi
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_i386_coreboot
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ endif
+ if COND_i386_multiboot
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
 -KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ endif
+ if COND_i386_qemu
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
+ endif
+ if COND_i386_ieee1275
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
+ endif
+ if COND_x86_64_efi
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
+ endif
+ if COND_mips_yeeloong
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap_scale.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/serial.h
+ endif
+ if COND_powerpc_ieee1275
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ endif
+ if COND_sparc64_ieee1275
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
+ endif
+ if COND_emu
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/time.h
+ KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/types.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gzio.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/menu.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
+ if COND_GRUB_EMU_SDL
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
+ endif
+ if COND_GRUB_EMU_USB
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libusb.h
+ endif
+ if COND_GRUB_EMU_PCI
+ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h
+ endif
+ endif
+ symlist.h: $(top_builddir)/config.h $(KERNEL_HEADER_FILES)
+       @list='$^'; \
+       for p in $$list; do \
+         echo "#include <$$p>" >> $@ || (rm -f $@; exit 1); \
+       done
+ CLEANFILES += symlist.h
+ BUILT_SOURCES += symlist.h
+ symlist.c: symlist.h gensymlist.sh
+       $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1)
+       cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1)
+       rm -f symlist.p
+ CLEANFILES += symlist.c
+ BUILT_SOURCES += symlist.c
+ noinst_DATA += kernel_syms.lst
+ kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
+       $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
+       if grep "^#define HAVE_ASM_USCORE" $(top_builddir)/config.h; then u="_"; else u=""; fi; \
+       cat kernel_syms.input | grep -v '^#' | sed -n \
+         -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
+         -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
+         | sort -u >$@
+       rm -f kernel_syms.input
+ CLEANFILES += kernel_syms.lst
+ if COND_emu
+ kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h
+ grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
+ kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
+ grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
+ grub_emu_init.h: genemuinitheader.sh $(MOD_FILES)
+       rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinitheader.sh $(NM) > $@
+ CLEANFILES += grub_emu_init.h
+ grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
+       rm -f $@; echo $(MOD_FILES) | sh $(srcdir)/genemuinit.sh $(NM) > $@
+ CLEANFILES += grub_emu_init.c
+ endif
+ # .lst files
+ platform_DATA += moddep.lst
+ platform_DATA += fs.lst
+ platform_DATA += command.lst
+ platform_DATA += partmap.lst
+ platform_DATA += handler.lst
+ platform_DATA += terminal.lst
+ platform_DATA += parttool.lst
+ platform_DATA += video.lst
+ platform_DATA += crypto.lst
+ CLEANFILES += moddep.lst
+ CLEANFILES += handler.lst
+ CLEANFILES += terminal.lst
+ CLEANFILES += parttool.lst
+ CLEANFILES += video.lst
+ CLEANFILES += crypto.lst
+ fs.lst: $(FS_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += fs.lst
+ command.lst: $(COMMAND_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += command.lst
+ partmap.lst: $(PARTMAP_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += partmap.lst
+ handler.lst: $(HANDLER_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += handler.lst
+ terminal.lst: $(TERMINAL_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += terminal.lst
+ parttool.lst: $(PARTTOOL_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += parttool.lst
+ video.lst: $(VIDEO_FILES)
+       cat $^ /dev/null | sort | uniq > $@
+ CLEANFILES += video.lst
+ # but, crypto.lst is simply copied
+ crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
+       cp $^ $@
+ CLEANFILES += crypto.lst
+ # generate global module dependencies list
+ moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES)
+       cat $(DEF_FILES) kernel_syms.lst /dev/null \
+         | $(AWK) -f $(srcdir)/genmoddep.awk $(UND_FILES) > $@ \
+         || (rm -f $@; exit 1)
+ if COND_i386_pc
+ if COND_ENABLE_EFIEMU
+ efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
+       -rm -f $@; \
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -DAPPLE_CC -m32 -Wall -Werror -nostdlib -O2 -c -o $@.bin $< || exit 1; \
+         $(OBJCONV) -felf32 -nu -nd $@.bin $@ || exit 1; \
+         rm -f $@.bin; \
+       else \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF32 -m32 -Wall -Werror -nostdlib -O2 -c -o $@ $< || exit 1; \
+         if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
+       fi
+ efiemu64_c.o: efiemu/runtime/efiemu.c
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -nostdlib -Wall -Werror -mno-red-zone -c -o $@ $< || exit 1; \
+       else \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -nostdlib -Wall -Werror -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
+       fi
+ efiemu64_s.o: efiemu/runtime/efiemu.S
+       -rm -f $@
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -DAPPLE_CC=1 -m64 -Wall -Werror -nostdlib -O2 -mno-red-zone -c -o $@ $< || exit 1; \
+       else \
+         $(TARGET_CC) $(DEFS) $(INCLUDES) $(CPPFLAGS_EFIEMU) $(CPPFLAGS_DEFAULT) -DELF64 -m64 -Wall -Werror -nostdlib -O2 -mcmodel=large -mno-red-zone -c -o $@ $< || exit 1; \
+       fi
+ efiemu64.o: efiemu64_c.o efiemu64_s.o $(TARGET_OBJ2ELEF)
+       -rm -f $@; \
+       if test "x$(TARGET_APPLE_CC)" = x1; then \
+         rm -f $@.bin; \
+         $(TARGET_CC) -m64 -Wl,-r -nostdlib -o $@.bin $^ || exit 1; \
+         $(OBJCONV) -felf64 -nu -nd $@.bin $@ || exit 1; \
+         rm -f $@.bin; \
+       else \
+         $(TARGET_CC) -m64 -nostdlib -Wl,-r -o $@ $^ || exit 1; \
+         if test ! -z "$(TARGET_OBJ2ELF)"; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
+       fi
+ platform_DATA += efiemu32.o efiemu64.o
+ CLEANFILES += efiemu32.o efiemu64.o efiemu64_c.o efiemu64_s.o
+ endif
+ endif
index 0000000,0257bba..982c590
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,1405 +1,1407 @@@
 -  i386_coreboot_multiboot_qemu = kern/i386/halt.c;
+ AutoGen definitions Makefile.tpl;
+ kernel = {
+   name = kernel;
+   nostrip = emu;
+   emu_ldflags              = '-Wl,-r,-d';
+   x86_efi_ldflags          = '-Wl,-r,-d';
+   x86_efi_stripflags       = '--strip-unneeded -K start -R .note -R .comment';
+   i386_pc_ldflags          = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags          = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   i386_qemu_ldflags        = '$(TARGET_IMG_LDFLAGS)';
+   i386_qemu_ldflags        = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   i386_coreboot_ldflags    = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   i386_multiboot_ldflags   = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   i386_ieee1275_ldflags    = '-Wl,-Ttext=$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   mips_yeeloong_ldflags    = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   powerpc_ieee1275_ldflags = '-Wl,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   mips_yeeloong_cppflags = '-DUSE_ASCII_FAILBACK';
+   i386_qemu_cppflags     = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
+   i386_qemu_ccasflags    = '-DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)';
+   emu_cflags = '$(CFLAGS_GNULIB)';
+   emu_cppflags = '$(CPPFLAGS_GNULIB)';
+   mips_ldadd = '-lgcc';
+   powerpc_ldadd = '-lgcc';
+   sparc64_ldadd = '-lgcc';
+   i386_pc_startup = kern/i386/pc/startup.S;
+   i386_efi_startup = kern/i386/efi/startup.S;
+   x86_64_efi_startup = kern/x86_64/efi/startup.S;
+   i386_qemu_startup = kern/i386/qemu/startup.S;
+   i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
+   i386_coreboot_multiboot_startup = kern/i386/coreboot/startup.S;
+   mips_yeeloong_startup = kern/mips/startup.S;
+   sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
+   powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
+   common = kern/command.c;
+   common = kern/corecmd.c;
+   common = kern/device.c;
+   common = kern/disk.c;
+   common = kern/dl.c;
+   common = kern/env.c;
+   common = kern/err.c;
+   common = kern/file.c;
+   common = kern/fs.c;
+   common = kern/list.c;
+   common = kern/main.c;
+   common = kern/misc.c;
+   common = kern/parser.c;
+   common = kern/partition.c;
+   common = kern/rescue_parser.c;
+   common = kern/rescue_reader.c;
+   common = kern/term.c;
+   noemu = kern/mm.c;
+   noemu = kern/time.c;
+   noemu = kern/generic/millisleep.c;
+   noemu_nodist = symlist.c;
+   noemu_noieee1275 = kern/generic/rtc_get_time_ms.c;
+   ieee1275 = disk/ieee1275/ofdisk.c;
+   ieee1275 = kern/ieee1275/cmain.c;
+   ieee1275 = kern/ieee1275/ieee1275.c;
+   ieee1275 = kern/ieee1275/mmap.c;
+   ieee1275 = kern/ieee1275/openfw.c;
+   ieee1275 = term/ieee1275/ofconsole.c;
+   ieee1275_mips = term/terminfo.c;
+   ieee1275_mips = term/tparm.c;
+   i386 = kern/i386/dl.c;
+   i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c;
 -  i386_noefi = kern/i386/misc.S;
 -
+   i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c;
+   i386_pc_coreboot_multiboot_qemu = term/i386/vga_common.c;
 -  i386_ieee1275 = kern/i386/ieee1275/init.c;
+   x86_noieee1275 = kern/i386/pit.c;
+   x86_efi = disk/efi/efidisk.c;
+   x86_efi = kern/efi/efi.c;
+   x86_efi = kern/efi/init.c;
+   x86_efi = kern/efi/mm.c;
+   x86_efi = kern/i386/efi/init.c;
+   x86_efi = term/efi/console.c;
+   i386_efi = kern/i386/tsc.c;
+   x86_64_efi = kern/i386/tsc.c;
+   x86_64_efi = kern/x86_64/dl.c;
+   x86_64_efi = kern/x86_64/efi/callwrap.S;
+   i386_pc = kern/i386/pc/init.c;
+   i386_pc = kern/i386/pc/mmap.c;
+   i386_pc = kern/i386/tsc.c;
+   i386_pc = term/i386/pc/console.c;
+   i386_qemu = bus/pci.c;
+   i386_qemu = kern/i386/qemu/init.c;
+   i386_qemu = kern/i386/qemu/mmap.c;
+   i386_qemu = kern/i386/tsc.c;
+   i386_coreboot = kern/i386/coreboot/mmap.c;
+   i386_coreboot = kern/i386/tsc.c;
+   i386_multiboot = kern/i386/multiboot_mmap.c;
+   i386_multiboot = kern/i386/tsc.c;
+   i386_ieee1275 = kern/ieee1275/init.c;
+   mips_yeeloong = term/ns8250.c;
+   mips_yeeloong = bus/bonito.c;
+   mips_yeeloong = bus/cs5536.c;
+   mips_yeeloong = bus/pci.c;
+   mips_yeeloong = commands/extcmd.c;
+   mips_yeeloong = font/font.c;
+   mips_yeeloong = font/font_cmd.c;
+   mips_yeeloong = io/bufio.c;
+   mips_yeeloong = kern/mips/cache.S;
+   mips_yeeloong = kern/mips/dl.c;
+   mips_yeeloong = kern/mips/init.c;
+   mips_yeeloong = kern/mips/yeeloong/init.c;
+   mips_yeeloong = lib/arg.c;
+   mips_yeeloong = term/at_keyboard.c;
+   mips_yeeloong = term/gfxterm.c;
+   mips_yeeloong = term/serial.c;
+   mips_yeeloong = video/bitmap.c;
+   mips_yeeloong = video/bitmap_scale.c;
+   mips_yeeloong = video/fb/fbblit.c;
+   mips_yeeloong = video/fb/fbfill.c;
+   mips_yeeloong = video/fb/fbutil.c;
+   mips_yeeloong = video/fb/video_fb.c;
+   mips_yeeloong = video/sm712.c;
+   mips_yeeloong = video/video.c;
+   powerpc_ieee1275 = kern/ieee1275/init.c;
+   powerpc_ieee1275 = kern/powerpc/cache.S;
+   powerpc_ieee1275 = kern/powerpc/dl.c;
+   sparc64_ieee1275 = kern/sparc64/cache.S;
+   sparc64_ieee1275 = kern/sparc64/dl.c;
+   sparc64_ieee1275 = kern/sparc64/ieee1275/ieee1275.c;
+   sparc64_ieee1275 = kern/sparc64/ieee1275/init.c;
+   emu = disk/host.c;
+   emu = gnulib/progname.c;
+   emu = kern/emu/console.c;
+   emu = kern/emu/getroot.c;
+   emu = kern/emu/hostdisk.c;
+   emu = kern/emu/hostfs.c;
+   emu = kern/emu/main.c;
+   emu = kern/emu/misc.c;
+   emu = kern/emu/mm.c;
+   emu = kern/emu/time.c;
+   extra_dist = kern/i386/loader.S;
+   extra_dist = kern/i386/realmode.S;
+   extra_dist = kern/i386/pc/lzma_decode.S;
+ };
+ program = {
+   name = grub-emu;
+   mansection = 1;
+   emu = kern/emu/full.c;
+   emu_nodist = grub_emu_init.c;
+   ldadd = 'kernel.img$(EXEEXT)';
+   ldadd = '$(MODULE_FILES)';
+   ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)';
+   enable = emu;
+ };
+ program = {
+   name = grub-emu-lite;
+   emu = kern/emu/lite.c;
+   emu = kern/emu/cache.S;
+   emu_nodist = symlist.c;
+   ldadd = 'kernel.img$(EXEEXT)';
+   ldadd = '$(LIBUTIL) $(LIBCURSES) $(LIBSDL) $(LIBUSB) $(LIBPCIACCESS) $(LIBDEVMAPPER)';
+   enable = emu;
+ };
+ image = {
+   name = boot;
+   i386_pc = boot/i386/pc/boot.S;
+   i386_qemu = boot/i386/qemu/boot.S;
+   sparc64_ieee1275 = boot/sparc64/ieee1275/boot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
+   i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)';
+   i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
+   sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
+   sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+   enable = i386_qemu;
+   enable = sparc64_ieee1275;
+ };
+ image = {
+   name = cdboot;
+   i386_pc = boot/i386/pc/cdboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+ };
+ image = {
+   name = pxeboot;
+   i386_pc = boot/i386/pc/pxeboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+ };
+ image = {
+   name = diskboot;
+   i386_pc = boot/i386/pc/diskboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8000';
+   sparc64_ieee1275 = boot/sparc64/ieee1275/diskboot.S;
+   sparc64_ieee1275_ldflags = '-Wl,-Ttext=0x4200';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+   enable = sparc64_ieee1275;
+ };
+ image = {
+   name = lnxboot;
+   i386_pc = boot/i386/pc/lnxboot.S;
+   i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
+   i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x6000';
+   objcopyflags = '-O binary';
+   enable = i386_pc;
+ };
+ image = {
+   name = fwstart;
+   mips_yeeloong = boot/mips/yeeloong/fwstart.S;
+   objcopyflags = '-O binary';
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = trig;
+   common_nodist = trigtables.c;
+   extra_dist = gentrigtables.c;
+ };
+ module = {
+   name = cs5536;
+   x86 = bus/cs5536.c;
+   enable = x86;
+ };
+ module = {
+   name = libusb;
+   emu = bus/usb/emu/usb.c;
+   enable = emu;
+   condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = lsspd;
+   mips_yeeloong = commands/mips/yeeloong/lsspd.c;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = usb;
+   common = bus/usb/usb.c;
+   noemu = bus/usb/usbtrans.c;
+   noemu = bus/usb/usbhub.c;
+   enable = emu;
+   enable = i386;
+   enable = mips_yeeloong;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = usbserial_common;
+   common = bus/usb/serial/common.c;
+   enable = emu;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = usbserial_pl2303;
+   common = bus/usb/serial/pl2303.c;
+   enable = emu;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = usbserial_ftdi;
+   common = bus/usb/serial/ftdi.c;
+   enable = emu;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = uhci;
+   common = bus/usb/uhci.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = ohci;
+   common = bus/usb/ohci.c;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = pci;
+   noemu = bus/pci.c;
+   emu = bus/emu/pci.c;
+   emu = commands/lspci.c;
+   enable = emu;
+   enable = i386_pc;
+   enable = x86_efi;
+   enable = i386_ieee1275;
+   enable = i386_coreboot;
+   emu_condition = COND_GRUB_EMU_PCI;
+ };
+ library = {
+   name = libgnulib.a;
+   common = gnulib/regex.c;
+   extra_dist = gnulib/regcomp.c;
+   extra_dist = gnulib/regexec.c;
+   extra_dist = gnulib/fnmatch_loop.c;
+   extra_dist = gnulib/regex_internal.c;
+   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
+   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
+ };
+ module = {
+   name = cmostest;
+   i386 = commands/i386/cmostest.c;
+   enable = i386_pc;
+   enable = i386_coreboot;
+ };
+ module = {
+   name = iorw;
+   common = commands/iorw.c;
+   enable = x86;
+ };
+ module = {
+   name = regexp;
+   common = commands/regexp.c;
+   ldadd = libgnulib.a;
+   cflags = '$(CFLAGS_POSIX) $(CFLAGS_GNULIB)';
+   cppflags = '$(CPPFLAGS_POSIX) $(CPPFLAGS_GNULIB)';
+ };
+ module = {
+   name = acpi;
+   i386 = commands/acpi.c;
+   x86_efi = commands/efi/acpi.c;
+   i386_pc = commands/i386/pc/acpi.c;
+   enable = x86_efi;
+   enable = i386_pc;
+ };
+ module = {
+   name = blocklist;
+   common = commands/blocklist.c;
+ };
+ module = {
+   name = boot;
+   common = commands/boot.c;
+   i386_pc = lib/i386/pc/biosnum.c;
+ };
+ module = {
+   name = cat;
+   common = commands/cat.c;
+ };
+ module = {
+   name = cmp;
+   common = commands/cmp.c;
+ };
+ module = {
+   name = configfile;
+   common = commands/configfile.c;
+ };
+ module = {
+   name = cpuid;
+   x86 = commands/i386/cpuid.c;
+   enable = x86;
+ };
+ module = {
+   name = crc;
+   common = commands/crc.c;
+   common = lib/crc.c;
+ };
+ module = {
+   name = date;
+   common = commands/date.c;
+ };
+ module = {
+   name = drivemap;
+   i386_pc = commands/i386/pc/drivemap.c;
+   i386_pc = commands/i386/pc/drivemap_int13h.S;
+   enable = i386_pc;
+ };
+ module = {
+   name = echo;
+   common = commands/echo.c;
+ };
+ module = {
+   name = extcmd;
+   common = commands/extcmd.c;
+   common = lib/arg.c;
+ };
+ module = {
+   name = fixvideo;
+   x86_efi = commands/efi/fixvideo.c;
+   enable = x86_efi;
+ };
+ module = {
+   name = gptsync;
+   common = commands/gptsync.c;
+ };
+ module = {
+   name = halt;
+   nopc = commands/halt.c;
+   i386_pc = commands/i386/pc/halt.c;
++  i386_multiboot = lib/i386/halt.c;
++  i386_coreboot = lib/i386/halt.c;
++  i386_qemu = lib/i386/halt.c;
++  x86_efi = lib/efi/halt.c;
++  ieee1275 = lib/ieee1275/halt.c;
++  emu = lib/emu/halt.c;
+ };
+ module = {
+   name = hashsum;
+   common = commands/hashsum.c;
+ };
+ module = {
+   name = hdparm;
+   common = commands/hdparm.c;
+   common = lib/hexdump.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = help;
+   common = commands/help.c;
+ };
+ module = {
+   name = hexdump;
+   common = commands/hexdump.c;
+   common = lib/hexdump.c;
+ };
+ module = {
+   name = keystatus;
+   common = commands/keystatus.c;
+ };
+ module = {
+   name = loadbios;
+   x86_efi = commands/efi/loadbios.c;
+   enable = x86_efi;
+ };
+ module = {
+   name = loadenv;
+   common = commands/loadenv.c;
+   common = lib/envblk.c;
+ };
+ module = {
+   name = ls;
+   common = commands/ls.c;
+ };
+ module = {
+   name = lsmmap;
+   common = commands/lsmmap.c;
+ };
+ module = {
+   name = lspci;
+   common = commands/lspci.c;
+   enable = x86;
+   enable = mips;
+ };
+ module = {
+   name = memrw;
+   common = commands/memrw.c;
+ };
+ module = {
+   name = minicmd;
+   common = commands/minicmd.c;
+ };
+ module = {
+   name = parttool;
+   common = commands/parttool.c;
+ };
+ module = {
+   name = password;
+   common = commands/password.c;
+ };
+ module = {
+   name = password_pbkdf2;
+   common = commands/password_pbkdf2.c;
+ };
+ module = {
+   name = play;
+   x86 = commands/i386/pc/play.c;
+   enable = x86;
+ };
+ module = {
+   name = probe;
+   common = commands/probe.c;
+ };
+ module = {
+   name = pxecmd;
+   i386_pc = commands/i386/pc/pxecmd.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = read;
+   common = commands/read.c;
+ };
+ module = {
+   name = reboot;
+   common = commands/reboot.c;
+ };
+ module = {
+   name = search;
+   common = commands/search_wrap.c;
+   extra_dist = commands/search.c;
+ };
+ module = {
+   name = search_fs_file;
+   common = commands/search_file.c;
+ };
+ module = {
+   name = search_fs_uuid;
+   common = commands/search_uuid.c;
+ };
+ module = {
+   name = search_label;
+   common = commands/search_label.c;
+ };
+ module = {
+   name = setpci;
+   common = commands/setpci.c;
+   enable = x86;
+ };
+ module = {
+   name = sleep;
+   common = commands/sleep.c;
+ };
+ module = {
+   name = suspend;
+   ieee1275 = commands/ieee1275/suspend.c;
+   enable = i386_ieee1275;
+   enable = powerpc_ieee1275;
+ };
+ module = {
+   name = terminal;
+   common = commands/terminal.c;
+ };
+ module = {
+   name = test;
+   common = commands/test.c;
+ };
+ module = {
+   name = true;
+   common = commands/true.c;
+ };
+ module = {
+   name = usbtest;
+   common = commands/usbtest.c;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+   enable = emu;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = vbeinfo;
+   i386_pc = commands/i386/pc/vbeinfo.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = vbetest;
+   i386_pc = commands/i386/pc/vbetest.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = videotest;
+   common = commands/videotest.c;
+ };
+ module = {
+   name = xnu_uuid;
+   common = commands/xnu_uuid.c;
+ };
+ module = {
+   name = dm_nv;
+   common = disk/dmraid_nvidia.c;
+ };
+ module = {
+   name = loopback;
+   common = disk/loopback.c;
+ };
+ module = {
+   name = lvm;
+   common = disk/lvm.c;
+ };
+ module = {
+   name = mdraid;
+   common = disk/mdraid_linux.c;
+ };
+ module = {
+   name = raid;
+   common = disk/raid.c;
+ };
+ module = {
+   name = raid5rec;
+   common = disk/raid5_recover.c;
+ };
+ module = {
+   name = raid6rec;
+   common = disk/raid6_recover.c;
+ };
+ module = {
+   name = scsi;
+   common = disk/scsi.c;
+ };
+ module = {
+   name = memdisk;
+   common = disk/memdisk.c;
+ };
+ module = {
+   name = ata;
+   common = disk/ata.c;
+   enable = x86;
+   enable = mips;
+ };
+ module = {
+   name = ata_pthru;
+   common = disk/ata_pthru.c;
+   enable = x86;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = biosdisk;
+   i386_pc = disk/i386/pc/biosdisk.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = usbms;
+   common = disk/usbms.c;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+   enable = emu;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = nand;
+   ieee1275 = disk/ieee1275/nand.c;
+   enable = i386_ieee1275;
+ };
+ module = {
+   name = efiemu;
+   i386_pc = efiemu/main.c;
+   i386_pc = efiemu/i386/loadcore32.c;
+   i386_pc = efiemu/i386/loadcore64.c;
+   i386_pc = efiemu/i386/pc/cfgtables.c;
+   i386_pc = efiemu/mm.c;
+   i386_pc = efiemu/loadcore_common.c;
+   i386_pc = efiemu/symbols.c;
+   i386_pc = efiemu/loadcore32.c;
+   i386_pc = efiemu/loadcore64.c;
+   i386_pc = efiemu/prepare32.c;
+   i386_pc = efiemu/prepare64.c;
+   i386_pc = efiemu/pnvram.c;
+   i386_pc = efiemu/i386/coredetect.c;
+   extra_dist = efiemu/prepare.c;
+   extra_dist = efiemu/loadcore.c;
+   extra_dist = efiemu/runtime/efiemu.S;
+   extra_dist = efiemu/runtime/efiemu.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = font;
+   common = font/font.c;
+   common = font/font_cmd.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = affs;
+   common = fs/affs.c;
+ };
+ module = {
+   name = afs;
+   common = fs/afs.c;
+ };
+ module = {
+   name = afs_be;
+   common = fs/afs_be.c;
+ };
+ module = {
+   name = befs;
+   common = fs/befs.c;
+ };
+ module = {
+   name = befs_be;
+   common = fs/befs_be.c;
+ };
+ module = {
+   name = cpio;
+   common = fs/cpio.c;
+ };
+ module = {
+   name = ext2;
+   common = fs/ext2.c;
+ };
+ module = {
+   name = fat;
+   common = fs/fat.c;
+ };
+ module = {
+   name = fshelp;
+   common = fs/fshelp.c;
+ };
+ module = {
+   name = hfs;
+   common = fs/hfs.c;
+ };
+ module = {
+   name = hfsplus;
+   common = fs/hfsplus.c;
+ };
+ module = {
+   name = iso9660;
+   common = fs/iso9660.c;
+ };
+ module = {
+   name = jfs;
+   common = fs/jfs.c;
+ };
+ module = {
+   name = minix;
+   common = fs/minix.c;
+ };
+ module = {
+   name = nilfs2;
+   common = fs/nilfs2.c;
+ };
+ module = {
+   name = ntfs;
+   common = fs/ntfs.c;
+ };
+ module = {
+   name = ntfscomp;
+   common = fs/ntfscomp.c;
+ };
+ module = {
+   name = reiserfs;
+   common = fs/reiserfs.c;
+ };
+ module = {
+   name = sfs;
+   common = fs/sfs.c;
+ };
+ module = {
+   name = tar;
+   common = fs/tar.c;
+ };
+ module = {
+   name = udf;
+   common = fs/udf.c;
+ };
+ module = {
+   name = ufs1;
+   common = fs/ufs.c;
+ };
+ module = {
+   name = ufs2;
+   common = fs/ufs2.c;
+ };
+ module = {
+   name = xfs;
+   common = fs/xfs.c;
+ };
+ module = {
+   name = pxe;
+   i386_pc = fs/i386/pc/pxe.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = gettext;
+   common = gettext/gettext.c;
+ };
+ module = {
+   name = gfxmenu;
+   common = gfxmenu/gfxmenu.c;
+   common = gfxmenu/model.c;
+   common = gfxmenu/view.c;
+   common = gfxmenu/font.c;
+   common = gfxmenu/icon_manager.c;
+   common = gfxmenu/theme_loader.c;
+   common = gfxmenu/widget-box.c;
+   common = gfxmenu/gui_canvas.c;
+   common = gfxmenu/gui_circular_progress.c;
+   common = gfxmenu/gui_box.c;
+   common = gfxmenu/gui_label.c;
+   common = gfxmenu/gui_list.c;
+   common = gfxmenu/gui_image.c;
+   common = gfxmenu/gui_progress_bar.c;
+   common = gfxmenu/gui_util.c;
+   common = gfxmenu/gui_string_util.c;
+   common = gfxmenu/named_colors.c;
+ };
+ module = {
+   name = hello;
+   common = hello/hello.c;
+ };
+ module = {
+   name = gzio;
+   common = io/gzio.c;
+ };
+ module = {
+   name = bufio;
+   common = io/bufio.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = elf;
+   common = kern/elf.c;
+ };
+ module = {
+   name = crypto;
+   common = lib/crypto.c;
+   extra_dist = lib/libgcrypt-grub/cipher/crypto.lst;
+ };
+ module = {
+   name = pbkdf2;
+   common = lib/pbkdf2.c;
+ };
+ module = {
+   name = relocator;
+   mips = lib/mips/relocator.c;
+   mips = lib/mips/relocator_asm.S;
+   x86 = lib/i386/relocator.c;
+   x86 = lib/i386/relocator_asm.S;
+   x86 = lib/i386/relocator_backward.S;
+   extra_dist = lib/relocator.c;
+   enable = mips;
+   enable = x86;
+ };
+ module = {
+   name = datetime;
+   x86_noefi_mips = lib/cmos_datetime.c;
+   x86_efi = lib/efi/datetime.c;
+   sparc64_ieee1275 = lib/ieee1275/datetime.c;
+   powerpc_ieee1275 = lib/ieee1275/datetime.c;
+   enable = x86;
+   enable = mips;
+   enable = sparc64_ieee1275;
+   enable = powerpc_ieee1275;
+ };
+ module = {
+   name = setjmp;
+   common = lib/setjmp.S;
+   extra_dist = lib/i386/setjmp.S;
+   extra_dist = lib/mips/setjmp.S;
+   extra_dist = lib/x86_64/setjmp.S;
+   extra_dist = lib/sparc64/setjmp.S;
+   extra_dist = lib/powerpc/setjmp.S;
+ };
+ module = {
+   name = aout;
+   common = loader/aout.c;
+   enable = i386_pc;
+   enable = i386_qemu;
+   enable = i386_coreboot;
+   enable = i386_multiboot;
+   enable = i386_ieee1275;
+ };
+ module = {
+   name = bsd;
+   i386 = loader/i386/bsd.c;
+   i386 = loader/i386/bsd32.c;
+   i386 = loader/i386/bsd64.c;
+   i386 = loader/i386/bsd_helper.S;
+   i386 = loader/i386/bsd_trampoline.S;
+   extra_dist = loader/i386/bsdXX.c;
+   extra_dist = loader/i386/bsd_pagetable.c;
+   enable = i386_pc;
+   enable = i386_qemu;
+   enable = i386_coreboot;
+   enable = i386_multiboot;
+ };
+ module = {
+   name = linux16;
+   i386_pc = loader/i386/pc/linux.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = multiboot2;
+   cppflags = "-DGRUB_USE_MULTIBOOT2";
+   common = loader/multiboot.c;
+   common = loader/multiboot_mbi2.c;
+   enable = x86;
+   enable = mips;
+ };
+ module = {
+   name = multiboot;
+   common = loader/multiboot.c;
+   x86 = loader/i386/multiboot_mbi.c;
+   extra_dist = loader/multiboot_elfxx.c;
+   enable = x86;
+ };
+ module = {
+   name = linux;
+   i386_noefi_noieee1275 = loader/i386/linux.c;
+   x86_efi = loader/i386/efi/linux.c;
+   x86_64_efi = loader/i386/linux_trampoline.S;
+   i386_ieee1275 = loader/i386/ieee1275/linux.c;
+   mips = loader/mips/linux.c;
+   powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
+   sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
+   enable = noemu;
+ };
+ module = {
+   name = xnu;
+   x86_efi_pc = loader/xnu_resume.c;
+   x86_efi_pc = loader/i386/xnu.c;
+   x86_efi_pc = loader/macho32.c;
+   x86_efi_pc = loader/macho64.c;
+   x86_efi_pc = loader/macho.c;
+   x86_efi_pc = loader/xnu.c;
+   extra_dist = loader/machoXX.c;
+   enable = i386_pc;
+   enable = x86_efi;
+ };
+ module = {
+   name = appleldr;
+   x86_efi = loader/efi/appleloader.c;
+   enable = x86_efi;
+ };
+ module = {
+   name = chain;
+   x86_efi = loader/efi/chainloader.c;
+   i386_pc = loader/i386/pc/chainloader.c;
+   enable = i386_pc;
+   enable = x86_efi;
+ };
+ module = {
+   name = mmap;
+   i386_pc = mmap/mmap.c;
+   i386_pc = mmap/i386/uppermem.c;
+   i386_pc = mmap/i386/mmap.c;
+   i386_pc = mmap/i386/pc/mmap.c;
+   i386_pc = mmap/i386/pc/mmap_helper.S;
+   x86_efi = mmap/mmap.c;
+   x86_efi = mmap/i386/uppermem.c;
+   x86_efi = mmap/i386/mmap.c;
+   x86_efi = mmap/efi/mmap.c;
+   i386_coreboot = mmap/mmap.c;
+   i386_coreboot = mmap/i386/uppermem.c;
+   i386_coreboot = mmap/i386/mmap.c;
+   i386_multiboot = mmap/mmap.c;
+   i386_multiboot = mmap/i386/uppermem.c;
+   i386_multiboot = mmap/i386/mmap.c;
+   i386_qemu = mmap/mmap.c;
+   i386_qemu = mmap/i386/uppermem.c;
+   i386_qemu = mmap/i386/mmap.c;
+   i386_ieee1275 = mmap/mmap.c;
+   i386_ieee1275 = mmap/i386/uppermem.c;
+   i386_ieee1275 = mmap/i386/mmap.c;
+   mips_yeeloong = mmap/mmap.c;
+   mips_yeeloong = mmap/mips/yeeloong/uppermem.c;
+   enable = x86;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = normal;
+   common = normal/main.c;
+   common = normal/cmdline.c;
+   common = normal/dyncmd.c;
+   common = normal/auth.c;
+   common = normal/autofs.c;
+   common = normal/color.c;
+   common = normal/completion.c;
+   common = normal/datetime.c;
+   common = normal/menu.c;
+   common = normal/menu_entry.c;
+   common = normal/menu_text.c;
+   common = normal/misc.c;
+   common = normal/crypto.c;
+   common = normal/term.c;
+   common = normal/context.c;
+   common = normal/charset.c;
+   common = script/main.c;
+   common = script/script.c;
+   common = script/execute.c;
+   common = script/function.c;
+   common = script/lexer.c;
+   common = script/argv.c;
+   common = unidata.c;
+   common_nodist = grub_script.tab.c;
+   common_nodist = grub_script.yy.c;
+   common_nodist = grub_script.tab.h;
+   common_nodist = grub_script.yy.h;
+   extra_dist = script/yylex.l;
+   extra_dist = script/parser.y;
+   cflags = '$(CFLAGS_POSIX) -Wno-error';
+   cppflags = '$(CPPFLAGS_POSIX)';
+ };
+ module = {
+   name = part_acorn;
+   common = partmap/acorn.c;
+ };
+ module = {
+   name = part_amiga;
+   common = partmap/amiga.c;
+ };
+ module = {
+   name = part_apple;
+   common = partmap/apple.c;
+ };
+ module = {
+   name = part_gpt;
+   common = partmap/gpt.c;
+ };
+ module = {
+   name = part_msdos;
+   common = partmap/msdos.c;
+ };
+ module = {
+   name = part_sun;
+   common = partmap/sun.c;
+ };
+ module = {
+   name = part_bsd;
+   common = partmap/bsdlabel.c;
+ };
+ module = {
+   name = part_sunpc;
+   common = partmap/sunpc.c;
+ };
+ module = {
+   name = msdospart;
+   common = parttool/msdospart.c;
+ };
+ module = {
+   name = at_keyboard;
+   common = term/at_keyboard.c;
+   enable = x86;
+ };
+ module = {
+   name = gfxterm;
+   common = term/gfxterm.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = serial;
+   common = term/serial.c;
+   x86 = term/ns8250.c;
+   enable = emu;
+   enable = i386;
+   enable = x86_64_efi;
+   emu_condition = COND_GRUB_EMU_USB;
+ };
+ module = {
+   name = sendkey;
+   i386_pc = commands/i386/pc/sendkey.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = terminfo;
+   common = term/terminfo.c;
+   common = term/tparm.c;
+ };
+ module = {
+   name = usb_keyboard;
+   common = term/usb_keyboard.c;
+   enable = i386_pc;
+   enable = mips_yeeloong;
+ };
+ module = {
+   name = vga;
+   i386_pc = video/i386/pc/vga.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = vga_text;
+   x86 = term/i386/pc/vga_text.c;
+   x86 = term/i386/vga_common.c;
+   enable = x86;
+ };
+ module = {
+   name = video_cirrus;
+   x86 = video/cirrus.c;
+   enable = x86;
+ };
+ module = {
+   name = video_bochs;
+   x86 = video/bochs.c;
+   enable = x86;
+ };
+ module = {
+   name = functional_test;
+   common = tests/lib/functional_test.c;
+   common = tests/lib/test.c;
+ };
+ module = {
+   name = example_functional_test;
+   common = tests/example_functional_test.c;
+   cflags = -Wno-format;
+ };
+ module = {
+   name = bitmap;
+   common = video/bitmap.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = bitmap_scale;
+   common = video/bitmap_scale.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = efi_gop;
+   x86_efi = video/efi_gop.c;
+   enable = x86_efi;
+ };
+ module = {
+   name = efi_uga;
+   x86_efi = video/efi_uga.c;
+   enable = x86_efi;
+ };
+ module = {
+   name = jpeg;
+   common = video/readers/jpeg.c;
+ };
+ module = {
+   name = png;
+   common = video/readers/png.c;
+ };
+ module = {
+   name = tga;
+   common = video/readers/tga.c;
+ };
+ module = {
+   name = vbe;
+   i386_pc = video/i386/pc/vbe.c;
+   enable = i386_pc;
+ };
+ module = {
+   name = video_fb;
+   common = video/fb/video_fb.c;
+   common = video/fb/fbblit.c;
+   common = video/fb/fbfill.c;
+   common = video/fb/fbutil.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = video;
+   common = video/video.c;
+   enable = emu;
+   enable = x86;
+   enable = sparc64;
+   enable = powerpc;
+ };
+ module = {
+   name = ieee1275_fb;
+   ieee1275 = video/ieee1275.c;
+   enable = powerpc;
+   enable = sparc64;
+ };
+ module = {
+   name = sdl;
+   emu = video/emu/sdl.c;
+   enable = emu;
+   condition = COND_GRUB_EMU_SDL;
+ };
+ module = {
+   name = datehook;
+   common = hook/datehook.c;
+ };
index f927097,0000000..f927097
mode 100644,000000..100644
--- /dev/null
Simple merge
Simple merge
Simple merge
Simple merge
@@@ -78,16 -66,16 +66,6 @@@ grub_reboot (void
    longjmp (main_env, 1);
  }
  
--void
--grub_halt (
--#ifdef GRUB_MACHINE_PCBIOS
--         int no_apm __attribute__ ((unused))
--#endif
--         )
--{
--  grub_reboot ();
--}
--
  void
  grub_machine_init (void)
  {
index 2bf8531,0000000..2bf8531
mode 100644,000000..100644
--- /dev/null
@@@ -19,9 -19,9 +19,8 @@@
  #include <grub/kernel.h>
  #include <grub/mm.h>
  #include <grub/machine/time.h>
 -#include <grub/machine/init.h>
  #include <grub/machine/memory.h>
  #include <grub/machine/console.h>
- #include <grub/machine/kernel.h>
  #include <grub/types.h>
  #include <grub/err.h>
  #include <grub/dl.h>
  #include <grub/time.h>
  #include <grub/symbol.h>
  #include <grub/cpu/io.h>
- #include <grub/cpu/kernel.h>
 +#include <grub/cpu/floppy.h>
  #include <grub/cpu/tsc.h>
+ #ifdef GRUB_MACHINE_QEMU
+ #include <grub/machine/kernel.h>
+ #endif
  
 -#define GRUB_FLOPPY_REG_DIGITAL_OUTPUT                0x3f2
 -
  extern char _start[];
  extern char _end[];
  
Simple merge
Simple merge
  #include <grub/machine/memory.h>
  #include <grub/err.h>
  #include <grub/types.h>
+ #include <grub/misc.h>
  
 +/*
 + * grub_get_ext_memsize() :  return the extended memory size in KB.
 + *    BIOS call "INT 15H, AH=88H" to get extended memory size
 + *    The return value in AX.
 + *
 + */
 +static inline grub_uint16_t
 +grub_get_ext_memsize (void)
 +{
 +  struct grub_bios_int_registers regs;
 +
 +  regs.eax = 0x8800;
 +  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
 +  grub_bios_interrupt (0x15, &regs);
 +  return regs.eax & 0xffff;
 +}
 +
 +/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
 +   in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. If error, return zero.
 +   BIOS call "INT 15H, AH=E801H" to get EISA memory map,
 +     AX = memory between 1M and 16M in 1K parts.
 +     BX = memory above 16M in 64K parts. 
 +*/
 + 
 +static inline grub_uint32_t
 +grub_get_eisa_mmap (void)
 +{
 +  struct grub_bios_int_registers regs;
 +
 +  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
 +  regs.eax = 0xe801;
 +  grub_bios_interrupt (0x15, &regs);
 +
 +  if ((regs.eax & 0xff00) == 0x8600)
 +    return 0;
 +
 +  return (regs.eax & 0xffff) | (regs.ebx << 16);
 +}
 +
 +/*
 + *
 + * grub_get_mmap_entry(addr, cont) : address and old continuation value (zero to
 + *            start), for the Query System Address Map BIOS call.
 + *
 + *  Sets the first 4-byte int value of "addr" to the size returned by
 + *  the call.  If the call fails, sets it to zero.
 + *
 + *    Returns:  new (non-zero) continuation value, 0 if done.
 + */
 +/* Get a memory map entry. Return next continuation value. Zero means
 +   the end.  */
 +static grub_uint32_t
 +grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
 +                   grub_uint32_t cont)
 +{
 +  struct grub_bios_int_registers regs;
 +
 +  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
 +
 +  /* place address (+4) in ES:DI */
 +  regs.es = ((grub_addr_t) &entry->addr) >> 4;
 +  regs.edi = ((grub_addr_t) &entry->addr) & 0xf;
 +      
 +  /* set continuation value */
 +  regs.ebx = cont;
 +
 +  /* set default maximum buffer size */
 +  regs.ecx = sizeof (*entry) - sizeof (entry->size);
 +
 +  /* set EDX to 'SMAP' */
 +  regs.edx = 0x534d4150;
 +
 +  regs.eax = 0xe820;
 +  grub_bios_interrupt (0x15, &regs);
 +
 +  /* write length of buffer (zero if error) into ADDR */      
 +  if ((regs.flags & GRUB_CPU_INT_FLAGS_CARRY) || regs.eax != 0x534d4150
 +      || regs.ecx < 0x14 || regs.ecx > 0x400)
 +    entry->size = 0;
 +  else
 +    entry->size = regs.ecx;
 +
 +  /* return the continuation value */
 +  return regs.ebx;
 +}
 +
  grub_err_t
  grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
  {
@@@ -494,86 -566,219 +494,87 @@@ FUNCTION(grub_chainloader_real_boot
  #include "../loader.S"
  
  /*
-  * void grub_console_real_putchar (int c)
 - *   int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)
++ * void grub_console_putchar (int c)
   *
 - *   Call IBM/MS INT13 Extensions (int 13 %ah=AH) for DRIVE. DAP
 - *   is passed for disk address packet. If an error occurs, return
 - *   non-zero, otherwise zero.
 - */
 -
 -FUNCTION(grub_biosdisk_rw_int13_extensions)
 -      pushl   %ebp
 -      pushl   %esi
 -
 -      /* compute the address of disk_address_packet */
 -      movw    %cx, %si
 -      xorw    %cx, %cx
 -      shrl    $4, %ecx        /* save the segment to cx */
 -
 -      /* ah */
 -      movb    %al, %dh
 -      /* enter real mode */
 -      call    prot_to_real
 -
 -      .code16
 -      movb    %dh, %ah
 -      movw    %cx, %ds
 -      int     $0x13           /* do the operation */
 -      movb    %ah, %dl        /* save return value */
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 -      .code32
 -
 -      movb    %dl, %al        /* return value in %eax */
 -
 -      popl    %esi
 -      popl    %ebp
 -
 -      ret
 -
 -/*
 - *   int grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
 - *                                  int soff, int nsec, int segment)
 + * Put the character C on the console. Because GRUB wants to write a
 + * character with an attribute, this implementation is a bit tricky.
 + * If C is a control character (CR, LF, BEL, BS), use INT 10, AH = 0Eh
 + * (TELETYPE OUTPUT). Otherwise, save the original position, put a space,
 + * save the current position, restore the original position, write the
 + * character and the attribute, and restore the current position.
   *
 - *   Call standard and old INT13 (int 13 %ah=AH) for DRIVE. Read/write
 - *   NSEC sectors from COFF/HOFF/SOFF into SEGMENT. If an error occurs,
 - *   return non-zero, otherwise zero.
 + * The reason why this is so complicated is that there is no easy way to
 + * get the height of the screen, and the TELETYPE OUTPUT BIOS call doesn't
 + * support setting a background attribute.
   */
- FUNCTION(grub_console_real_putchar)
-       movl    %eax, %edx
++FUNCTION(grub_console_putchar)
++      /* Retrieve the base character.  */
++      movl    0(%edx), %edx
 +      pusha
 +      movb    EXT_C(grub_console_cur_color), %bl
  
 -FUNCTION(grub_biosdisk_rw_standard)
 -      pushl   %ebp
 -      movl    %esp, %ebp
 -
 -      pushl   %ebx
 -      pushl   %edi
 -      pushl   %esi
 -
 -      /* set up CHS information */
 -
 -      /* set %ch to low eight bits of cylinder */
 -      xchgb   %cl, %ch
 -      /* set bits 6-7 of %cl to high two bits of cylinder */
 -      shlb    $6, %cl
 -      /* set bits 0-5 of %cl to sector */
 -      addb    0xc(%ebp), %cl
 -      /* set %dh to head */
 -      movb    0x8(%ebp), %dh
 -      /* set %ah to AH */
 -      movb    %al, %ah
 -      /* set %al to NSEC */
 -      movb    0x10(%ebp), %al
 -      /* save %ax in %di */
 -      movw    %ax, %di
 -      /* save SEGMENT in %bx */
 -      movw    0x14(%ebp), %bx
 -
 -      /* enter real mode */
        call    prot_to_real
 -
        .code16
 -      movw    %bx, %es
 -      xorw    %bx, %bx
 -      movw    $3, %si         /* attempt at least three times */
 -
 -1:
 -      movw    %di, %ax
 -      int     $0x13           /* do the operation */
 -      jnc     2f              /* check if successful */
 -
 -      movb    %ah, %bl        /* save return value */
 -      /* if fail, reset the disk system */
 -      xorw    %ax, %ax
 -      int     $0x13
 -
 -      decw    %si
 -      cmpw    $0, %si
 -      je      2f
 -      xorb    %bl, %bl
 -      jmp     1b              /* retry */
 -2:
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 -      .code32
 -
 -      movb    %bl, %al        /* return value in %eax */
 -
 -      popl    %esi
 -      popl    %edi
 -      popl    %ebx
 -      popl    %ebp
 -
 -      ret     $(4 * 4)
 -
 -
 -/*
 - *   int grub_biosdisk_check_int13_extensions (int drive)
 - *
 - *   Check if LBA is supported for DRIVE. If it is supported, then return
 - *   the major version of extensions, otherwise zero.
 - */
 +      movb    %dl, %al
 +      xorb    %bh, %bh
  
 -FUNCTION(grub_biosdisk_check_int13_extensions)
 -      pushl   %ebp
 -      pushl   %ebx
 +      /* use teletype output if control character */
 +      cmpb    $0x7, %al
 +      je      1f
 +      cmpb    $0x8, %al
 +      je      1f
 +      cmpb    $0xa, %al
 +      je      1f
 +      cmpb    $0xd, %al
 +      je      1f
  
 -      /* drive */
 -      movb    %al, %dl
 -      /* enter real mode */
 -      call    prot_to_real
 +      /* save the character and the attribute on the stack */
 +      pushw   %ax
 +      pushw   %bx
  
 -      .code16
 -      movb    $0x41, %ah
 -      movw    $0x55aa, %bx
 -      int     $0x13           /* do the operation */
 +      /* get the current position */
 +      movb    $0x3, %ah
 +      int     $0x10
  
 -      /* check the result */
 -      jc      1f
 -      cmpw    $0xaa55, %bx
 -      jne     1f
 +      /* check the column with the width */
 +      cmpb    $79, %dl
 +      jl      2f
  
 -      movb    %ah, %bl        /* save the major version into %bl */
 +      /* print CR and LF, if next write will exceed the width */
 +      movw    $0x0e0d, %ax
 +      int     $0x10
 +      movb    $0x0a, %al
 +      int     $0x10
  
 -      /* check if AH=0x42 is supported */
 -      andw    $1, %cx
 -      jnz     2f
 +      /* get the current position */
 +      movb    $0x3, %ah
 +      int     $0x10
  
 -1:
 -      xorb    %bl, %bl
  2:
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 -      .code32
 -
 -      movb    %bl, %al        /* return value in %eax */
 -
 -      popl    %ebx
 -      popl    %ebp
 -
 -      ret
 -
 -
 -/*
 - *   int grub_biosdisk_get_cdinfo_int13_extensions (int drive, void *cdrp)
 - *
 - *   Return the cdrom information of DRIVE in CDRP. If an error occurs,
 - *   then return non-zero, otherwise zero.
 - */
 +      /* restore the character and the attribute */
 +      popw    %bx
 +      popw    %ax
  
 -FUNCTION(grub_biosdisk_get_cdinfo_int13_extensions)
 -      movw    $0x4B01, %cx
 -      jmp     1f
 +      /* write the character with the attribute */
 +      movb    $0x9, %ah
 +      movw    $1, %cx
 +      int     $0x10
  
 -/*
 - *   int grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp)
 - *
 - *   Return the geometry of DRIVE in a drive parameters, DRP. If an error
 - *   occurs, then return non-zero, otherwise zero.
 - */
 +      /* move the cursor forward */
 +      incb    %dl
 +      movb    $0x2, %ah
 +      int     $0x10
  
 -FUNCTION(grub_biosdisk_get_diskinfo_int13_extensions)
 -      movb    $0x48, %ch
 -1:
 -      pushl   %ebp
 -      pushl   %ebx
 -      pushl   %esi
 +      jmp     3f
  
 -      /* compute the address of drive parameters */
 -      movw    %dx, %si
 -      andl    $0xf, %esi
 -      shrl    $4, %edx
 -      movw    %dx, %bx        /* save the segment into %bx */
 -      /* drive */
 -      movb    %al, %dl
 -      /* enter real mode */
 -      call    prot_to_real
 +1:    movw    $1, %bx
 +      movb    $0xe, %ah
 +      int     $0x10
  
 -      .code16
 -      movw    %cx, %ax
 -      movw    %bx, %ds
 -      int     $0x13           /* do the operation */
 -      jc      noclean
 -      /* Clean return value if carry isn't set to workaround
 -      some buggy BIOSes.  */
 -      xor     %ax, %ax
 -noclean:
 -      movb    %ah, %bl        /* save return value in %bl */
 -      /* back to protected mode */
 -      DATA32  call    real_to_prot
 +3:    DATA32  call    real_to_prot
        .code32
  
 -      movb    %bl, %al        /* return value in %eax */
 -
 -      popl    %esi
 -      popl    %ebx
 -      popl    %ebp
 -
 +      popa
        ret
  
  
@@@ -744,52 -1814,55 +745,52 @@@ FUNCTION(grub_console_getxy
        popl    %ebp
        ret
  
 +
  /*
 - * grub_vbe_status_t grub_vbe_bios_get_scanline_length (grub_uint32_t *length)
 - *
 - * Register allocations for parameters:
 - * %eax               *length
 + * void grub_console_gotoxy(grub_uint8_t x, grub_uint8_t y)
 + * BIOS call "INT 10H Function 02h" to set cursor position
 + *    Call with       %ah = 0x02
 + *                    %bh = page
 + *                      %dh = row (0 is top)
 + *                      %dl = column (0 is left)
   */
 -FUNCTION(grub_vbe_bios_get_scanline_length)
 -      pushl   %ebp
 -      pushl   %ebx
 -      pushl   %edi
 -      pushl   %edx            /* Push *length to stack.  */
  
 -      call    prot_to_real
 -      .code16
  
 -      movw    $0x4f06, %ax
 -      movw    $0x0001, %bx    /* BL = 1, Get Scan Line Length (in bytes).  */
 -      int     $0x10
 +FUNCTION(grub_console_gotoxy)
 +      pushl   %ebp
 +      pushl   %ebx                    /* save EBX */
  
-       movb    %dl, %dh        /* %dh = y */
-       movb    %al, %dl        /* %dl = x */
 -      movw    %ax, %dx        /* real_to_prot destroys %eax.  */
++      movb    %cl, %dh        /* %dh = y */
++      /* %dl = x */
  
 -      DATA32 call     real_to_prot
 -      .code32
 +      call    prot_to_real
 +      .code16
  
 -      popl    %edi            /* Pops *length from stack to %edi.  */
 -      andl    $0xFFFF, %ebx
 -      movl    %ebx, (%edi)    /* Return length to caller.  */
 +        xorb  %bh, %bh                /* set page to 0 */
 +      movb    $0x2, %ah
 +      int     $0x10                   /* set cursor position */
  
 -      movw    %dx, %ax
 -      andl    $0xFFFF, %eax   /* Return value in %eax.  */
 +      DATA32  call    real_to_prot
 +      .code32
  
 -      popl    %edi
 -      popl    %ebx
 -      popl    %ebp
 +      popl    %ebx
 +      popl    %ebp
        ret
  
 +
  /*
 - * grub_vbe_status_t grub_vbe_bios_set_display_start (grub_uint32_t x,
 - *                                                  grub_uint32_t y)
 - *
 - * Register allocations for parameters:
 - * %eax               x
 - * %edx               y
 + * void grub_console_cls (void)
 + * BIOS call "INT 10H Function 09h" to write character and attribute
 + *    Call with       %ah = 0x09
 + *                      %al = (character)
 + *                      %bh = (page number)
 + *                      %bl = (attribute)
 + *                      %cx = (number of times)
   */
 -FUNCTION(grub_vbe_bios_set_display_start)
 -      pushl   %ebp
 -      pushl   %ebx
  
 -      movl    %eax, %ecx      /* Store x in %ecx.  */
 +FUNCTION(grub_console_cls)
 +      pushl   %ebp
 +      pushl   %ebx                    /* save EBX */
  
        call    prot_to_real
        .code16
        popl    %ebp
        ret
  
 +
  /*
 - * grub_vbe_status_t grub_vbe_bios_get_display_start (grub_uint32_t *x,
 - *                                                  grub_uint32_t *y)
 - *
 - * Register allocations for parameters:
 - * %eax               *x
 - * %edx               *y
 + * void grub_console_setcursor (int on)
 + * BIOS call "INT 10H Function 01h" to set cursor type
 + *      Call with       %ah = 0x01
 + *                      %ch = cursor starting scanline
 + *                      %cl = cursor ending scanline
   */
 -FUNCTION(grub_vbe_bios_get_display_start)
 -      pushl   %ebp
 -      pushl   %ebx
 -      pushl   %edi
 -      pushl   %eax            /* Push *x to stack.  */
 -      pushl   %edx            /* Push *y to stack.  */
 -
 -      call    prot_to_real
 -      .code16
 -
 -      movw    $0x4f07, %ax
 -      movw    $0x0001, %bx    /* BL = 1, Get Display Start.  */
 -      int     $0x10
 -
 -      movw    %ax, %bx        /* real_to_prot destroys %eax.  */
 -
 -      DATA32 call     real_to_prot
 -      .code32
  
 -      popl    %edi            /* Pops *y from stack to %edi.  */
 -      andl    $0xFFFF, %edx
 -      movl    %edx, (%edi)    /* Return y-position to caller.  */
 -
 -      popl    %edi            /* Pops *x from stack to %edi.  */
 -      andl    $0xFFFF, %ecx
 -      movl    %ecx, (%edi)    /* Return x-position to caller.  */
 -
 -      movw    %bx, %ax
 -      andl    $0xFFFF, %eax   /* Return value in %eax.  */
 -
 -      popl    %edi
 -      popl    %ebx
 -      popl    %ebp
 -      ret
 +console_cursor_state:
 +      .byte   1
 +console_cursor_shape:
 +      .word   0
  
 -/*
 - * grub_vbe_status_t grub_vbe_bios_set_palette_data (grub_uint32_t color_count,
 - *                                                 grub_uint32_t start_index,
 - *                                                 struct grub_vbe_palette_data *palette_data)
 - *
 - * Register allocations for parameters:
 - * %eax               color_count
 - * %edx               start_index
 - * %ecx               *palette_data
 - */
 -FUNCTION(grub_vbe_bios_set_palette_data)
 +FUNCTION(grub_console_setcursor)
        pushl   %ebp
        pushl   %ebx
 -      pushl   %edi
  
 -      movl    %eax, %ebx      /* Store color_count in %ebx.  */
 +      /* push ON */
-       pushl   %eax
++      pushl   %edx
  
 -      movw    %cx, %di        /* Store *palette_data to %ecx:%di.  */
 -      xorw    %cx, %cx
 -      shrl    $4, %ecx
 +      /* check if the standard cursor shape has already been saved */
 +      movw    console_cursor_shape, %ax
 +      testw   %ax, %ax
 +      jne     1f
  
 -      call    prot_to_real
 +      call    prot_to_real
        .code16
  
 -      pushw   %es
 -
 -      movw    %cx, %es        /* *palette_data is now on %es:%di.  */
 -      movw    %bx, %cx        /* color_count is now on %cx.  */
 -
 -      movw    $0x4f09, %ax
 -      xorw    %bx, %bx        /* BL = 0, Set Palette Data.  */
 +      movb    $0x03, %ah
 +      xorb    %bh, %bh
        int     $0x10
  
 -      movw    %ax, %dx        /* real_to_prot destroys %eax.  */
 +      DATA32  call    real_to_prot
 +      .code32
 +
 +      movw    %cx, console_cursor_shape
 +1:
 +      /* set %cx to the designated cursor shape */
 +      movw    $0x2000, %cx
 +      popl    %eax
 +      testl   %eax, %eax
 +      jz      2f
 +      movw    console_cursor_shape, %cx
 +2:
 +      call    prot_to_real
 +      .code16
  
 -      popw    %es
 +      movb    $0x1, %ah
 +      int     $0x10
  
 -      DATA32 call     real_to_prot
 +      DATA32  call    real_to_prot
        .code32
  
 -      movw    %dx, %ax
 -      andl    $0xFFFF, %eax   /* Return value in %eax.  */
 -
 -      popl    %edi
        popl    %ebx
        popl    %ebp
        ret
Simple merge
Simple merge
@@@ -421,5 -420,17 +420,6 @@@ voi
  grub_reboot (void)
  {
    grub_ieee1275_interpret ("reset-all", 0);
+   for (;;) ;
  }
  #endif
 -
 -void
 -grub_halt (void)
 -{
 -  /* Not standardized.  We try three known commands.  */
 -
 -  grub_ieee1275_interpret ("shut-down", 0);
 -  grub_ieee1275_interpret ("power-off", 0);
 -  grub_ieee1275_interpret ("poweroff", 0);
 -  for (;;) ;
 -}
   *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
   */
  
 -#ifndef GRUB_INIT_I386_LINUXBIOS_HEADER
 -#define GRUB_INIT_I386_LINUXBIOS_HEADER               1
 +#include <grub/efi/api.h>
 +#include <grub/efi/efi.h>
 +#include <grub/misc.h>
 +#include <grub/mm.h>
 +#include <grub/kernel.h>
  
 -#include <grub/symbol.h>
 -#include <grub/i386/pc/memory.h>
 +void
 +grub_halt (void)
 +{
 +  grub_machine_fini ();
 +  efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
 +              GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
 -void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
 -void EXPORT_FUNC(grub_stop_floppy) (void);
 -
 -#endif
++  while (1);
 +}
Simple merge
   *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
   */
  
 -#include <grub/types.h>
 -#include <grub/cache.h>
 -
 -void grub_stop_floppy (void);
 +#include <grub/ieee1275/ieee1275.h>
 +#include <grub/misc.h>
  
  void
 -grub_stop_floppy (void)
 +grub_halt (void)
  {
 +  /* Not standardized.  We try three known commands.  */
 +
 +  grub_ieee1275_interpret ("shut-down", 0);
 +  grub_ieee1275_interpret ("power-off", 0);
 +  grub_ieee1275_interpret ("poweroff", 0);
++
++  while (1);
  }
Simple merge
index e80f7f3,0000000..e80f7f3
mode 100644,000000..100644
--- /dev/null
index 39a595d,0000000..39a595d
mode 100644,000000..100644
--- /dev/null
index 6866269,0000000..6866269
mode 100644,000000..100644
--- /dev/null
Simple merge
index 0000000,3fbb18b..41b8d3e
mode 000000,100644..100644
--- /dev/null
@@@ -1,0 -1,367 +1,387 @@@
+ /*
+  *  GRUB  --  GRand Unified Bootloader
+  *  Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010  Free Software Foundation, Inc.
+  *
+  *  GRUB is free software: you can redistribute it and/or modify
+  *  it under the terms of the GNU General Public License as published by
+  *  the Free Software Foundation, either version 3 of the License, or
+  *  (at your option) any later version.
+  *
+  *  GRUB is distributed in the hope that it will be useful,
+  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  *  GNU General Public License for more details.
+  *
+  *  You should have received a copy of the GNU General Public License
+  *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
+  */
+ #define grub_video_render_target grub_video_fbrender_target
+ #include <grub/machine/vga.h>
++#include <grub/machine/int.h>
+ #include <grub/machine/console.h>
+ #include <grub/cpu/io.h>
+ #include <grub/mm.h>
+ #include <grub/video.h>
+ #include <grub/video_fb.h>
+ #include <grub/types.h>
+ #include <grub/dl.h>
+ #include <grub/misc.h>
+ #include <grub/vga.h>
+ #define VGA_WIDTH     640
+ #define VGA_HEIGHT    350
+ #define VGA_MEM               ((grub_uint8_t *) GRUB_MEMORY_MACHINE_VGA_ADDR)
+ #define PAGE_OFFSET(x)        ((x) * (VGA_WIDTH * VGA_HEIGHT / 8))
+ static unsigned char text_mode;
+ static unsigned char saved_map_mask;
+ static struct
+ {
+   struct grub_video_mode_info mode_info;
+   struct grub_video_render_target *render_target;
+   grub_uint8_t *temporary_buffer;
+   int front_page;
+   int back_page;
+ } framebuffer;
++static unsigned char 
++grub_vga_set_mode (unsigned char mode)
++{
++  struct grub_bios_int_registers regs;
++  unsigned char ret;
++  /* get current mode */
++  regs.eax = 0x0f00;
++  regs.ebx = 0;
++  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
++  grub_bios_interrupt (0x10, &regs);
++
++  ret = regs.eax & 0xff;
++  regs.eax = mode;
++  regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
++  grub_bios_interrupt (0x10, &regs);
++
++  return ret;
++}
++
+ static inline void
+ wait_vretrace (void)
+ {
+   /* Wait until there is a vertical retrace.  */
+   while (! (grub_inb (GRUB_VGA_IO_INPUT_STATUS1_REGISTER)
+           & GRUB_VGA_IO_INPUT_STATUS1_VERTR_BIT));
+ }
+ /* Get Map Mask Register.  */
+ static unsigned char
+ get_map_mask (void)
+ {
+   return grub_vga_sr_read (GRUB_VGA_SR_MAP_MASK_REGISTER);
+ }
+ /* Set Map Mask Register.  */
+ static void
+ set_map_mask (unsigned char mask)
+ {
+   grub_vga_sr_write (mask, GRUB_VGA_SR_MAP_MASK_REGISTER);
+ }
+ #if 0
+ /* Set Read Map Register.  */
+ static void
+ set_read_map (unsigned char map)
+ {
+   grub_vga_gr_write (map, GRUB_VGA_GR_READ_MAP_REGISTER);
+ }
+ #endif
+ /* Set start address.  */
+ static void
+ set_start_address (unsigned int start)
+ {
+   grub_vga_cr_write (start & 0xFF, GRUB_VGA_CR_START_ADDR_LOW_REGISTER);
+   grub_vga_cr_write (start >> 8, GRUB_VGA_CR_START_ADDR_HIGH_REGISTER);
+ }
+ static int setup = 0;
+ static int is_target = 0;
+ static grub_err_t
+ grub_video_vga_init (void)
+ {
+   return GRUB_ERR_NONE;
+ }
+ static grub_err_t
+ grub_video_vga_setup (unsigned int width, unsigned int height,
+                       unsigned int mode_type, unsigned int mode_mask)
+ {
+   grub_err_t err;
+   if ((width && width != VGA_WIDTH) || (height && height != VGA_HEIGHT))
+     return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "no matching mode found");
+   framebuffer.temporary_buffer = grub_malloc (VGA_HEIGHT * VGA_WIDTH);
+   framebuffer.front_page = 0;
+   framebuffer.back_page = 0;
+   if (!framebuffer.temporary_buffer)
+     return grub_errno;
+   saved_map_mask = get_map_mask ();
+   text_mode = grub_vga_set_mode (0x10);
+   setup = 1;
+   set_map_mask (0x0f);
+   set_start_address (PAGE_OFFSET (framebuffer.front_page));
+   framebuffer.mode_info.width = VGA_WIDTH;
+   framebuffer.mode_info.height = VGA_HEIGHT;
+   framebuffer.mode_info.mode_type = GRUB_VIDEO_MODE_TYPE_INDEX_COLOR;
+   if (grub_video_check_mode_flag (mode_type, mode_mask,
+                                 GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED, 1))
+     {
+       framebuffer.back_page = 1;
+       framebuffer.mode_info.mode_type |= GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED;
+     }
+   framebuffer.mode_info.bpp = 8;
+   framebuffer.mode_info.bytes_per_pixel = 1;
+   framebuffer.mode_info.pitch = VGA_WIDTH;
+   framebuffer.mode_info.number_of_colors = 16;
+   framebuffer.mode_info.red_mask_size = 0;
+   framebuffer.mode_info.red_field_pos = 0;
+   framebuffer.mode_info.green_mask_size = 0;
+   framebuffer.mode_info.green_field_pos = 0;
+   framebuffer.mode_info.blue_mask_size = 0;
+   framebuffer.mode_info.blue_field_pos = 0;
+   framebuffer.mode_info.reserved_mask_size = 0;
+   framebuffer.mode_info.reserved_field_pos = 0;
+   framebuffer.mode_info.blit_format
+     = grub_video_get_blit_format (&framebuffer.mode_info);
+   err = grub_video_fb_create_render_target_from_pointer (&framebuffer.render_target,
+                                                        &framebuffer.mode_info,
+                                                        framebuffer.temporary_buffer);
+   if (err)
+     {
+       grub_dprintf ("video", "Couldn't create FB target\n");
+       return err;
+     }
+   is_target = 1;
+   err = grub_video_fb_set_active_render_target (framebuffer.render_target);
+  
+   if (err)
+     return err;
+  
+   err = grub_video_fb_set_palette (0, GRUB_VIDEO_FBSTD_NUMCOLORS,
+                                  grub_video_fbstd_colors);
+   return GRUB_ERR_NONE;
+ }
+ static grub_err_t
+ grub_video_vga_fini (void)
+ {
+   if (setup)
+     {
+       set_map_mask (saved_map_mask);
+       grub_vga_set_mode (text_mode);
+     }
+   setup = 0;
+   grub_free (framebuffer.temporary_buffer);
+   framebuffer.temporary_buffer = 0;
+   return GRUB_ERR_NONE;
+ }
+ static inline void
+ update_target (void)
+ {
+   int plane;
+   if (!is_target)
+     return;
+   for (plane = 0x01; plane <= 0x08; plane <<= 1)
+     {
+       grub_uint8_t *ptr;
+       volatile grub_uint8_t *ptr2;
+       unsigned cbyte = 0;
+       int shift = 7;
+       set_map_mask (plane);
+       for (ptr = framebuffer.temporary_buffer,
+            ptr2 = VGA_MEM + PAGE_OFFSET (framebuffer.back_page);
+          ptr < framebuffer.temporary_buffer + VGA_WIDTH * VGA_HEIGHT; ptr++)
+       {
+         cbyte |= (!!(plane & *ptr)) << shift;
+         shift--;
+         if (shift == -1)
+           {
+             *ptr2++ = cbyte;
+             shift = 7;
+             cbyte = 0;
+           }
+       }
+     }
+ }
+ static grub_err_t
+ grub_video_vga_blit_bitmap (struct grub_video_bitmap *bitmap,
+                           enum grub_video_blit_operators oper, int x, int y,
+                           int offset_x, int offset_y,
+                           unsigned int width, unsigned int height)
+ {
+   grub_err_t ret;
+   ret = grub_video_fb_blit_bitmap (bitmap, oper, x, y, offset_x, offset_y,
+                                  width, height);
+   update_target ();
+   return ret;
+ }
+ static grub_err_t
+ grub_video_vga_blit_render_target (struct grub_video_fbrender_target *source,
+                                    enum grub_video_blit_operators oper,
+                                    int x, int y, int offset_x, int offset_y,
+                                    unsigned int width, unsigned int height)
+ {
+   grub_err_t ret;
+   ret = grub_video_fb_blit_render_target (source, oper, x, y,
+                                         offset_x, offset_y, width, height);
+   update_target ();
+   return ret;
+ }
+ static grub_err_t
+ grub_video_vga_set_active_render_target (struct grub_video_render_target *target)
+ {
+   if (target == GRUB_VIDEO_RENDER_TARGET_DISPLAY)
+     {
+       is_target = 1;
+       target = framebuffer.render_target;
+     }
+   else
+     is_target = 0;
+   return grub_video_fb_set_active_render_target (target);
+ }
+ static grub_err_t
+ grub_video_vga_get_active_render_target (struct grub_video_render_target **target)
+ {
+   grub_err_t err;
+   err = grub_video_fb_get_active_render_target (target);
+   if (err)
+     return err;
+   if (*target == framebuffer.render_target)
+     *target = GRUB_VIDEO_RENDER_TARGET_DISPLAY;
+   return GRUB_ERR_NONE;
+ }
+ static grub_err_t
+ grub_video_vga_swap_buffers (void)
+ {
+   if (!(framebuffer.mode_info.mode_type & GRUB_VIDEO_MODE_TYPE_DOUBLE_BUFFERED))
+     return GRUB_ERR_NONE;
+   /* Activate the other page.  */
+   framebuffer.front_page = !framebuffer.front_page;
+   framebuffer.back_page = !framebuffer.back_page;
+   wait_vretrace ();
+   set_start_address (PAGE_OFFSET (framebuffer.front_page));
+   return GRUB_ERR_NONE;
+ }
+ static grub_err_t
+ grub_video_vga_set_palette (unsigned int start __attribute__ ((unused)),
+                           unsigned int count __attribute__ ((unused)),
+                             struct grub_video_palette_data *palette_data __attribute__ ((unused)))
+ {
+   return grub_error (GRUB_ERR_IO, "can't change palette");
+ }
+ static grub_err_t
+ grub_video_vga_get_info_and_fini (struct grub_video_mode_info *mode_info,
+                                 void **framebuf)
+ {
+   set_map_mask (0xf);
+   grub_memcpy (mode_info, &(framebuffer.mode_info), sizeof (*mode_info));
+   mode_info->bpp = 1;
+   mode_info->bytes_per_pixel = 0;
+   mode_info->pitch = VGA_WIDTH / 8;
+   mode_info->number_of_colors = 1;
+   mode_info->bg_red = 0;
+   mode_info->bg_green = 0;
+   mode_info->bg_blue = 0;
+   mode_info->bg_alpha = 255;
+   mode_info->fg_red = 255;
+   mode_info->fg_green = 255;
+   mode_info->fg_blue = 255;
+   mode_info->fg_alpha = 255;
+   *framebuf = VGA_MEM + PAGE_OFFSET (framebuffer.front_page);
+   grub_video_fb_fini ();
+   grub_free (framebuffer.temporary_buffer);
+   framebuffer.temporary_buffer = 0;
+   setup = 0;
+   return GRUB_ERR_NONE;
+ }
+ static struct grub_video_adapter grub_video_vga_adapter =
+   {
+     .name = "VGA Video Driver",
+     .id = GRUB_VIDEO_DRIVER_VGA,
+     .prio = GRUB_VIDEO_ADAPTER_PRIO_FALLBACK,
+     .init = grub_video_vga_init,
+     .fini = grub_video_vga_fini,
+     .setup = grub_video_vga_setup,
+     .get_info = grub_video_fb_get_info,
+     .get_info_and_fini = grub_video_vga_get_info_and_fini,
+     .set_palette = grub_video_vga_set_palette,
+     .get_palette = grub_video_fb_get_palette,
+     .set_viewport = grub_video_fb_set_viewport,
+     .get_viewport = grub_video_fb_get_viewport,
+     .map_color = grub_video_fb_map_color,
+     .map_rgb = grub_video_fb_map_rgb,
+     .map_rgba = grub_video_fb_map_rgba,
+     .unmap_color = grub_video_fb_unmap_color,
+     .fill_rect = grub_video_fb_fill_rect,
+     .blit_bitmap = grub_video_vga_blit_bitmap,
+     .blit_render_target = grub_video_vga_blit_render_target,
+     .scroll = grub_video_fb_scroll,
+     .swap_buffers = grub_video_vga_swap_buffers,
+     .create_render_target = grub_video_fb_create_render_target,
+     .delete_render_target = grub_video_fb_delete_render_target,
+     .set_active_render_target = grub_video_vga_set_active_render_target,
+     .get_active_render_target = grub_video_vga_get_active_render_target,
+     .next = 0
+   };
+ GRUB_MOD_INIT(vga)
+ {
+   grub_video_register (&grub_video_vga_adapter);
+ }
+ GRUB_MOD_FINI(vga)
+ {
+   grub_video_unregister (&grub_video_vga_adapter);
+ }
diff --cc include/grub/i386/multiboot/init.h
index fd935c3,fd935c3..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
--#include <grub/i386/coreboot/init.h>
diff --cc include/grub/i386/qemu/init.h
index fd935c3,fd935c3..0000000
deleted file mode 100644,100644
+++ /dev/null
@@@ -1,1 -1,1 +1,0 @@@
--#include <grub/i386/coreboot/init.h>
@@@ -23,9 -23,8 +23,8 @@@
  
  #ifndef ASM_FILE
  
--void EXPORT_FUNC (grub_reboot) (void);
--void EXPORT_FUNC (grub_halt) (void);
++void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
++void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
  
  #endif
  
@@@ -303,9 -319,16 +319,16 @@@ void EXPORT_FUNC (grub_reboot) (void) _
  #ifdef GRUB_MACHINE_PCBIOS
  /* Halt the system, using APM if possible. If NO_APM is true, don't
   * use APM even if it is available.  */
 -void EXPORT_FUNC (grub_halt) (int no_apm) __attribute__ ((noreturn));
 +void grub_halt (int no_apm);
  #else
 -void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
 +void grub_halt (void);
  #endif
  
+ #ifdef GRUB_MACHINE_EMU
+ /* Flag to control module autoloading in normal mode.  */
+ extern int EXPORT_VAR(grub_no_autoload);
+ #else
+ #define grub_no_autoload 0
+ #endif
  #endif /* ! GRUB_MISC_HEADER */