Add support for 32bit PCI BIOS entry.

Create a new code blob (code32seg) with support for 32bit functions
    that need to utilize explicit segment accesses.
This code blob uses global variables relative to %gs and with a
    dynamic code offset (determined by get_global_offset()).
Add BIOS32 structure and code.
Add code for 32bit PCI BIOS code.
diff --git a/Makefile b/Makefile
index 26c9461..b71d1a1 100644
--- a/Makefile
+++ b/Makefile
@@ -13,12 +13,13 @@
 # Source files
 SRCBOTH=misc.c pmm.c stacks.c output.c util.c block.c floppy.c ata.c mouse.c \
         kbd.c pci.c serial.c clock.c pic.c cdrom.c ps2port.c smp.c resume.c \
-        pnpbios.c pirtable.c vgahooks.c ramdisk.c \
+        pnpbios.c pirtable.c vgahooks.c ramdisk.c pcibios.c \
         usb.c usb-uhci.c usb-ohci.c usb-hid.c paravirt.c
-SRC16=$(SRCBOTH) system.c disk.c apm.c pcibios.c font.c
+SRC16=$(SRCBOTH) system.c disk.c apm.c font.c
 SRC32FLAT=$(SRCBOTH) post.c shadow.c memmap.c coreboot.c boot.c \
       acpi.c smm.c mptable.c smbios.c pciinit.c optionroms.c mtrr.c \
+SRC32SEG=util.c output.c pci.c pcibios.c
 cc-option = $(shell if test -z "`$(1) $(2) -S -o /dev/null -xc \
               /dev/null 2>&1`"; then echo "$(2)"; else echo "$(3)"; fi ;)
@@ -34,10 +35,12 @@
 COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector,)
 COMMONCFLAGS += $(call cc-option,$(CC),-fno-stack-protector-all,)
-              $(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
-              $(call cc-option,$(CC),-fno-tree-switch-conversion,) \
+            $(call cc-option,$(CC),-fno-jump-tables,-DMANUAL_NO_JUMP_TABLE) \
+            $(call cc-option,$(CC),-fno-tree-switch-conversion,)
               $(call cc-option,$(CC),--param large-stack-frame=4,)
@@ -112,36 +115,46 @@
 $(OUT)ccode.16.s: ; $(call whole-compile, $(CFLAGS16) -S, $(addprefix src/, $(SRC16)),$@)
-$(OUT)ccode32flat.o: ; $(call whole-compile, $(CFLAGS), $(addprefix src/, $(SRC32FLAT)),$@)
+$(OUT)code32seg.o: ; $(call whole-compile, $(CFLAGS32SEG), $(addprefix src/, $(SRC32SEG)),$@)
+$(OUT)ccode32flat.o: ; $(call whole-compile, $(CFLAGS32FLAT), $(addprefix src/, $(SRC32FLAT)),$@)
 $(OUT)code16.o: romlayout.S $(OUT)ccode.16.s $(OUT)asm-offsets.h
 	@echo "  Compiling (16bit) $@"
 	$(Q)$(CC) $(CFLAGS16INC) -c -D__ASSEMBLY__ $< -o $@
-$(OUT) $(OUT) $(OUT)code32flat.o: $(OUT)ccode32flat.o $(OUT)code16.o tools/
+$(OUT) $(OUT) $(OUT) $(OUT)code32flat.o: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)code16.o tools/
 	@echo "  Building ld scripts (version \"$(VERSION)\")"
 	$(Q)echo 'const char VERSION[] = "$(VERSION)";' > $(OUT)version.c
-	$(Q)$(CC) $(CFLAGS) -c $(OUT)version.c -o $(OUT)version.o
+	$(Q)$(CC) $(CFLAGS32FLAT) -c $(OUT)version.c -o $(OUT)version.o
 	$(Q)$(LD) -melf_i386 -r $(OUT)ccode32flat.o $(OUT)version.o -o $(OUT)code32flat.o
 	$(Q)$(OBJDUMP) -thr $(OUT)code32flat.o > $(OUT)code32flat.o.objdump
+	$(Q)$(OBJDUMP) -thr $(OUT)code32seg.o > $(OUT)code32seg.o.objdump
 	$(Q)$(OBJDUMP) -thr $(OUT)code16.o > $(OUT)code16.o.objdump
-	$(Q)./tools/ $(OUT)code16.o.objdump $(OUT)code32flat.o.objdump $(OUT) $(OUT)
+	$(Q)./tools/ $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT) $(OUT) $(OUT)
 $(OUT)rom16.o: $(OUT)code16.o $(OUT)rom32flat.o $(OUT)
 	@echo "  Linking (no relocs) $@"
 	$(Q)$(LD) -r -T $(OUT) $< -o $@
+$(OUT)rom32seg.o: $(OUT)code32seg.o $(OUT)
+	@echo "  Linking (no relocs) $@"
+	$(Q)$(LD) -r -T $(OUT) $< -o $@
 $(OUT)rom32flat.o: $(OUT)code32flat.o $(OUT)
 	@echo "  Linking (no relocs) $@"
 	$(Q)$(LD) -r -T $(OUT) $< -o $@
-$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32flat.o $(OUT) $(OUT)
+$(OUT)rom.o: $(OUT)rom16.o $(OUT)rom32seg.o $(OUT)rom32flat.o $(OUT)  $(OUT) $(OUT)
 	@echo "  Linking $@"
-	$(Q)$(LD) -T $(OUT) $(OUT)rom16.o -R $(OUT)rom32flat.o -o $(OUT)rom16.reloc.o
+	$(Q)$(LD) -T $(OUT) $(OUT)rom16.o -R $(OUT)rom32seg.o -R $(OUT)rom32flat.o -o $(OUT)rom16.reloc.o
 	$(Q)$(STRIP) $(OUT)rom16.reloc.o -o $(OUT)
 	$(Q)$(OBJCOPY) --adjust-vma 0xf0000 $(OUT)rom16.o $(OUT)rom16.moved.o
-	$(Q)$(LD) -T $(OUT) $(OUT) $(OUT)rom32flat.o -R $(OUT)rom16.moved.o -o $@
+	$(Q)$(LD) -T $(OUT) $(OUT)rom32seg.o -R $(OUT)rom16.o -R $(OUT)rom32flat.o -o $(OUT)rom32seg.reloc.o
+	$(Q)$(STRIP) $(OUT)rom32seg.reloc.o -o $(OUT)
+	$(Q)$(OBJCOPY) --adjust-vma 0xf0000 $(OUT)rom32seg.o $(OUT)rom32seg.moved.o
+	$(Q)$(LD) -T $(OUT) $(OUT) $(OUT) $(OUT)rom32flat.o -R $(OUT)rom16.moved.o -R $(OUT)rom32seg.moved.o -o $@
 $(OUT)bios.bin.elf $(OUT)bios.bin: $(OUT)rom.o tools/
 	@echo "  Prepping $@"