[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Merge



# HG changeset patch
# User Tim Deegan <Tim.Deegan@xxxxxxxxxxxxx>
# Node ID cd40792968cb8d7f561659d7427872c9518584ec
# Parent  2fd223c64fc6bba1d0ced8322ecb0aa7a927c0b8
# Parent  3127a43786d801dc27d7ff47e24268d1ed1da240
Merge
---
 linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c |    4 
 tools/firmware/hvmloader/acpi/acpi2_0.h              |   16 
 tools/firmware/hvmloader/acpi/dsdt.asl               |   25 
 tools/firmware/hvmloader/acpi/dsdt.c                 |  826 +++++++++---------
 tools/firmware/hvmloader/acpi/static_tables.c        |   33 
 tools/firmware/hvmloader/acpi_madt.c                 |   42 
 tools/firmware/hvmloader/acpi_utils.c                |   15 
 tools/firmware/hvmloader/config.h                    |    3 
 tools/firmware/hvmloader/hvmloader.c                 |  167 +++
 tools/firmware/hvmloader/mp_tables.c                 |    9 
 tools/firmware/hvmloader/pci_regs.h                  |  108 ++
 tools/firmware/hvmloader/smbios.c                    |  839 +++++++++----------
 tools/firmware/hvmloader/util.c                      |  580 ++++++++-----
 tools/firmware/hvmloader/util.h                      |   35 
 tools/firmware/rombios/rombios.c                     |   48 -
 tools/ioemu/target-i386-dm/piix_pci-dm.c             |  247 -----
 tools/ioemu/vl.c                                     |    3 
 xen/arch/x86/hvm/svm/svm.c                           |    4 
 xen/arch/x86/hvm/svm/vmcb.c                          |    1 
 xen/arch/x86/traps.c                                 |   24 
 xen/arch/x86/x86_emulate.c                           |  191 ++--
 21 files changed, 1748 insertions(+), 1472 deletions(-)

diff -r 2fd223c64fc6 -r cd40792968cb 
linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c
--- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Nov 23 
17:46:52 2006 +0000
+++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c      Thu Nov 23 
17:54:06 2006 +0000
@@ -138,10 +138,10 @@ static int blkfront_resume(struct xenbus
 
        DPRINTK("blkfront_resume: %s\n", dev->nodename);
 
-       blkif_free(info, 1);
+       blkif_free(info, info->connected == BLKIF_STATE_CONNECTED);
 
        err = talk_to_backend(dev, info);
-       if (!err)
+       if (info->connected == BLKIF_STATE_SUSPENDED && !err)
                blkif_recover(info);
 
        return err;
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/acpi/acpi2_0.h
--- a/tools/firmware/hvmloader/acpi/acpi2_0.h   Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/acpi/acpi2_0.h   Thu Nov 23 17:54:06 2006 +0000
@@ -307,10 +307,20 @@ struct acpi_20_madt_ioapic {
     uint32_t gsi_base;
 };
 
+struct acpi_20_madt_intsrcovr {
+    uint8_t  type;
+    uint8_t  length;
+    uint8_t  bus;
+    uint8_t  source;
+    uint32_t gsi;
+    uint16_t flags;
+};
+
 struct acpi_20_madt {
-    struct acpi_20_madt_header header;
-    struct acpi_20_madt_ioapic io_apic[1];
-    struct acpi_20_madt_lapic  lapic[32];
+    struct acpi_20_madt_header    header;
+    struct acpi_20_madt_intsrcovr intsrcovr[4];
+    struct acpi_20_madt_ioapic    io_apic[1];
+    struct acpi_20_madt_lapic     lapic[32];
 };
 
 /*
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/acpi/dsdt.asl
--- a/tools/firmware/hvmloader/acpi/dsdt.asl    Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/acpi/dsdt.asl    Thu Nov 23 17:54:06 2006 +0000
@@ -77,15 +77,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
            Name (_UID, 0x00)
            Name (_ADR, 0x00)
            Name (_BBN, 0x00)
-           OperationRegion (PIRP, PCI_Config, 0x3c, 0x10)
-           Field(PIRP, ByteAcc, NoLock, Preserve){        
-               IRQ3, 3,
-               IRQ5, 5,
-               IRQ7, 7,
-               IRQ9, 9,
-               IRQA, 10,
-               IRQB, 11
-           }
  
            Method (_CRS, 0, NotSerialized)
            {
@@ -140,9 +131,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
             }
 
             Name(BUFA, ResourceTemplate() {
-                IRQ(Level, ActiveLow, Shared) {
-                    3,4,5,6,7,10,11,12,14,15
-                }
+                IRQ(Level, ActiveLow, Shared) { 5, 6, 10, 11 }
             })
 
             Name(BUFB, Buffer() {
@@ -299,12 +288,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
             }
 
             Name(PRTP, Package() {
-                /* Device 0, INTA - INTD */
-                Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0},
-                Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0},
-                Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0},
-                Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0},
-
                 /* Device 1, INTA - INTD */
                 Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
                 Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
@@ -397,12 +380,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
             })
 
             Name(PRTA, Package() {
-                /* Device 0, INTA - INTD */
-                Package(){0x0000ffff, 0, 0, 16},
-                Package(){0x0000ffff, 1, 0, 17},
-                Package(){0x0000ffff, 2, 0, 18},
-                Package(){0x0000ffff, 3, 0, 19},
-
                 /* Device 1, INTA - INTD */
                 Package(){0x0001ffff, 0, 0, 20},
                 Package(){0x0001ffff, 1, 0, 21},
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/acpi/dsdt.c
--- a/tools/firmware/hvmloader/acpi/dsdt.c      Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/acpi/dsdt.c      Thu Nov 23 17:54:06 2006 +0000
@@ -5,15 +5,15 @@
  * Copyright (C) 2000 - 2005 Intel Corporation
  * Supports ACPI Specification Revision 3.0
  * 
- * Compilation of "dsdt.asl" - Tue Nov 21 17:20:04 2006
+ * Compilation of "dsdt.asl" - Wed Nov 22 18:26:19 2006
  * 
  * C source code output
  *
  */
 unsigned char AmlCode[] = 
 {
-    0x44,0x53,0x44,0x54,0x2A,0x0E,0x00,0x00,  /* 00000000    "DSDT*..." */
-    0x01,0x18,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
+    0x44,0x53,0x44,0x54,0x9D,0x0D,0x00,0x00,  /* 00000000    "DSDT...." */
+    0x01,0x83,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
     0x69,0x6E,0x74,0x2D,0x78,0x65,0x6E,0x00,  /* 00000010    "int-xen." */
     0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
     0x13,0x05,0x05,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
@@ -34,7 +34,7 @@ unsigned char AmlCode[] =
     0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00,  /* 00000098    "........" */
     0x00,0x08,0x50,0x49,0x43,0x44,0x00,0x14,  /* 000000A0    "..PICD.." */
     0x0C,0x5F,0x50,0x49,0x43,0x01,0x70,0x68,  /* 000000A8    "._PIC.ph" */
-    0x50,0x49,0x43,0x44,0x10,0x45,0xD7,0x5F,  /* 000000B0    "PICD.E._" */
+    0x50,0x49,0x43,0x44,0x10,0x48,0xCE,0x5F,  /* 000000B0    "PICD.H._" */
     0x53,0x42,0x5F,0x5B,0x82,0x49,0x04,0x4D,  /* 000000B8    "SB_[.I.M" */
     0x45,0x4D,0x30,0x08,0x5F,0x48,0x49,0x44,  /* 000000C0    "EM0._HID" */
     0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43,  /* 000000C8    ".A...._C" */
@@ -45,426 +45,408 @@ unsigned char AmlCode[] =
     0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000F0    "........" */
     0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,  /* 000000F8    "........" */
     0x00,0x00,0x00,0x00,0x79,0x00,0x5B,0x82,  /* 00000100    "....y.[." */
-    0x42,0xD2,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B.PCI0._" */
+    0x45,0xC9,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "E.PCI0._" */
     0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,  /* 00000110    "HID.A..." */
     0x08,0x5F,0x55,0x49,0x44,0x00,0x08,0x5F,  /* 00000118    "._UID.._" */
     0x41,0x44,0x52,0x00,0x08,0x5F,0x42,0x42,  /* 00000120    "ADR.._BB" */
-    0x4E,0x00,0x5B,0x80,0x50,0x49,0x52,0x50,  /* 00000128    "N.[.PIRP" */
-    0x02,0x0A,0x3C,0x0A,0x10,0x5B,0x81,0x24,  /* 00000130    "..<..[.$" */
-    0x50,0x49,0x52,0x50,0x01,0x49,0x52,0x51,  /* 00000138    "PIRP.IRQ" */
-    0x33,0x03,0x49,0x52,0x51,0x35,0x05,0x49,  /* 00000140    "3.IRQ5.I" */
-    0x52,0x51,0x37,0x07,0x49,0x52,0x51,0x39,  /* 00000148    "RQ7.IRQ9" */
-    0x09,0x49,0x52,0x51,0x41,0x0A,0x49,0x52,  /* 00000150    ".IRQA.IR" */
-    0x51,0x42,0x0B,0x14,0x44,0x08,0x5F,0x43,  /* 00000158    "QB..D._C" */
-    0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30,  /* 00000160    "RS..PRT0" */
-    0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,  /* 00000168    ".B..n..." */
-    0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,  /* 00000170    "........" */
-    0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8,  /* 00000178    ".....G.." */
-    0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,  /* 00000180    "........" */
-    0x01,0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,  /* 00000188    "........" */
-    0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,  /* 00000190    "........" */
-    0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,  /* 00000198    "........" */
-    0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00,  /* 000001A0    "........" */
-    0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,  /* 000001A8    "........" */
-    0x00,0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00,  /* 000001B0    "........" */
-    0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x87,  /* 000001B8    "........" */
-    0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00,  /* 000001C0    "........" */
-    0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,  /* 000001C8    "........" */
-    0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000001D0    "........" */
-    0x05,0x79,0x00,0xA4,0x50,0x52,0x54,0x30,  /* 000001D8    ".y..PRT0" */
-    0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A,  /* 000001E0    ".BUFA..." */
-    0x06,0x23,0xF8,0xDC,0x18,0x79,0x00,0x08,  /* 000001E8    ".#...y.." */
-    0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06,  /* 000001F0    "BUFB...." */
-    0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42,  /* 000001F8    "#...y..B" */
-    0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56,  /* 00000200    "UFB.IRQV" */
-    0x5B,0x82,0x48,0x08,0x4C,0x4E,0x4B,0x41,  /* 00000208    "[.H.LNKA" */
-    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000210    "._HID.A." */
-    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000218    "..._UID." */
-    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 00000220    ".._STA.{" */
-    0x50,0x49,0x52,0x41,0x0A,0x80,0x60,0xA0,  /* 00000228    "PIRA..`." */
-    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 00000230    "..`....." */
-    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 00000238    "......._" */
-    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 00000240    "PRS..BUF" */
-    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000248    "A.._DIS." */
-    0x7D,0x50,0x49,0x52,0x41,0x0A,0x80,0x50,  /* 00000250    "}PIRA..P" */
-    0x49,0x52,0x41,0x14,0x1A,0x5F,0x43,0x52,  /* 00000258    "IRA.._CR" */
-    0x53,0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,  /* 00000260    "S.{PIRA." */
-    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 00000268    ".`y.`IRQ" */
-    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 00000270    "V.BUFB.." */
-    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 00000278    "_SRS..h." */
-    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 00000280    "IRQ1.IRQ" */
-    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 00000288    "1`v`p`PI" */
-    0x52,0x41,0x5B,0x82,0x49,0x08,0x4C,0x4E,  /* 00000290    "RA[.I.LN" */
-    0x4B,0x42,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000298    "KB._HID." */
-    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 000002A0    "A...._UI" */
-    0x44,0x0A,0x02,0x14,0x1C,0x5F,0x53,0x54,  /* 000002A8    "D...._ST" */
-    0x41,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,  /* 000002B0    "A.{PIRB." */
-    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 000002B8    ".`...`.." */
-    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 000002C0    "........" */
-    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 000002C8    ".._PRS.." */
-    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 000002D0    "BUFA.._D" */
-    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x42,  /* 000002D8    "IS.}PIRB" */
-    0x0A,0x80,0x50,0x49,0x52,0x42,0x14,0x1A,  /* 000002E0    "..PIRB.." */
-    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 000002E8    "_CRS.{PI" */
-    0x52,0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 000002F0    "RB..`y.`" */
-    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 000002F8    "IRQV.BUF" */
-    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 00000300    "B.._SRS." */
-    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 00000308    ".h.IRQ1." */
-    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 00000310    "IRQ1`v`p" */
-    0x60,0x50,0x49,0x52,0x42,0x5B,0x82,0x49,  /* 00000318    "`PIRB[.I" */
-    0x08,0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48,  /* 00000320    ".LNKC._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 00000328    "ID.A...." */
-    0x5F,0x55,0x49,0x44,0x0A,0x03,0x14,0x1C,  /* 00000330    "_UID...." */
-    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 00000338    "_STA.{PI" */
-    0x52,0x43,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 00000340    "RC..`..." */
-    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 00000348    "`......." */
-    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 00000350    "....._PR" */
-    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 00000358    "S..BUFA." */
-    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000360    "._DIS.}P" */
-    0x49,0x52,0x43,0x0A,0x80,0x50,0x49,0x52,  /* 00000368    "IRC..PIR" */
-    0x43,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000370    "C.._CRS." */
-    0x7B,0x50,0x49,0x52,0x43,0x0A,0x0F,0x60,  /* 00000378    "{PIRC..`" */
-    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000380    "y.`IRQV." */
-    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000388    "BUFB.._S" */
-    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000390    "RS..h.IR" */
-    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000398    "Q1.IRQ1`" */
-    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x43,  /* 000003A0    "v`p`PIRC" */
-    0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x44,  /* 000003A8    "[.I.LNKD" */
-    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000003B0    "._HID.A." */
-    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,  /* 000003B8    "..._UID." */
-    0x04,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,  /* 000003C0    "..._STA." */
-    0x7B,0x50,0x49,0x52,0x44,0x0A,0x80,0x60,  /* 000003C8    "{PIRD..`" */
-    0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,  /* 000003D0    "...`...." */
-    0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,  /* 000003D8    "........" */
-    0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55,  /* 000003E0    "_PRS..BU" */
-    0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 000003E8    "FA.._DIS" */
-    0x00,0x7D,0x50,0x49,0x52,0x44,0x0A,0x80,  /* 000003F0    ".}PIRD.." */
-    0x50,0x49,0x52,0x44,0x14,0x1A,0x5F,0x43,  /* 000003F8    "PIRD.._C" */
-    0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x44,  /* 00000400    "RS.{PIRD" */
-    0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52,  /* 00000408    "..`y.`IR" */
-    0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14,  /* 00000410    "QV.BUFB." */
-    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 00000418    "._SRS..h" */
-    0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52,  /* 00000420    ".IRQ1.IR" */
-    0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50,  /* 00000428    "Q1`v`p`P" */
-    0x49,0x52,0x44,0x14,0x16,0x5F,0x50,0x52,  /* 00000430    "IRD.._PR" */
-    0x54,0x00,0xA0,0x0A,0x50,0x49,0x43,0x44,  /* 00000438    "T...PICD" */
-    0xA4,0x50,0x52,0x54,0x41,0xA4,0x50,0x52,  /* 00000440    ".PRTA.PR" */
-    0x54,0x50,0x08,0x50,0x52,0x54,0x50,0x12,  /* 00000448    "TP.PRTP." */
-    0x4B,0x39,0x40,0x12,0x0B,0x04,0x0B,0xFF,  /* 00000450    "K9@....." */
-    0xFF,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000458    "..LNKA.." */
-    0x0B,0x04,0x0B,0xFF,0xFF,0x01,0x4C,0x4E,  /* 00000460    "......LN" */
-    0x4B,0x42,0x00,0x12,0x0C,0x04,0x0B,0xFF,  /* 00000468    "KB......" */
-    0xFF,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000470    "...LNKC." */
-    0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x03,  /* 00000478    "........" */
-    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000480    "LNKD...." */
-    0x0C,0xFF,0xFF,0x01,0x00,0x00,0x4C,0x4E,  /* 00000488    "......LN" */
-    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000490    "KB......" */
-    0xFF,0x01,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000498    "....LNKC" */
-    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x01,  /* 000004A0    "........" */
-    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 000004A8    "...LNKD." */
-    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004B0    "........" */
-    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 000004B8    "..LNKA.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x00,  /* 000004C0    "........" */
-    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 000004C8    "LNKC...." */
-    0x0C,0xFF,0xFF,0x02,0x00,0x01,0x4C,0x4E,  /* 000004D0    "......LN" */
-    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000004D8    "KD......" */
-    0xFF,0x02,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000004E0    ".....LNK" */
-    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000004E8    "A......." */
-    0x02,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000004F0    "....LNKB" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x03,  /* 000004F8    "........" */
-    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 00000500    "..LNKD.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,  /* 00000508    "........" */
-    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 00000510    "LNKA...." */
-    0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,0x4C,  /* 00000518    ".......L" */
-    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 00000520    "NKB....." */
-    0xFF,0xFF,0x03,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000528    "......LN" */
-    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000530    "KC......" */
-    0xFF,0x04,0x00,0x00,0x4C,0x4E,0x4B,0x41,  /* 00000538    "....LNKA" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,  /* 00000540    "........" */
-    0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000548    "..LNKB.." */
-    0x0E,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,  /* 00000550    "........" */
-    0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000558    ".LNKC..." */
-    0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x03,  /* 00000560    "........" */
-    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000568    "LNKD...." */
-    0x0C,0xFF,0xFF,0x05,0x00,0x00,0x4C,0x4E,  /* 00000570    "......LN" */
-    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000578    "KB......" */
-    0xFF,0x05,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000580    "....LNKC" */
-    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x05,  /* 00000588    "........" */
-    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000590    "...LNKD." */
-    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x05,0x00,  /* 00000598    "........" */
-    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 000005A0    "..LNKA.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x00,  /* 000005A8    "........" */
-    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 000005B0    "LNKC...." */
-    0x0C,0xFF,0xFF,0x06,0x00,0x01,0x4C,0x4E,  /* 000005B8    "......LN" */
-    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000005C0    "KD......" */
-    0xFF,0x06,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000005C8    ".....LNK" */
-    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000005D0    "A......." */
-    0x06,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000005D8    "....LNKB" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x07,  /* 000005E0    "........" */
-    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 000005E8    "..LNKD.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x01,  /* 000005F0    "........" */
-    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 000005F8    "LNKA...." */
-    0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x02,0x4C,  /* 00000600    ".......L" */
-    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 00000608    "NKB....." */
-    0xFF,0xFF,0x07,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000610    "......LN" */
-    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000618    "KC......" */
-    0xFF,0x08,0x00,0x00,0x4C,0x4E,0x4B,0x41,  /* 00000620    "....LNKA" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x08,  /* 00000628    "........" */
-    0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000630    "..LNKB.." */
-    0x0E,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,  /* 00000638    "........" */
-    0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000640    ".LNKC..." */
-    0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,0x03,  /* 00000648    "........" */
-    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000650    "LNKD...." */
-    0x0C,0xFF,0xFF,0x09,0x00,0x00,0x4C,0x4E,  /* 00000658    "......LN" */
-    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000660    "KB......" */
-    0xFF,0x09,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000668    "....LNKC" */
-    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x09,  /* 00000670    "........" */
-    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000678    "...LNKD." */
-    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x09,0x00,  /* 00000680    "........" */
-    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000688    "..LNKA.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x00,  /* 00000690    "........" */
-    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000698    "LNKC...." */
-    0x0C,0xFF,0xFF,0x0A,0x00,0x01,0x4C,0x4E,  /* 000006A0    "......LN" */
-    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000006A8    "KD......" */
-    0xFF,0x0A,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000006B0    ".....LNK" */
-    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000006B8    "A......." */
-    0x0A,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000006C0    "....LNKB" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0B,  /* 000006C8    "........" */
-    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 000006D0    "..LNKD.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x01,  /* 000006D8    "........" */
-    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 000006E0    "LNKA...." */
-    0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x02,0x4C,  /* 000006E8    ".......L" */
-    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000006F0    "NKB....." */
-    0xFF,0xFF,0x0B,0x00,0x0A,0x03,0x4C,0x4E,  /* 000006F8    "......LN" */
-    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000700    "KC......" */
-    0xFF,0x0C,0x00,0x00,0x4C,0x4E,0x4B,0x41,  /* 00000708    "....LNKA" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000710    "........" */
-    0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000718    "..LNKB.." */
-    0x0E,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,  /* 00000720    "........" */
-    0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000728    ".LNKC..." */
-    0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,0x03,  /* 00000730    "........" */
-    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000738    "LNKD...." */
-    0x0C,0xFF,0xFF,0x0D,0x00,0x00,0x4C,0x4E,  /* 00000740    "......LN" */
-    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000748    "KB......" */
-    0xFF,0x0D,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000750    "....LNKC" */
-    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0D,  /* 00000758    "........" */
-    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000760    "...LNKD." */
-    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0D,0x00,  /* 00000768    "........" */
-    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000770    "..LNKA.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x00,  /* 00000778    "........" */
-    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000780    "LNKC...." */
-    0x0C,0xFF,0xFF,0x0E,0x00,0x01,0x4C,0x4E,  /* 00000788    "......LN" */
-    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000790    "KD......" */
-    0xFF,0x0E,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000798    ".....LNK" */
-    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000007A0    "A......." */
-    0x0E,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000007A8    "....LNKB" */
-    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0F,  /* 000007B0    "........" */
-    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 000007B8    "..LNKD.." */
-    0x0D,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x01,  /* 000007C0    "........" */
-    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 000007C8    "LNKA...." */
-    0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x02,0x4C,  /* 000007D0    ".......L" */
-    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000007D8    "NKB....." */
-    0xFF,0xFF,0x0F,0x00,0x0A,0x03,0x4C,0x4E,  /* 000007E0    "......LN" */
-    0x4B,0x43,0x00,0x08,0x50,0x52,0x54,0x41,  /* 000007E8    "KC..PRTA" */
-    0x12,0x4B,0x31,0x40,0x12,0x09,0x04,0x0B,  /* 000007F0    ".K1@...." */
-    0xFF,0xFF,0x00,0x00,0x0A,0x10,0x12,0x09,  /* 000007F8    "........" */
-    0x04,0x0B,0xFF,0xFF,0x01,0x00,0x0A,0x11,  /* 00000800    "........" */
-    0x12,0x0A,0x04,0x0B,0xFF,0xFF,0x0A,0x02,  /* 00000808    "........" */
-    0x00,0x0A,0x12,0x12,0x0A,0x04,0x0B,0xFF,  /* 00000810    "........" */
-    0xFF,0x0A,0x03,0x00,0x0A,0x13,0x12,0x0B,  /* 00000818    "........" */
-    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00,0x00,  /* 00000820    "........" */
-    0x0A,0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000828    "........" */
-    0x01,0x00,0x01,0x00,0x0A,0x15,0x12,0x0C,  /* 00000830    "........" */
-    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 00000838    "........" */
-    0x00,0x0A,0x16,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000840    "........" */
-    0xFF,0x01,0x00,0x0A,0x03,0x00,0x0A,0x17,  /* 00000848    "........" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000850    "........" */
-    0x00,0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,  /* 00000858    "........" */
-    0xFF,0xFF,0x02,0x00,0x01,0x00,0x0A,0x19,  /* 00000860    "........" */
-    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000868    "........" */
-    0x0A,0x02,0x00,0x0A,0x1A,0x12,0x0C,0x04,  /* 00000870    "........" */
-    0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03,0x00,  /* 00000878    "........" */
-    0x0A,0x1B,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000880    "........" */
-    0x03,0x00,0x00,0x00,0x0A,0x1C,0x12,0x0B,  /* 00000888    "........" */
-    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,0x00,  /* 00000890    "........" */
-    0x0A,0x1D,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000898    "........" */
-    0x03,0x00,0x0A,0x02,0x00,0x0A,0x1E,0x12,  /* 000008A0    "........" */
-    0x0C,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,  /* 000008A8    "........" */
-    0x03,0x00,0x0A,0x1F,0x12,0x0B,0x04,0x0C,  /* 000008B0    "........" */
-    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x20,  /* 000008B8    "....... " */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000008C0    "........" */
-    0x01,0x00,0x0A,0x21,0x12,0x0C,0x04,0x0C,  /* 000008C8    "...!...." */
-    0xFF,0xFF,0x04,0x00,0x0A,0x02,0x00,0x0A,  /* 000008D0    "........" */
-    0x22,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x04,  /* 000008D8    ""......." */
-    0x00,0x0A,0x03,0x00,0x0A,0x23,0x12,0x0B,  /* 000008E0    ".....#.." */
-    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x00,0x00,  /* 000008E8    "........" */
-    0x0A,0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 000008F0    ".$......" */
-    0x05,0x00,0x01,0x00,0x0A,0x25,0x12,0x0C,  /* 000008F8    ".....%.." */
-    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,  /* 00000900    "........" */
-    0x00,0x0A,0x26,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000908    "..&....." */
-    0xFF,0x05,0x00,0x0A,0x03,0x00,0x0A,0x27,  /* 00000910    ".......'" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000918    "........" */
-    0x00,0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,  /* 00000920    "...(...." */
-    0xFF,0xFF,0x06,0x00,0x01,0x00,0x0A,0x29,  /* 00000928    ".......)" */
-    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000930    "........" */
-    0x0A,0x02,0x00,0x0A,0x2A,0x12,0x0C,0x04,  /* 00000938    "....*..." */
-    0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x03,0x00,  /* 00000940    "........" */
-    0x0A,0x2B,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000948    ".+......" */
-    0x07,0x00,0x00,0x00,0x0A,0x2C,0x12,0x0B,  /* 00000950    ".....,.." */
-    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x01,0x00,  /* 00000958    "........" */
-    0x0A,0x2D,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000960    ".-......" */
-    0x07,0x00,0x0A,0x02,0x00,0x0A,0x2E,0x12,  /* 00000968    "........" */
-    0x0C,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,  /* 00000970    "........" */
-    0x03,0x00,0x0A,0x2F,0x12,0x0B,0x04,0x0C,  /* 00000978    ".../...." */
-    0xFF,0xFF,0x08,0x00,0x00,0x00,0x0A,0x11,  /* 00000980    "........" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 00000988    "........" */
-    0x01,0x00,0x0A,0x12,0x12,0x0C,0x04,0x0C,  /* 00000990    "........" */
-    0xFF,0xFF,0x08,0x00,0x0A,0x02,0x00,0x0A,  /* 00000998    "........" */
-    0x13,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x08,  /* 000009A0    "........" */
-    0x00,0x0A,0x03,0x00,0x0A,0x14,0x12,0x0B,  /* 000009A8    "........" */
-    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x00,0x00,  /* 000009B0    "........" */
-    0x0A,0x15,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 000009B8    "........" */
-    0x09,0x00,0x01,0x00,0x0A,0x16,0x12,0x0C,  /* 000009C0    "........" */
-    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02,  /* 000009C8    "........" */
-    0x00,0x0A,0x17,0x12,0x0C,0x04,0x0C,0xFF,  /* 000009D0    "........" */
-    0xFF,0x09,0x00,0x0A,0x03,0x00,0x0A,0x18,  /* 000009D8    "........" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 000009E0    "........" */
-    0x00,0x00,0x0A,0x19,0x12,0x0B,0x04,0x0C,  /* 000009E8    "........" */
-    0xFF,0xFF,0x0A,0x00,0x01,0x00,0x0A,0x1A,  /* 000009F0    "........" */
-    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 000009F8    "........" */
-    0x0A,0x02,0x00,0x0A,0x1B,0x12,0x0C,0x04,  /* 00000A00    "........" */
-    0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x03,0x00,  /* 00000A08    "........" */
-    0x0A,0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A10    "........" */
-    0x0B,0x00,0x00,0x00,0x0A,0x1D,0x12,0x0B,  /* 00000A18    "........" */
-    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x01,0x00,  /* 00000A20    "........" */
-    0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000A28    "........" */
-    0x0B,0x00,0x0A,0x02,0x00,0x0A,0x1F,0x12,  /* 00000A30    "........" */
-    0x0C,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,  /* 00000A38    "........" */
-    0x03,0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,  /* 00000A40    "... ...." */
-    0xFF,0xFF,0x0C,0x00,0x00,0x00,0x0A,0x21,  /* 00000A48    ".......!" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 00000A50    "........" */
-    0x01,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C,  /* 00000A58    "..."...." */
-    0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x00,0x0A,  /* 00000A60    "........" */
-    0x23,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000A68    "#......." */
-    0x00,0x0A,0x03,0x00,0x0A,0x24,0x12,0x0B,  /* 00000A70    ".....$.." */
-    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x00,0x00,  /* 00000A78    "........" */
-    0x0A,0x25,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A80    ".%......" */
-    0x0D,0x00,0x01,0x00,0x0A,0x26,0x12,0x0C,  /* 00000A88    ".....&.." */
-    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02,  /* 00000A90    "........" */
-    0x00,0x0A,0x27,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000A98    "..'....." */
-    0xFF,0x0D,0x00,0x0A,0x03,0x00,0x0A,0x28,  /* 00000AA0    ".......(" */
-    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000AA8    "........" */
-    0x00,0x00,0x0A,0x29,0x12,0x0B,0x04,0x0C,  /* 00000AB0    "...)...." */
-    0xFF,0xFF,0x0E,0x00,0x01,0x00,0x0A,0x2A,  /* 00000AB8    ".......*" */
-    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000AC0    "........" */
-    0x0A,0x02,0x00,0x0A,0x2B,0x12,0x0C,0x04,  /* 00000AC8    "....+..." */
-    0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x03,0x00,  /* 00000AD0    "........" */
-    0x0A,0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000AD8    ".,......" */
-    0x0F,0x00,0x00,0x00,0x0A,0x2D,0x12,0x0B,  /* 00000AE0    ".....-.." */
-    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x01,0x00,  /* 00000AE8    "........" */
-    0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000AF0    "........" */
-    0x0F,0x00,0x0A,0x02,0x00,0x0A,0x2F,0x12,  /* 00000AF8    "....../." */
-    0x0C,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,  /* 00000B00    "........" */
-    0x03,0x00,0x0A,0x10,0x5B,0x82,0x4C,0x31,  /* 00000B08    "....[.L1" */
-    0x49,0x53,0x41,0x5F,0x08,0x5F,0x41,0x44,  /* 00000B10    "ISA_._AD" */
-    0x52,0x0C,0x00,0x00,0x01,0x00,0x5B,0x80,  /* 00000B18    "R.....[." */
-    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 00000B20    "PIRQ..`." */
-    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 00000B28    "...\.[.)" */
-    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 00000B30    "\/._SB_P" */
-    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 00000B38    "CI0ISA_P" */
-    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 00000B40    "IRQ.PIRA" */
-    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 00000B48    ".PIRB.PI" */
-    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 00000B50    "RC.PIRD." */
-    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 00000B58    "[.F.SYSR" */
-    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000B60    "._HID.A." */
-    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000B68    "..._UID." */
-    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000B70    ".CRS_.N." */
-    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000B78    "..G....." */
-    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000B80    "..G."."." */
-    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000B88    "..G.0.0." */
-    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000B90    "..G.D.D." */
-    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000B98    "..G.b.b." */
-    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000BA0    "..G.e.e." */
-    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000BA8    "..G.r.r." */
-    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000BB0    "..G....." */
-    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000BB8    "..G....." */
-    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000BC0    "..G....." */
-    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000BC8    "..G....." */
-    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000BD0    "..G....." */
-    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000BD8    "..G....." */
-    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000BE0    "..G....." */
-    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000BE8    "..G....." */
-    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 00000BF0    "..G....." */
-    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 00000BF8    "..G....." */
-    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 00000C00    "..y..._C" */
-    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 00000C08    "RS..CRS_" */
-    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 00000C10    "[.+PIC_." */
-    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 00000C18    "_HID.A.." */
-    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 00000C20    "_CRS...." */
-    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 00000C28    "G. . ..." */
-    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 00000C30    "G......." */
-    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 00000C38    ""..y.[.G" */
-    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 00000C40    ".DMA0._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 00000C48    "ID.A...." */
-    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 00000C50    "_CRS.A.." */
-    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 00000C58    "=*..G..." */
-    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 00000C60    "....G..." */
-    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 00000C68    "....G..." */
-    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000C70    "....G..." */
-    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000C78    "....G..." */
-    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000C80    "....G..." */
-    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000C88    "... G..." */
-    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000C90    "....y.[." */
-    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000C98    "%TMR_._H" */
-    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000CA0    "ID.A...." */
-    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000CA8    "_CRS...." */
-    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000CB0    "G.@.@..." */
-    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000CB8    ""..y.[.%" */
-    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000CC0    "RTC_._HI" */
-    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000CC8    "D.A...._" */
-    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000CD0    "CRS....G" */
-    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000CD8    ".p.p..."" */
-    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000CE0    "..y.[."S" */
-    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000CE8    "PKR._HID" */
-    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 00000CF0    ".A...._C" */
-    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 00000CF8    "RS....G." */
-    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 00000D00    "a.a...y." */
-    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 00000D08    "[.1PS2M." */
-    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 00000D10    "_HID.A.." */
-    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 00000D18    ".._CID.A" */
-    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 00000D20    "....._ST" */
-    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000D28    "A....._C" */
-    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 00000D30    "RS...."." */
-    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 00000D38    ".y.[.B.P" */
-    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 00000D40    "S2K._HID" */
-    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 00000D48    ".A...._C" */
-    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 00000D50    "ID.A...." */
-    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000D58    "._STA..." */
-    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 00000D60    ".._CRS.." */
-    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 00000D68    "..G.`.`." */
-    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000D70    "..G.d.d." */
-    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000D78    ".."..y.[" */
-    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000D80    ".:FDC0._" */
-    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000D88    "HID.A..." */
-    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000D90    ".._STA.." */
-    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000D98    "..._CRS." */
-    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000DA0    "...G...." */
-    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000DA8    "...G...." */
-    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000DB0    "..."@.*." */
-    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000DB8    ".y.[.5UA" */
-    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000DC0    "R1._HID." */
-    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000DC8    "A...._UI" */
-    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000DD0    "D..._STA" */
-    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000DD8    "....._CR" */
-    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000DE0    "S....G.." */
-    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000DE8    ".....".." */
-    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 00000DF0    "y.[.6LTP" */
-    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000DF8    "1._HID.A" */
-    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 00000E00    "...._UID" */
-    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000E08    "...._STA" */
-    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000E10    "....._CR" */
-    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 00000E18    "S....G.x" */
-    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 00000E20    ".x...".." */
-    0x79,0x00,
+    0x4E,0x00,0x14,0x44,0x08,0x5F,0x43,0x52,  /* 00000128    "N..D._CR" */
+    0x53,0x00,0x08,0x50,0x52,0x54,0x30,0x11,  /* 00000130    "S..PRT0." */
+    0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,0x02,  /* 00000138    "B..n...." */
+    0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,  /* 00000140    "........" */
+    0x00,0x00,0x00,0x01,0x47,0x01,0xF8,0x0C,  /* 00000148    "....G..." */
+    0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,0x01,  /* 00000150    "........" */
+    0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,0x0C,  /* 00000158    "........" */
+    0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,0x01,  /* 00000160    "........" */
+    0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,0xFF,  /* 00000168    "........" */
+    0x00,0x00,0x00,0xF3,0x87,0x17,0x00,0x00,  /* 00000170    "........" */
+    0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000178    "........" */
+    0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00,0x00,  /* 00000180    "........" */
+    0x00,0x00,0x00,0x00,0x02,0x00,0x87,0x17,  /* 00000188    "........" */
+    0x00,0x00,0x0D,0x03,0x00,0x00,0x00,0x00,  /* 00000190    "........" */
+    0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF4,  /* 00000198    "........" */
+    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,  /* 000001A0    "........" */
+    0x79,0x00,0xA4,0x50,0x52,0x54,0x30,0x08,  /* 000001A8    "y..PRT0." */
+    0x42,0x55,0x46,0x41,0x11,0x09,0x0A,0x06,  /* 000001B0    "BUFA...." */
+    0x23,0x60,0x0C,0x18,0x79,0x00,0x08,0x42,  /* 000001B8    "#`..y..B" */
+    0x55,0x46,0x42,0x11,0x09,0x0A,0x06,0x23,  /* 000001C0    "UFB....#" */
+    0x00,0x00,0x18,0x79,0x00,0x8B,0x42,0x55,  /* 000001C8    "...y..BU" */
+    0x46,0x42,0x01,0x49,0x52,0x51,0x56,0x5B,  /* 000001D0    "FB.IRQV[" */
+    0x82,0x48,0x08,0x4C,0x4E,0x4B,0x41,0x08,  /* 000001D8    ".H.LNKA." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 000001E0    "_HID.A.." */
+    0x0F,0x08,0x5F,0x55,0x49,0x44,0x01,0x14,  /* 000001E8    ".._UID.." */
+    0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,  /* 000001F0    "._STA.{P" */
+    0x49,0x52,0x41,0x0A,0x80,0x60,0xA0,0x08,  /* 000001F8    "IRA..`.." */
+    0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,  /* 00000200    ".`......" */
+    0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,  /* 00000208    "......_P" */
+    0x52,0x53,0x00,0xA4,0x42,0x55,0x46,0x41,  /* 00000210    "RS..BUFA" */
+    0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,  /* 00000218    ".._DIS.}" */
+    0x50,0x49,0x52,0x41,0x0A,0x80,0x50,0x49,  /* 00000220    "PIRA..PI" */
+    0x52,0x41,0x14,0x1A,0x5F,0x43,0x52,0x53,  /* 00000228    "RA.._CRS" */
+    0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,0x0F,  /* 00000230    ".{PIRA.." */
+    0x60,0x79,0x01,0x60,0x49,0x52,0x51,0x56,  /* 00000238    "`y.`IRQV" */
+    0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,  /* 00000240    ".BUFB.._" */
+    0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x49,  /* 00000248    "SRS..h.I" */
+    0x52,0x51,0x31,0x82,0x49,0x52,0x51,0x31,  /* 00000250    "RQ1.IRQ1" */
+    0x60,0x76,0x60,0x70,0x60,0x50,0x49,0x52,  /* 00000258    "`v`p`PIR" */
+    0x41,0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,  /* 00000260    "A[.I.LNK" */
+    0x42,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000268    "B._HID.A" */
+    0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,  /* 00000270    "...._UID" */
+    0x0A,0x02,0x14,0x1C,0x5F,0x53,0x54,0x41,  /* 00000278    "...._STA" */
+    0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,0x80,  /* 00000280    ".{PIRB.." */
+    0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,  /* 00000288    "`...`..." */
+    0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,  /* 00000290    "........" */
+    0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,  /* 00000298    "._PRS..B" */
+    0x55,0x46,0x41,0x14,0x11,0x5F,0x44,0x49,  /* 000002A0    "UFA.._DI" */
+    0x53,0x00,0x7D,0x50,0x49,0x52,0x42,0x0A,  /* 000002A8    "S.}PIRB." */
+    0x80,0x50,0x49,0x52,0x42,0x14,0x1A,0x5F,  /* 000002B0    ".PIRB.._" */
+    0x43,0x52,0x53,0x00,0x7B,0x50,0x49,0x52,  /* 000002B8    "CRS.{PIR" */
+    0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,  /* 000002C0    "B..`y.`I" */
+    0x52,0x51,0x56,0xA4,0x42,0x55,0x46,0x42,  /* 000002C8    "RQV.BUFB" */
+    0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,  /* 000002D0    ".._SRS.." */
+    0x68,0x01,0x49,0x52,0x51,0x31,0x82,0x49,  /* 000002D8    "h.IRQ1.I" */
+    0x52,0x51,0x31,0x60,0x76,0x60,0x70,0x60,  /* 000002E0    "RQ1`v`p`" */
+    0x50,0x49,0x52,0x42,0x5B,0x82,0x49,0x08,  /* 000002E8    "PIRB[.I." */
+    0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49,  /* 000002F0    "LNKC._HI" */
+    0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,  /* 000002F8    "D.A...._" */
+    0x55,0x49,0x44,0x0A,0x03,0x14,0x1C,0x5F,  /* 00000300    "UID...._" */
+    0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52,  /* 00000308    "STA.{PIR" */
+    0x43,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,  /* 00000310    "C..`...`" */
+    0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,  /* 00000318    "........" */
+    0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,  /* 00000320    "...._PRS" */
+    0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11,  /* 00000328    "..BUFA.." */
+    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49,  /* 00000330    "_DIS.}PI" */
+    0x52,0x43,0x0A,0x80,0x50,0x49,0x52,0x43,  /* 00000338    "RC..PIRC" */
+    0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,  /* 00000340    ".._CRS.{" */
+    0x50,0x49,0x52,0x43,0x0A,0x0F,0x60,0x79,  /* 00000348    "PIRC..`y" */
+    0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42,  /* 00000350    ".`IRQV.B" */
+    0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,  /* 00000358    "UFB.._SR" */
+    0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51,  /* 00000360    "S..h.IRQ" */
+    0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76,  /* 00000368    "1.IRQ1`v" */
+    0x60,0x70,0x60,0x50,0x49,0x52,0x43,0x5B,  /* 00000370    "`p`PIRC[" */
+    0x82,0x49,0x08,0x4C,0x4E,0x4B,0x44,0x08,  /* 00000378    ".I.LNKD." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 00000380    "_HID.A.." */
+    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x04,  /* 00000388    ".._UID.." */
+    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 00000390    ".._STA.{" */
+    0x50,0x49,0x52,0x44,0x0A,0x80,0x60,0xA0,  /* 00000398    "PIRD..`." */
+    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 000003A0    "..`....." */
+    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 000003A8    "......._" */
+    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 000003B0    "PRS..BUF" */
+    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 000003B8    "A.._DIS." */
+    0x7D,0x50,0x49,0x52,0x44,0x0A,0x80,0x50,  /* 000003C0    "}PIRD..P" */
+    0x49,0x52,0x44,0x14,0x1A,0x5F,0x43,0x52,  /* 000003C8    "IRD.._CR" */
+    0x53,0x00,0x7B,0x50,0x49,0x52,0x44,0x0A,  /* 000003D0    "S.{PIRD." */
+    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 000003D8    ".`y.`IRQ" */
+    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 000003E0    "V.BUFB.." */
+    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 000003E8    "_SRS..h." */
+    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 000003F0    "IRQ1.IRQ" */
+    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 000003F8    "1`v`p`PI" */
+    0x52,0x44,0x14,0x16,0x5F,0x50,0x52,0x54,  /* 00000400    "RD.._PRT" */
+    0x00,0xA0,0x0A,0x50,0x49,0x43,0x44,0xA4,  /* 00000408    "...PICD." */
+    0x50,0x52,0x54,0x41,0xA4,0x50,0x52,0x54,  /* 00000410    "PRTA.PRT" */
+    0x50,0x08,0x50,0x52,0x54,0x50,0x12,0x49,  /* 00000418    "P.PRTP.I" */
+    0x36,0x3C,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000420    "6<......" */
+    0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000428    "...LNKB." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000430    "........" */
+    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000438    ".LNKC..." */
+    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 00000440    "........" */
+    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000448    "LNKD...." */
+    0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,  /* 00000450    ".......L" */
+    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000458    "NKA....." */
+    0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000460    ".....LNK" */
+    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000468    "C......." */
+    0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000470    "...LNKD." */
+    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000478    "........" */
+    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000480    "..LNKA.." */
+    0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,  /* 00000488    "........" */
+    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000490    ".LNKB..." */
+    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,  /* 00000498    ".......L" */
+    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 000004A0    "NKD....." */
+    0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,  /* 000004A8    ".....LNK" */
+    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000004B0    "A......." */
+    0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 000004B8    "....LNKB" */
+    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,  /* 000004C0    "........" */
+    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 000004C8    "...LNKC." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000004D0    "........" */
+    0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,  /* 000004D8    ".LNKA..." */
+    0x04,0x0C,0xFF,0xFF,0x04,0x00,0x01,0x4C,  /* 000004E0    ".......L" */
+    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000004E8    "NKB....." */
+    0xFF,0xFF,0x04,0x00,0x0A,0x02,0x4C,0x4E,  /* 000004F0    "......LN" */
+    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000004F8    "KC......" */
+    0xFF,0x04,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 00000500    ".....LNK" */
+    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000508    "D......." */
+    0x05,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000510    "...LNKB." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00,  /* 00000518    "........" */
+    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000520    ".LNKC..." */
+    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,  /* 00000528    "........" */
+    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000530    "LNKD...." */
+    0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,0x4C,  /* 00000538    ".......L" */
+    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000540    "NKA....." */
+    0xFF,0xFF,0x06,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000548    ".....LNK" */
+    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000550    "C......." */
+    0x06,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000558    "...LNKD." */
+    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000560    "........" */
+    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000568    "..LNKA.." */
+    0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x0A,  /* 00000570    "........" */
+    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000578    ".LNKB..." */
+    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x00,0x4C,  /* 00000580    ".......L" */
+    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000588    "NKD....." */
+    0xFF,0xFF,0x07,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000590    ".....LNK" */
+    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000598    "A......." */
+    0x07,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 000005A0    "....LNKB" */
+    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x07,  /* 000005A8    "........" */
+    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 000005B0    "...LNKC." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 000005B8    "........" */
+    0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,  /* 000005C0    ".LNKA..." */
+    0x04,0x0C,0xFF,0xFF,0x08,0x00,0x01,0x4C,  /* 000005C8    ".......L" */
+    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000005D0    "NKB....." */
+    0xFF,0xFF,0x08,0x00,0x0A,0x02,0x4C,0x4E,  /* 000005D8    "......LN" */
+    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000005E0    "KC......" */
+    0xFF,0x08,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000005E8    ".....LNK" */
+    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000005F0    "D......." */
+    0x09,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000005F8    "...LNKB." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x09,0x00,  /* 00000600    "........" */
+    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000608    ".LNKC..." */
+    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02,  /* 00000610    "........" */
+    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000618    "LNKD...." */
+    0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,0x4C,  /* 00000620    ".......L" */
+    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000628    "NKA....." */
+    0xFF,0xFF,0x0A,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000630    ".....LNK" */
+    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000638    "C......." */
+    0x0A,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000640    "...LNKD." */
+    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000648    "........" */
+    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000650    "..LNKA.." */
+    0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x0A,  /* 00000658    "........" */
+    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000660    ".LNKB..." */
+    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x4C,  /* 00000668    ".......L" */
+    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000670    "NKD....." */
+    0xFF,0xFF,0x0B,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000678    ".....LNK" */
+    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000680    "A......." */
+    0x0B,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000688    "....LNKB" */
+    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0B,  /* 00000690    "........" */
+    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000698    "...LNKC." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 000006A0    "........" */
+    0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,  /* 000006A8    ".LNKA..." */
+    0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x01,0x4C,  /* 000006B0    ".......L" */
+    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000006B8    "NKB....." */
+    0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x4C,0x4E,  /* 000006C0    "......LN" */
+    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000006C8    "KC......" */
+    0xFF,0x0C,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000006D0    ".....LNK" */
+    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000006D8    "D......." */
+    0x0D,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000006E0    "...LNKB." */
+    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0D,0x00,  /* 000006E8    "........" */
+    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 000006F0    ".LNKC..." */
+    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02,  /* 000006F8    "........" */
+    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000700    "LNKD...." */
+    0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,0x4C,  /* 00000708    ".......L" */
+    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000710    "NKA....." */
+    0xFF,0xFF,0x0E,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000718    ".....LNK" */
+    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000720    "C......." */
+    0x0E,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000728    "...LNKD." */
+    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000730    "........" */
+    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000738    "..LNKA.." */
+    0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x0A,  /* 00000740    "........" */
+    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000748    ".LNKB..." */
+    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x4C,  /* 00000750    ".......L" */
+    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000758    "NKD....." */
+    0xFF,0xFF,0x0F,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000760    ".....LNK" */
+    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000768    "A......." */
+    0x0F,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000770    "....LNKB" */
+    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0F,  /* 00000778    "........" */
+    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000780    "...LNKC." */
+    0x08,0x50,0x52,0x54,0x41,0x12,0x41,0x2F,  /* 00000788    ".PRTA.A/" */
+    0x3C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,  /* 00000790    "<......." */
+    0x00,0x00,0x00,0x0A,0x14,0x12,0x0B,0x04,  /* 00000798    "........" */
+    0x0C,0xFF,0xFF,0x01,0x00,0x01,0x00,0x0A,  /* 000007A0    "........" */
+    0x15,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x01,  /* 000007A8    "........" */
+    0x00,0x0A,0x02,0x00,0x0A,0x16,0x12,0x0C,  /* 000007B0    "........" */
+    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,  /* 000007B8    "........" */
+    0x00,0x0A,0x17,0x12,0x0B,0x04,0x0C,0xFF,  /* 000007C0    "........" */
+    0xFF,0x02,0x00,0x00,0x00,0x0A,0x18,0x12,  /* 000007C8    "........" */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01,  /* 000007D0    "........" */
+    0x00,0x0A,0x19,0x12,0x0C,0x04,0x0C,0xFF,  /* 000007D8    "........" */
+    0xFF,0x02,0x00,0x0A,0x02,0x00,0x0A,0x1A,  /* 000007E0    "........" */
+    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 000007E8    "........" */
+    0x0A,0x03,0x00,0x0A,0x1B,0x12,0x0B,0x04,  /* 000007F0    "........" */
+    0x0C,0xFF,0xFF,0x03,0x00,0x00,0x00,0x0A,  /* 000007F8    "........" */
+    0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,  /* 00000800    "........" */
+    0x00,0x01,0x00,0x0A,0x1D,0x12,0x0C,0x04,  /* 00000808    "........" */
+    0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,0x00,  /* 00000810    "........" */
+    0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000818    "........" */
+    0x03,0x00,0x0A,0x03,0x00,0x0A,0x1F,0x12,  /* 00000820    "........" */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00,  /* 00000828    "........" */
+    0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000830    ".. ....." */
+    0xFF,0x04,0x00,0x01,0x00,0x0A,0x21,0x12,  /* 00000838    "......!." */
+    0x0C,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,  /* 00000840    "........" */
+    0x02,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C,  /* 00000848    "..."...." */
+    0xFF,0xFF,0x04,0x00,0x0A,0x03,0x00,0x0A,  /* 00000850    "........" */
+    0x23,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x05,  /* 00000858    "#......." */
+    0x00,0x00,0x00,0x0A,0x24,0x12,0x0B,0x04,  /* 00000860    "....$..." */
+    0x0C,0xFF,0xFF,0x05,0x00,0x01,0x00,0x0A,  /* 00000868    "........" */
+    0x25,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x05,  /* 00000870    "%......." */
+    0x00,0x0A,0x02,0x00,0x0A,0x26,0x12,0x0C,  /* 00000878    ".....&.." */
+    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,  /* 00000880    "........" */
+    0x00,0x0A,0x27,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000888    "..'....." */
+    0xFF,0x06,0x00,0x00,0x00,0x0A,0x28,0x12,  /* 00000890    "......(." */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x01,  /* 00000898    "........" */
+    0x00,0x0A,0x29,0x12,0x0C,0x04,0x0C,0xFF,  /* 000008A0    "..)....." */
+    0xFF,0x06,0x00,0x0A,0x02,0x00,0x0A,0x2A,  /* 000008A8    ".......*" */
+    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 000008B0    "........" */
+    0x0A,0x03,0x00,0x0A,0x2B,0x12,0x0B,0x04,  /* 000008B8    "....+..." */
+    0x0C,0xFF,0xFF,0x07,0x00,0x00,0x00,0x0A,  /* 000008C0    "........" */
+    0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x07,  /* 000008C8    ",......." */
+    0x00,0x01,0x00,0x0A,0x2D,0x12,0x0C,0x04,  /* 000008D0    "....-..." */
+    0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x02,0x00,  /* 000008D8    "........" */
+    0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 000008E0    "........" */
+    0x07,0x00,0x0A,0x03,0x00,0x0A,0x2F,0x12,  /* 000008E8    "....../." */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x00,  /* 000008F0    "........" */
+    0x00,0x0A,0x11,0x12,0x0B,0x04,0x0C,0xFF,  /* 000008F8    "........" */
+    0xFF,0x08,0x00,0x01,0x00,0x0A,0x12,0x12,  /* 00000900    "........" */
+    0x0C,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,  /* 00000908    "........" */
+    0x02,0x00,0x0A,0x13,0x12,0x0C,0x04,0x0C,  /* 00000910    "........" */
+    0xFF,0xFF,0x08,0x00,0x0A,0x03,0x00,0x0A,  /* 00000918    "........" */
+    0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x09,  /* 00000920    "........" */
+    0x00,0x00,0x00,0x0A,0x15,0x12,0x0B,0x04,  /* 00000928    "........" */
+    0x0C,0xFF,0xFF,0x09,0x00,0x01,0x00,0x0A,  /* 00000930    "........" */
+    0x16,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x09,  /* 00000938    "........" */
+    0x00,0x0A,0x02,0x00,0x0A,0x17,0x12,0x0C,  /* 00000940    "........" */
+    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,  /* 00000948    "........" */
+    0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000950    "........" */
+    0xFF,0x0A,0x00,0x00,0x00,0x0A,0x19,0x12,  /* 00000958    "........" */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x01,  /* 00000960    "........" */
+    0x00,0x0A,0x1A,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000968    "........" */
+    0xFF,0x0A,0x00,0x0A,0x02,0x00,0x0A,0x1B,  /* 00000970    "........" */
+    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000978    "........" */
+    0x0A,0x03,0x00,0x0A,0x1C,0x12,0x0B,0x04,  /* 00000980    "........" */
+    0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x00,0x0A,  /* 00000988    "........" */
+    0x1D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0B,  /* 00000990    "........" */
+    0x00,0x01,0x00,0x0A,0x1E,0x12,0x0C,0x04,  /* 00000998    "........" */
+    0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x02,0x00,  /* 000009A0    "........" */
+    0x0A,0x1F,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 000009A8    "........" */
+    0x0B,0x00,0x0A,0x03,0x00,0x0A,0x20,0x12,  /* 000009B0    "...... ." */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x00,  /* 000009B8    "........" */
+    0x00,0x0A,0x21,0x12,0x0B,0x04,0x0C,0xFF,  /* 000009C0    "..!....." */
+    0xFF,0x0C,0x00,0x01,0x00,0x0A,0x22,0x12,  /* 000009C8    "......"." */
+    0x0C,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,  /* 000009D0    "........" */
+    0x02,0x00,0x0A,0x23,0x12,0x0C,0x04,0x0C,  /* 000009D8    "...#...." */
+    0xFF,0xFF,0x0C,0x00,0x0A,0x03,0x00,0x0A,  /* 000009E0    "........" */
+    0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0D,  /* 000009E8    "$......." */
+    0x00,0x00,0x00,0x0A,0x25,0x12,0x0B,0x04,  /* 000009F0    "....%..." */
+    0x0C,0xFF,0xFF,0x0D,0x00,0x01,0x00,0x0A,  /* 000009F8    "........" */
+    0x26,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0D,  /* 00000A00    "&......." */
+    0x00,0x0A,0x02,0x00,0x0A,0x27,0x12,0x0C,  /* 00000A08    ".....'.." */
+    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,  /* 00000A10    "........" */
+    0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000A18    "..(....." */
+    0xFF,0x0E,0x00,0x00,0x00,0x0A,0x29,0x12,  /* 00000A20    "......)." */
+    0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x01,  /* 00000A28    "........" */
+    0x00,0x0A,0x2A,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000A30    "..*....." */
+    0xFF,0x0E,0x00,0x0A,0x02,0x00,0x0A,0x2B,  /* 00000A38    ".......+" */
+    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000A40    "........" */
+    0x0A,0x03,0x00,0x0A,0x2C,0x12,0x0B,0x04,  /* 00000A48    "....,..." */
+    0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x0A,  /* 00000A50    "........" */
+    0x2D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0F,  /* 00000A58    "-......." */
+    0x00,0x01,0x00,0x0A,0x2E,0x12,0x0C,0x04,  /* 00000A60    "........" */
+    0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x02,0x00,  /* 00000A68    "........" */
+    0x0A,0x2F,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000A70    "./......" */
+    0x0F,0x00,0x0A,0x03,0x00,0x0A,0x10,0x5B,  /* 00000A78    ".......[" */
+    0x82,0x4C,0x31,0x49,0x53,0x41,0x5F,0x08,  /* 00000A80    ".L1ISA_." */
+    0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,0x01,  /* 00000A88    "_ADR...." */
+    0x00,0x5B,0x80,0x50,0x49,0x52,0x51,0x02,  /* 00000A90    ".[.PIRQ." */
+    0x0A,0x60,0x0A,0x04,0x10,0x2E,0x5C,0x00,  /* 00000A98    ".`....\." */
+    0x5B,0x81,0x29,0x5C,0x2F,0x04,0x5F,0x53,  /* 00000AA0    "[.)\/._S" */
+    0x42,0x5F,0x50,0x43,0x49,0x30,0x49,0x53,  /* 00000AA8    "B_PCI0IS" */
+    0x41,0x5F,0x50,0x49,0x52,0x51,0x01,0x50,  /* 00000AB0    "A_PIRQ.P" */
+    0x49,0x52,0x41,0x08,0x50,0x49,0x52,0x42,  /* 00000AB8    "IRA.PIRB" */
+    0x08,0x50,0x49,0x52,0x43,0x08,0x50,0x49,  /* 00000AC0    ".PIRC.PI" */
+    0x52,0x44,0x08,0x5B,0x82,0x46,0x0B,0x53,  /* 00000AC8    "RD.[.F.S" */
+    0x59,0x53,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000AD0    "YSR._HID" */
+    0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55,  /* 00000AD8    ".A...._U" */
+    0x49,0x44,0x01,0x08,0x43,0x52,0x53,0x5F,  /* 00000AE0    "ID..CRS_" */
+    0x11,0x4E,0x08,0x0A,0x8A,0x47,0x01,0x10,  /* 00000AE8    ".N...G.." */
+    0x00,0x10,0x00,0x00,0x10,0x47,0x01,0x22,  /* 00000AF0    ".....G."" */
+    0x00,0x22,0x00,0x00,0x0C,0x47,0x01,0x30,  /* 00000AF8    "."...G.0" */
+    0x00,0x30,0x00,0x00,0x10,0x47,0x01,0x44,  /* 00000B00    ".0...G.D" */
+    0x00,0x44,0x00,0x00,0x1C,0x47,0x01,0x62,  /* 00000B08    ".D...G.b" */
+    0x00,0x62,0x00,0x00,0x02,0x47,0x01,0x65,  /* 00000B10    ".b...G.e" */
+    0x00,0x65,0x00,0x00,0x0B,0x47,0x01,0x72,  /* 00000B18    ".e...G.r" */
+    0x00,0x72,0x00,0x00,0x0E,0x47,0x01,0x80,  /* 00000B20    ".r...G.." */
+    0x00,0x80,0x00,0x00,0x01,0x47,0x01,0x84,  /* 00000B28    ".....G.." */
+    0x00,0x84,0x00,0x00,0x03,0x47,0x01,0x88,  /* 00000B30    ".....G.." */
+    0x00,0x88,0x00,0x00,0x01,0x47,0x01,0x8C,  /* 00000B38    ".....G.." */
+    0x00,0x8C,0x00,0x00,0x03,0x47,0x01,0x90,  /* 00000B40    ".....G.." */
+    0x00,0x90,0x00,0x00,0x10,0x47,0x01,0xA2,  /* 00000B48    ".....G.." */
+    0x00,0xA2,0x00,0x00,0x1C,0x47,0x01,0xE0,  /* 00000B50    ".....G.." */
+    0x00,0xE0,0x00,0x00,0x10,0x47,0x01,0xA0,  /* 00000B58    ".....G.." */
+    0x08,0xA0,0x08,0x00,0x04,0x47,0x01,0xC0,  /* 00000B60    ".....G.." */
+    0x0C,0xC0,0x0C,0x00,0x10,0x47,0x01,0xD0,  /* 00000B68    ".....G.." */
+    0x04,0xD0,0x04,0x00,0x02,0x79,0x00,0x14,  /* 00000B70    ".....y.." */
+    0x0B,0x5F,0x43,0x52,0x53,0x00,0xA4,0x43,  /* 00000B78    "._CRS..C" */
+    0x52,0x53,0x5F,0x5B,0x82,0x2B,0x50,0x49,  /* 00000B80    "RS_[.+PI" */
+    0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,0x0B,  /* 00000B88    "C_._HID." */
+    0x41,0xD0,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000B90    "A.._CRS." */
+    0x18,0x0A,0x15,0x47,0x01,0x20,0x00,0x20,  /* 00000B98    "...G. . " */
+    0x00,0x01,0x02,0x47,0x01,0xA0,0x00,0xA0,  /* 00000BA0    "...G...." */
+    0x00,0x01,0x02,0x22,0x04,0x00,0x79,0x00,  /* 00000BA8    "..."..y." */
+    0x5B,0x82,0x47,0x05,0x44,0x4D,0x41,0x30,  /* 00000BB0    "[.G.DMA0" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000BB8    "._HID.A." */
+    0x02,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000BC0    "..._CRS." */
+    0x41,0x04,0x0A,0x3D,0x2A,0x10,0x04,0x47,  /* 00000BC8    "A..=*..G" */
+    0x01,0x00,0x00,0x00,0x00,0x00,0x10,0x47,  /* 00000BD0    ".......G" */
+    0x01,0x81,0x00,0x81,0x00,0x00,0x03,0x47,  /* 00000BD8    ".......G" */
+    0x01,0x87,0x00,0x87,0x00,0x00,0x01,0x47,  /* 00000BE0    ".......G" */
+    0x01,0x89,0x00,0x89,0x00,0x00,0x03,0x47,  /* 00000BE8    ".......G" */
+    0x01,0x8F,0x00,0x8F,0x00,0x00,0x01,0x47,  /* 00000BF0    ".......G" */
+    0x01,0xC0,0x00,0xC0,0x00,0x00,0x20,0x47,  /* 00000BF8    "...... G" */
+    0x01,0x80,0x04,0x80,0x04,0x00,0x10,0x79,  /* 00000C00    ".......y" */
+    0x00,0x5B,0x82,0x25,0x54,0x4D,0x52,0x5F,  /* 00000C08    ".[.%TMR_" */
+    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000C10    "._HID.A." */
+    0x01,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000C18    "..._CRS." */
+    0x10,0x0A,0x0D,0x47,0x01,0x40,0x00,0x40,  /* 00000C20    "...G.@.@" */
+    0x00,0x00,0x04,0x22,0x01,0x00,0x79,0x00,  /* 00000C28    "..."..y." */
+    0x5B,0x82,0x25,0x52,0x54,0x43,0x5F,0x08,  /* 00000C30    "[.%RTC_." */
+    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B,  /* 00000C38    "_HID.A.." */
+    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x10,  /* 00000C40    ".._CRS.." */
+    0x0A,0x0D,0x47,0x01,0x70,0x00,0x70,0x00,  /* 00000C48    "..G.p.p." */
+    0x00,0x02,0x22,0x00,0x01,0x79,0x00,0x5B,  /* 00000C50    ".."..y.[" */
+    0x82,0x22,0x53,0x50,0x4B,0x52,0x08,0x5F,  /* 00000C58    "."SPKR._" */
+    0x48,0x49,0x44,0x0C,0x41,0xD0,0x08,0x00,  /* 00000C60    "HID.A..." */
+    0x08,0x5F,0x43,0x52,0x53,0x11,0x0D,0x0A,  /* 00000C68    "._CRS..." */
+    0x0A,0x47,0x01,0x61,0x00,0x61,0x00,0x00,  /* 00000C70    ".G.a.a.." */
+    0x01,0x79,0x00,0x5B,0x82,0x31,0x50,0x53,  /* 00000C78    ".y.[.1PS" */
+    0x32,0x4D,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000C80    "2M._HID." */
+    0x41,0xD0,0x0F,0x13,0x08,0x5F,0x43,0x49,  /* 00000C88    "A...._CI" */
+    0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09,  /* 00000C90    "D.A....." */
+    0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,  /* 00000C98    "_STA...." */
+    0x08,0x5F,0x43,0x52,0x53,0x11,0x08,0x0A,  /* 00000CA0    "._CRS..." */
+    0x05,0x22,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000CA8    "."..y.[." */
+    0x42,0x04,0x50,0x53,0x32,0x4B,0x08,0x5F,  /* 00000CB0    "B.PS2K._" */
+    0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,0x03,  /* 00000CB8    "HID.A..." */
+    0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,0xD0,  /* 00000CC0    "._CID.A." */
+    0x03,0x0B,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000CC8    "...._STA" */
+    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000CD0    "....._CR" */
+    0x53,0x11,0x18,0x0A,0x15,0x47,0x01,0x60,  /* 00000CD8    "S....G.`" */
+    0x00,0x60,0x00,0x00,0x01,0x47,0x01,0x64,  /* 00000CE0    ".`...G.d" */
+    0x00,0x64,0x00,0x00,0x01,0x22,0x02,0x00,  /* 00000CE8    ".d...".." */
+    0x79,0x00,0x5B,0x82,0x3A,0x46,0x44,0x43,  /* 00000CF0    "y.[.:FDC" */
+    0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000CF8    "0._HID.A" */
+    0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,0x54,  /* 00000D00    "....._ST" */
+    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000D08    "A....._C" */
+    0x52,0x53,0x11,0x1B,0x0A,0x18,0x47,0x01,  /* 00000D10    "RS....G." */
+    0xF0,0x03,0xF0,0x03,0x01,0x06,0x47,0x01,  /* 00000D18    "......G." */
+    0xF7,0x03,0xF7,0x03,0x01,0x01,0x22,0x40,  /* 00000D20    "......"@" */
+    0x00,0x2A,0x04,0x00,0x79,0x00,0x5B,0x82,  /* 00000D28    ".*..y.[." */
+    0x35,0x55,0x41,0x52,0x31,0x08,0x5F,0x48,  /* 00000D30    "5UAR1._H" */
+    0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08,  /* 00000D38    "ID.A...." */
+    0x5F,0x55,0x49,0x44,0x01,0x14,0x09,0x5F,  /* 00000D40    "_UID..._" */
+    0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,  /* 00000D48    "STA....." */
+    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000D50    "_CRS...." */
+    0x47,0x01,0xF8,0x03,0xF8,0x03,0x01,0x08,  /* 00000D58    "G......." */
+    0x22,0x10,0x00,0x79,0x00,0x5B,0x82,0x36,  /* 00000D60    ""..y.[.6" */
+    0x4C,0x54,0x50,0x31,0x08,0x5F,0x48,0x49,  /* 00000D68    "LTP1._HI" */
+    0x44,0x0C,0x41,0xD0,0x04,0x00,0x08,0x5F,  /* 00000D70    "D.A...._" */
+    0x55,0x49,0x44,0x0A,0x02,0x14,0x09,0x5F,  /* 00000D78    "UID...._" */
+    0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,  /* 00000D80    "STA....." */
+    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000D88    "_CRS...." */
+    0x47,0x01,0x78,0x03,0x78,0x03,0x08,0x08,  /* 00000D90    "G.x.x..." */
+    0x22,0x80,0x00,0x79,0x00,
 };
 int DsdtLen=sizeof(AmlCode);
diff -r 2fd223c64fc6 -r cd40792968cb 
tools/firmware/hvmloader/acpi/static_tables.c
--- a/tools/firmware/hvmloader/acpi/static_tables.c     Thu Nov 23 17:46:52 
2006 +0000
+++ b/tools/firmware/hvmloader/acpi/static_tables.c     Thu Nov 23 17:54:06 
2006 +0000
@@ -40,6 +40,37 @@ struct acpi_20_madt Madt = {
         .flags      = ACPI_PCAT_COMPAT
     },
 
+    .intsrcovr = {
+        [0] = {
+            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
+            .length = sizeof(struct acpi_20_madt_intsrcovr),
+            .source = 5,
+            .gsi    = 5,
+            .flags  = 0xf /* PCI: active-low level-triggered */
+        },
+        [1] = {
+            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
+            .length = sizeof(struct acpi_20_madt_intsrcovr),
+            .source = 6,
+            .gsi    = 6,
+            .flags  = 0xf /* PCI: active-low level-triggered */
+        },
+        [2] = {
+            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
+            .length = sizeof(struct acpi_20_madt_intsrcovr),
+            .source = 10,
+            .gsi    = 10,
+            .flags  = 0xf /* PCI: active-low level-triggered */
+        },
+        [3] = {
+            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
+            .length = sizeof(struct acpi_20_madt_intsrcovr),
+            .source = 11,
+            .gsi    = 11,
+            .flags  = 0xf /* PCI: active-low level-triggered */
+        }
+    },
+
     /* IO APIC */
     .io_apic = {
         [0] = {
@@ -55,7 +86,7 @@ struct acpi_20_madt Madt = {
         [0] = {
             .type   = ACPI_PROCESSOR_LOCAL_APIC,
             .length = sizeof(struct acpi_20_madt_lapic),
-            .flags  = 0x00000001
+            .flags  = ACPI_LOCAL_APIC_ENABLED
         }
     }
 };
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/acpi_madt.c
--- a/tools/firmware/hvmloader/acpi_madt.c      Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/acpi_madt.c      Thu Nov 23 17:54:06 2006 +0000
@@ -35,32 +35,34 @@ static int validate_hvm_info(struct hvm_
     int i;
 
     /* strncmp(t->signature, "HVM INFO", 8) */
-    for (i = 0; i < 8; i++) {
-        if (signature[i] != t->signature[i]) {
-            puts("Bad hvm info signature\n");
+    for ( i = 0; i < 8; i++ )
+    {
+        if ( signature[i] != t->signature[i] )
+        {
+            printf("Bad hvm info signature\n");
             return 0;
         }
     }
 
-    for (i = 0; i < t->length; i++)
+    for ( i = 0; i < t->length; i++ )
         sum += ptr[i];
 
     return (sum == 0);
 }
 
 /* xc_vmx_builder wrote hvm info at 0x9F800. Return it. */
-struct hvm_info_table *
-get_hvm_info_table(void)
+struct hvm_info_table *get_hvm_info_table(void)
 {
     struct hvm_info_table *t;
 
-    if (table != NULL)
+    if ( table != NULL )
         return table;
 
     t = (struct hvm_info_table *)HVM_INFO_PADDR;
 
-    if (!validate_hvm_info(t)) {
-        puts("Bad hvm info table\n");
+    if ( !validate_hvm_info(t) )
+    {
+        printf("Bad hvm info table\n");
         return NULL;
     }
 
@@ -69,15 +71,13 @@ get_hvm_info_table(void)
     return table;
 }
 
-int
-get_vcpu_nr(void)
+int get_vcpu_nr(void)
 {
     struct hvm_info_table *t = get_hvm_info_table();
     return (t ? t->nr_vcpus : 1); /* default 1 vcpu */
 }
 
-int
-get_acpi_enabled(void)
+int get_acpi_enabled(void)
 {
     struct hvm_info_table *t = get_hvm_info_table();
     return (t ? t->acpi_enabled : 0); /* default no acpi */
@@ -91,13 +91,14 @@ acpi_madt_get_madt(unsigned char *acpi_s
     struct acpi_20_madt *madt;
 
     rsdt = acpi_rsdt_get(acpi_start);
-    if (rsdt == NULL)
+    if ( rsdt == NULL )
         return NULL;
 
     madt = (struct acpi_20_madt *)(acpi_start + rsdt->entry[1] -
                                    ACPI_PHYSICAL_ADDRESS);
-    if (madt->header.header.signature != ACPI_2_0_MADT_SIGNATURE) {
-        puts("Bad MADT signature \n");
+    if ( madt->header.header.signature != ACPI_2_0_MADT_SIGNATURE )
+    {
+        printf("Bad MADT signature \n");
         return NULL;
     }
 
@@ -111,10 +112,11 @@ acpi_madt_set_local_apics(
 {
     int i;
 
-    if ((nr_vcpu > MAX_VIRT_CPUS) || (nr_vcpu < 0) || !madt)
+    if ( (nr_vcpu > MAX_VIRT_CPUS) || (nr_vcpu < 0) || !madt )
         return -1;
 
-    for (i = 0; i < nr_vcpu; i++) {
+    for ( i = 0; i < nr_vcpu; i++ )
+    {
         madt->lapic[i].type    = ACPI_PROCESSOR_LOCAL_APIC;
         madt->lapic[i].length  = sizeof(struct acpi_20_madt_lapic);
         madt->lapic[i].acpi_processor_id = i;
@@ -137,11 +139,11 @@ int acpi_madt_update(unsigned char *acpi
     struct acpi_20_madt *madt;
 
     madt = acpi_madt_get_madt(acpi_start);
-    if (!madt)
+    if ( !madt )
         return -1;
 
     rc = acpi_madt_set_local_apics(get_vcpu_nr(), madt);
-    if (rc != 0)
+    if ( rc != 0 )
         return rc;
 
     set_checksum(
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/acpi_utils.c
--- a/tools/firmware/hvmloader/acpi_utils.c     Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/acpi_utils.c     Thu Nov 23 17:54:06 2006 +0000
@@ -78,7 +78,7 @@ static void acpi_tpm_tis_probe(unsigned 
                 sizeof(tis_did_vid_rid)) != 0 )
         return;
 
-    puts("TIS is available\n");
+    printf("TIS is available\n");
     addr = acpi_xsdt_add_entry(acpi_start, freemem, limit,
                                AmlCode_TPM, sizeof(AmlCode_TPM));
     if ( addr == NULL )
@@ -133,7 +133,7 @@ struct acpi_20_rsdt *acpi_rsdt_get(unsig
     rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
     if ( rsdp->signature != ACPI_2_0_RSDP_SIGNATURE )
     {
-        puts("Bad RSDP signature\n");
+        printf("Bad RSDP signature\n");
         return NULL;
     }
 
@@ -141,7 +141,7 @@ struct acpi_20_rsdt *acpi_rsdt_get(unsig
         (acpi_start + rsdp->rsdt_address - ACPI_PHYSICAL_ADDRESS);
     if ( rsdt->header.signature != ACPI_2_0_RSDT_SIGNATURE )
     {
-        puts("Bad RSDT signature\n");
+        printf("Bad RSDT signature\n");
         return NULL;
     }
 
@@ -192,7 +192,7 @@ struct acpi_20_xsdt *acpi_xsdt_get(unsig
     rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
     if ( rsdp->signature != ACPI_2_0_RSDP_SIGNATURE )
     {
-        puts("Bad RSDP signature\n");
+        printf("Bad RSDP signature\n");
         return NULL;
     }
 
@@ -200,7 +200,7 @@ struct acpi_20_xsdt *acpi_xsdt_get(unsig
         (acpi_start + rsdp->xsdt_address - ACPI_PHYSICAL_ADDRESS);
     if ( xsdt->header.signature != ACPI_2_0_XSDT_SIGNATURE )
     {
-        puts("Bad XSDT signature\n");
+        printf("Bad XSDT signature\n");
         return NULL;
     }
     return xsdt;
@@ -270,8 +270,9 @@ static unsigned char *acpi_xsdt_add_entr
     if ( found )
     {
         /* memory below hard limit ? */
-        if (*freemem + table_size <= limit) {
-            puts("Copying SSDT entry!\n");
+        if ( (*freemem + table_size) <= limit )
+        {
+            printf("Copying SSDT entry\n");
             addr = *freemem;
             memcpy(addr, table, table_size);
             *freemem += table_size;
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/config.h
--- a/tools/firmware/hvmloader/config.h Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/config.h Thu Nov 23 17:54:06 2006 +0000
@@ -7,4 +7,7 @@
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
 
+#define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
+#define PCI_ISA_IRQ_MASK    0x0c60U /* ISA IRQs 5,6,10,11 are PCI connected */
+
 #endif /* __HVMLOADER_CONFIG_H__ */
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/hvmloader.c
--- a/tools/firmware/hvmloader/hvmloader.c      Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/hvmloader.c      Thu Nov 23 17:54:06 2006 +0000
@@ -1,12 +1,10 @@
 /*
  * hvmloader.c: HVM ROMBIOS/VGABIOS/ACPI/VMXAssist image loader.
  *
- * A quicky so that we can boot rom images as if they were a Linux kernel.
- * This code will copy the rom images (ROMBIOS/VGABIOS/VM86) into their
- * respective spaces and transfer control to VM86 to execute the BIOSes.
- *
  * Leendert van Doorn, leendert@xxxxxxxxxxxxxx
  * Copyright (c) 2005, International Business Machines Corporation.
+ *
+ * Copyright (c) 2006, Keir Fraser, XenSource Inc.
  *
  * This program is free software; you can redistribute it and/or modify it
  * under the terms and conditions of the GNU General Public License,
@@ -28,8 +26,10 @@
 #include "acpi_utils.h"
 #include "smbios.h"
 #include "config.h"
+#include "pci_regs.h"
 #include <xen/version.h>
 #include <xen/hvm/params.h>
+#include <xen/hvm/e820.h>
 
 /* memory map */
 #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
@@ -125,7 +125,7 @@ init_hypercalls(void)
 {
     uint32_t eax, ebx, ecx, edx;
     unsigned long i;
-    char signature[13], number[13];
+    char signature[13];
     xen_extraversion_t extraversion;
 
     cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
@@ -137,25 +137,19 @@ init_hypercalls(void)
 
     if ( strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002) )
     {
-        puts("FATAL: Xen hypervisor not detected\n");
+        printf("FATAL: Xen hypervisor not detected\n");
         __asm__ __volatile__( "ud2" );
     }
 
-    cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
-
-    puts("Detected Xen v");
-    puts(itoa(number, eax >> 16));
-    puts(".");
-    puts(itoa(number, eax & 0xffff));
-
+    /* Fill in hypercall transfer pages. */
     cpuid(0x40000002, &eax, &ebx, &ecx, &edx);
-
     for ( i = 0; i < eax; i++ )
         wrmsr(ebx, HYPERCALL_PHYSICAL_ADDRESS + (i << 12) + i);
 
+    /* Print version information. */
+    cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
     hypercall_xen_version(XENVER_extraversion, extraversion);
-    puts(extraversion);
-    puts("\n");
+    printf("Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
 }
 
 static void apic_setup(void)
@@ -172,38 +166,157 @@ static void apic_setup(void)
     *iowin    = IOAPIC_ID;
 }
 
+static void pci_setup(void)
+{
+    uint32_t devfn, bar_reg, bar_data, bar_sz, cmd;
+    uint32_t *base, io_base = 0xc000, mem_base = HVM_BELOW_4G_MMIO_START;
+    uint16_t class, vendor_id, device_id;
+    unsigned int bar, pin, link, isa_irq;
+
+    /* Program PCI-ISA bridge with appropriate link routes. */
+    link = 0;
+    for ( isa_irq = 0; isa_irq < 15; isa_irq++ )
+    {
+        if ( !(PCI_ISA_IRQ_MASK & (1U << isa_irq)) )
+            continue;
+        pci_writeb(PCI_ISA_DEVFN, 0x60 + link, isa_irq);
+        printf("PCI-ISA link %u routed to IRQ%u\n", link, isa_irq);
+        if ( link++ == 4 )
+            break;
+    }
+
+    /* Program ELCR to match PCI-wired IRQs. */
+    outb(0x4d0, (uint8_t)(PCI_ISA_IRQ_MASK >> 0));
+    outb(0x4d1, (uint8_t)(PCI_ISA_IRQ_MASK >> 8));
+
+    /* Scan the PCI bus and map resources. */
+    for ( devfn = 0; devfn < 128; devfn++ )
+    {
+        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
+        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
+        device_id = pci_readw(devfn, PCI_DEVICE_ID);
+        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
+            continue;
+
+        ASSERT((devfn != PCI_ISA_DEVFN) ||
+               ((vendor_id == 0x8086) && (device_id == 0x7000)));
+
+        switch ( class )
+        {
+        case 0x0680:
+            ASSERT((vendor_id == 0x8086) && (device_id == 0x7113));
+            /*
+             * PIIX4 ACPI PM. Special device with special PCI config space.
+             * No ordinary BARs.
+             */
+            pci_writew(devfn, 0x20, 0x0000); /* No smb bus IO enable */
+            pci_writew(devfn, 0x22, 0x0000);
+            pci_writew(devfn, 0x3c, 0x0009); /* Hardcoded IRQ9 */
+            pci_writew(devfn, 0x3d, 0x0001);
+            break;
+        case 0x0101:
+            /* PIIX3 IDE */
+            ASSERT((vendor_id == 0x8086) && (device_id == 0x7010));
+            pci_writew(devfn, 0x40, 0x8000); /* enable IDE0 */
+            pci_writew(devfn, 0x42, 0x8000); /* enable IDE1 */
+            /* fall through */
+        default:
+            /* Default memory mappings. */
+            for ( bar = 0; bar < 7; bar++ )
+            {
+                bar_reg = PCI_BASE_ADDRESS_0 + 4*bar;
+                if ( bar == 6 )
+                    bar_reg = PCI_ROM_ADDRESS;
+
+                bar_data = pci_readl(devfn, bar_reg);
+
+                pci_writel(devfn, bar_reg, ~0);
+                bar_sz = pci_readl(devfn, bar_reg);
+                if ( bar_sz == 0 )
+                    continue;
+
+                if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
+                     PCI_BASE_ADDRESS_SPACE_MEMORY )
+                {
+                    base = &mem_base;
+                    bar_sz &= PCI_BASE_ADDRESS_MEM_MASK;
+                    bar_data &= ~PCI_BASE_ADDRESS_MEM_MASK;
+                }
+                else
+                {
+                    base = &io_base;
+                    bar_sz &= PCI_BASE_ADDRESS_IO_MASK & 0xffff;
+                    bar_data &= ~PCI_BASE_ADDRESS_IO_MASK;
+                }
+                bar_sz &= ~(bar_sz - 1);
+
+                *base = (*base + bar_sz - 1) & ~(bar_sz - 1);
+                bar_data |= *base;
+                *base += bar_sz;
+
+                pci_writel(devfn, bar_reg, bar_data);
+                printf("pci dev %02x:%x bar %02x size %08x: %08x\n",
+                       devfn>>3, devfn&7, bar_reg, bar_sz, bar_data);
+
+                /* Now enable the memory or I/O mapping. */
+                cmd = pci_readw(devfn, PCI_COMMAND);
+                if ( (bar_reg == PCI_ROM_ADDRESS) ||
+                     ((bar_data & PCI_BASE_ADDRESS_SPACE) ==
+                      PCI_BASE_ADDRESS_SPACE_MEMORY) )
+                    cmd |= PCI_COMMAND_MEMORY;
+                else
+                    cmd |= PCI_COMMAND_IO;
+                pci_writew(devfn, PCI_COMMAND, cmd);
+            }
+            break;
+        }
+
+        /* Map the interrupt. */
+        pin = pci_readb(devfn, PCI_INTERRUPT_PIN);
+        if ( pin != 0 )
+        {
+            /* This is the barber's pole mapping used by Xen. */
+            link = ((pin - 1) + (devfn >> 3)) & 3;
+            isa_irq = pci_readb(PCI_ISA_DEVFN, 0x60 + link);
+            pci_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);
+            printf("pci dev %02x:%x INT%c->IRQ%u\n",
+                   devfn>>3, devfn&7, 'A'+pin-1, isa_irq);
+        }
+    }
+}
+
 int main(void)
 {
-    puts("HVM Loader\n");
+    printf("HVM Loader\n");
 
     init_hypercalls();
 
-    puts("Writing SMBIOS tables ...\n");
+    printf("Writing SMBIOS tables ...\n");
     hvm_write_smbios_tables();
 
-    puts("Loading ROMBIOS ...\n");
+    printf("Loading ROMBIOS ...\n");
     memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
 
     apic_setup();
-
+    pci_setup();
     create_mp_tables();
 
     if ( cirrus_check() )
     {
-        puts("Loading Cirrus VGABIOS ...\n");
+        printf("Loading Cirrus VGABIOS ...\n");
         memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
                vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
     }
     else
     {
-        puts("Loading Standard VGABIOS ...\n");
+        printf("Loading Standard VGABIOS ...\n");
         memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
                vgabios_stdvga, sizeof(vgabios_stdvga));
     }
 
     if ( get_acpi_enabled() != 0 )
     {
-        puts("Loading ACPI ...\n");
+        printf("Loading ACPI ...\n");
         acpi_madt_update((unsigned char *) acpi);
         if ( (ACPI_PHYSICAL_ADDRESS + sizeof(acpi)) <= 0xF0000 )
         {
@@ -225,23 +338,23 @@ int main(void)
     if ( check_amd() )
     {
         /* AMD implies this is SVM */
-        puts("SVM go ...\n");
+        printf("SVM go ...\n");
         vmmcall(SVM_VMMCALL_RESET_TO_REALMODE, 0, 0, 0, 0, 0);
     }
     else
     {
-        puts("Loading VMXAssist ...\n");
+        printf("Loading VMXAssist ...\n");
         memcpy((void *)VMXASSIST_PHYSICAL_ADDRESS,
                vmxassist, sizeof(vmxassist));
 
-        puts("VMX go ...\n");
+        printf("VMX go ...\n");
         __asm__ __volatile__(
             "jmp *%%eax"
             : : "a" (VMXASSIST_PHYSICAL_ADDRESS), "d" (0)
             );
     }
 
-    puts("Failed to invoke ROMBIOS\n");
+    printf("Failed to invoke ROMBIOS\n");
     return 0;
 }
 
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/mp_tables.c
--- a/tools/firmware/hvmloader/mp_tables.c      Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/mp_tables.c      Thu Nov 23 17:54:06 2006 +0000
@@ -263,10 +263,7 @@ void fill_mp_io_intr_entry(
 {
     mpiie->type = ENTRY_TYPE_IO_INTR;
     mpiie->intr_type = INTR_TYPE_INT;
-    mpiie->io_intr_flags = 0;
-    /* IRQs 10 and 11 are PCI, so level triggered and active low. */
-    if ( (src_bus_irq == 10) || (src_bus_irq == 11) )
-        mpiie->io_intr_flags = 0xf;
+    mpiie->io_intr_flags = (PCI_ISA_IRQ_MASK & (1U<<src_bus_irq)) ? 0xf : 0x0;
     mpiie->src_bus_id = src_bus_id;
     mpiie->src_bus_irq = src_bus_irq;
     mpiie->dst_ioapic_id = ioapic_id;
@@ -349,13 +346,13 @@ void create_mp_tables(void)
 
     vcpu_nr = get_vcpu_nr();
 
-    puts("Creating MP tables ...\n");
+    printf("Creating MP tables ...\n");
 
     /* Find the 'safe' place in ROMBIOS for the MP tables. */
     mp_table_base = get_mp_table_start();
     if ( mp_table_base == NULL )
     {
-        puts("Couldn't find start point for MP tables\n");
+        printf("Couldn't find start point for MP tables\n");
         return;
     }
 
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/smbios.c
--- a/tools/firmware/hvmloader/smbios.c Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/smbios.c Thu Nov 23 17:54:06 2006 +0000
@@ -30,29 +30,29 @@
 
 static size_t
 write_smbios_tables(void *start,
-                   uint32_t vcpus, uint64_t memsize,
-                   uint8_t uuid[16], char *xen_version,
-                   uint32_t xen_major_version, uint32_t xen_minor_version);
+                    uint32_t vcpus, uint64_t memsize,
+                    uint8_t uuid[16], char *xen_version,
+                    uint32_t xen_major_version, uint32_t xen_minor_version);
 
 static void
 get_cpu_manufacturer(char *buf, int len);
 static void
 smbios_entry_point_init(void *start,
-                       uint16_t max_structure_size,
-                       uint16_t structure_table_length,
-                       uint32_t structure_table_address,
-                       uint16_t number_of_structures);
+                        uint16_t max_structure_size,
+                        uint16_t structure_table_length,
+                        uint32_t structure_table_address,
+                        uint16_t number_of_structures);
 static void *
 smbios_type_0_init(void *start, const char *xen_version,
-                  uint32_t xen_major_version, uint32_t xen_minor_version);
+                   uint32_t xen_major_version, uint32_t xen_minor_version);
 static void *
 smbios_type_1_init(void *start, const char *xen_version, 
-                  uint8_t uuid[16]);
+                   uint8_t uuid[16]);
 static void *
 smbios_type_3_init(void *start);
 static void *
 smbios_type_4_init(void *start, unsigned int cpu_number,
-                  char *cpu_manufacturer);
+                   char *cpu_manufacturer);
 static void *
 smbios_type_16_init(void *start, uint32_t memory_size_mb);
 static void *
@@ -69,64 +69,64 @@ static void
 static void
 get_cpu_manufacturer(char *buf, int len)
 {
-       char id[12];
-       uint32_t eax = 0;
-
-       cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
-             (uint32_t *)&id[4]);
-
-       if (memcmp(id, "GenuineIntel", 12) == 0)
-               strncpy(buf, "Intel", len);
-       else if (memcmp(id, "AuthenticAMD", 12) == 0)
-               strncpy(buf, "AMD", len);
-       else
-               strncpy(buf, "unknown", len);
+    char id[12];
+    uint32_t eax = 0;
+
+    cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
+          (uint32_t *)&id[4]);
+
+    if (memcmp(id, "GenuineIntel", 12) == 0)
+        strncpy(buf, "Intel", len);
+    else if (memcmp(id, "AuthenticAMD", 12) == 0)
+        strncpy(buf, "AMD", len);
+    else
+        strncpy(buf, "unknown", len);
 }
 
 static size_t
 write_smbios_tables(void *start,
-                   uint32_t vcpus, uint64_t memsize,
-                   uint8_t uuid[16], char *xen_version,
-                   uint32_t xen_major_version, uint32_t xen_minor_version)
-{
-       unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
-       char *p, *q;
-       char cpu_manufacturer[15];
-
-       get_cpu_manufacturer(cpu_manufacturer, 15);
-
-       p = (char *)start + sizeof(struct smbios_entry_point);
-
-#define do_struct(fn) do {                     \
-       q = (fn);                               \
-       nr_structs++;                           \
-       if ((q - p) > max_struct_size)          \
-               max_struct_size = q - p;        \
-       p = q;                                  \
+                    uint32_t vcpus, uint64_t memsize,
+                    uint8_t uuid[16], char *xen_version,
+                    uint32_t xen_major_version, uint32_t xen_minor_version)
+{
+    unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
+    char *p, *q;
+    char cpu_manufacturer[15];
+
+    get_cpu_manufacturer(cpu_manufacturer, 15);
+
+    p = (char *)start + sizeof(struct smbios_entry_point);
+
+#define do_struct(fn) do {                      \
+    q = (fn);                                   \
+    nr_structs++;                               \
+    if ( (q - p) > max_struct_size )            \
+        max_struct_size = q - p;                \
+    p = q;                                      \
 } while (0)
 
-       do_struct(smbios_type_0_init(p, xen_version, xen_major_version,
-                                    xen_minor_version));
-       do_struct(smbios_type_1_init(p, xen_version, uuid));
-       do_struct(smbios_type_3_init(p));
-       for (cpu_num = 1; cpu_num <= vcpus; cpu_num++)
-               do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
-       do_struct(smbios_type_16_init(p, memsize));
-       do_struct(smbios_type_17_init(p, memsize));
-       do_struct(smbios_type_19_init(p, memsize));
-       do_struct(smbios_type_20_init(p, memsize));
-       do_struct(smbios_type_32_init(p));
-       do_struct(smbios_type_127_init(p));
+    do_struct(smbios_type_0_init(p, xen_version, xen_major_version,
+                                 xen_minor_version));
+    do_struct(smbios_type_1_init(p, xen_version, uuid));
+    do_struct(smbios_type_3_init(p));
+    for ( cpu_num = 1; cpu_num <= vcpus; cpu_num++ )
+        do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
+    do_struct(smbios_type_16_init(p, memsize));
+    do_struct(smbios_type_17_init(p, memsize));
+    do_struct(smbios_type_19_init(p, memsize));
+    do_struct(smbios_type_20_init(p, memsize));
+    do_struct(smbios_type_32_init(p));
+    do_struct(smbios_type_127_init(p));
 
 #undef do_struct
 
-       smbios_entry_point_init(
-               start, max_struct_size,
-               (p - (char *)start) - sizeof(struct smbios_entry_point),
-               SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
-               nr_structs);
-
-       return (size_t)((char *)p - (char *)start);
+    smbios_entry_point_init(
+        start, max_struct_size,
+        (p - (char *)start) - sizeof(struct smbios_entry_point),
+        SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
+        nr_structs);
+
+    return (size_t)((char *)p - (char *)start);
 }
 
 /* This tries to figure out how much pseudo-physical memory (in MB)
@@ -142,428 +142,439 @@ static uint64_t
 static uint64_t
 get_memsize(void)
 {
-       struct e820entry *map = NULL;
-       uint8_t num_entries = 0;
-       uint64_t memsize = 0;
-       uint8_t i;
-
-       map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
-       num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
-
-       /* walk through e820map, ignoring any entries that aren't marked
-          as usable or reserved. */
-
-       for (i = 0; i < num_entries; i++) {
-               if (map->type == E820_RAM || map->type == E820_RESERVED)
-                       memsize += map->size;
-               map++;
-       }
-
-       /* Round up to the nearest MB.  The user specifies domU
-          pseudo-physical memory in megabytes, so not doing this
-          could easily lead to reporting one less MB than the user
-          specified. */
-       if (memsize & ((1<<20)-1))
-               memsize = (memsize >> 20) + 1;
-       else
-               memsize = (memsize >> 20);
-
-       return memsize;
+    struct e820entry *map = NULL;
+    uint8_t num_entries = 0;
+    uint64_t memsize = 0;
+    uint8_t i;
+
+    map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
+    num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
+
+    /* walk through e820map, ignoring any entries that aren't marked
+       as usable or reserved. */
+
+    for ( i = 0; i < num_entries; i++ )
+    {
+        if (map->type == E820_RAM || map->type == E820_RESERVED)
+            memsize += map->size;
+        map++;
+    }
+
+    /* Round up to the nearest MB.  The user specifies domU
+       pseudo-physical memory in megabytes, so not doing this
+       could easily lead to reporting one less MB than the user
+       specified. */
+    if ( memsize & ((1<<20)-1) )
+        memsize = (memsize >> 20) + 1;
+    else
+        memsize = (memsize >> 20);
+
+    return memsize;
 }
 
 void
 hvm_write_smbios_tables(void)
 {
-       uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
-                            not uint8_t[16]. ** */
-       uint16_t xen_major_version, xen_minor_version;
-       uint32_t xen_version;
-       char xen_extra_version[XEN_EXTRAVERSION_LEN];
-       /* guess conservatively on buffer length for Xen version string */
-       char xen_version_str[80];
-       /* temporary variables used to build up Xen version string */
-       char *p = NULL; /* points to next point of insertion */
-       unsigned len = 0; /* length of string already composed */
-       char *tmp = NULL; /* holds result of itoa() */
-       unsigned tmp_len; /* length of next string to add */
-
-       hypercall_xen_version(XENVER_guest_handle, uuid);
-
-       /* xen_version major and minor */
-       xen_version = hypercall_xen_version(XENVER_version, NULL);
-       xen_major_version = (uint16_t) (xen_version >> 16);
-       xen_minor_version = (uint16_t) xen_version;
-
-       hypercall_xen_version(XENVER_extraversion, xen_extra_version);
-
-       /* build up human-readable Xen version string */
-       p = xen_version_str;
-       len = 0;
-
-       itoa(tmp, xen_major_version);
-       tmp_len = strlen(tmp);
-       len += tmp_len;
-       if (len >= sizeof(xen_version_str))
-               goto error_out;
-       strcpy(p, tmp);
-       p += tmp_len;
-
-       len++;
-       if (len >= sizeof(xen_version_str))
-               goto error_out;
-       *p = '.';
-       p++;
-
-       itoa(tmp, xen_minor_version);
-       tmp_len = strlen(tmp);
-       len += tmp_len;
-       if (len >= sizeof(xen_version_str))
-               goto error_out;
-       strcpy(p, tmp);
-       p += tmp_len;
-
-       tmp_len = strlen(xen_extra_version);
-       len += tmp_len;
-       if (len >= sizeof(xen_version_str))
-               goto error_out;
-       strcpy(p, xen_extra_version);
-       p += tmp_len;
-
-       xen_version_str[sizeof(xen_version_str)-1] = '\0';
-
-       /* NB. 0xC0000 is a safe large memory area for scratch. */
-       len = write_smbios_tables((void *)0xC0000,
-                                 get_vcpu_nr(), get_memsize(),
-                                 uuid, xen_version_str,
-                                 xen_major_version, xen_minor_version);
-       if (len > SMBIOS_SIZE_LIMIT)
-               goto error_out;
-       /* Okay, not too large: copy out of scratch to final location. */
-       memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
-
-       return;
+    uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
+                         not uint8_t[16]. ** */
+    uint16_t xen_major_version, xen_minor_version;
+    uint32_t xen_version;
+    char xen_extra_version[XEN_EXTRAVERSION_LEN];
+    /* guess conservatively on buffer length for Xen version string */
+    char xen_version_str[80];
+    /* temporary variables used to build up Xen version string */
+    char *p = NULL; /* points to next point of insertion */
+    unsigned len = 0; /* length of string already composed */
+    char *tmp = NULL; /* holds result of itoa() */
+    unsigned tmp_len; /* length of next string to add */
+
+    hypercall_xen_version(XENVER_guest_handle, uuid);
+
+    /* xen_version major and minor */
+    xen_version = hypercall_xen_version(XENVER_version, NULL);
+    xen_major_version = (uint16_t) (xen_version >> 16);
+    xen_minor_version = (uint16_t) xen_version;
+
+    hypercall_xen_version(XENVER_extraversion, xen_extra_version);
+
+    /* build up human-readable Xen version string */
+    p = xen_version_str;
+    len = 0;
+
+    itoa(tmp, xen_major_version);
+    tmp_len = strlen(tmp);
+    len += tmp_len;
+    if ( len >= sizeof(xen_version_str) )
+        goto error_out;
+    strcpy(p, tmp);
+    p += tmp_len;
+
+    len++;
+    if ( len >= sizeof(xen_version_str) )
+        goto error_out;
+    *p = '.';
+    p++;
+
+    itoa(tmp, xen_minor_version);
+    tmp_len = strlen(tmp);
+    len += tmp_len;
+    if ( len >= sizeof(xen_version_str) )
+        goto error_out;
+    strcpy(p, tmp);
+    p += tmp_len;
+
+    tmp_len = strlen(xen_extra_version);
+    len += tmp_len;
+    if ( len >= sizeof(xen_version_str) )
+        goto error_out;
+    strcpy(p, xen_extra_version);
+    p += tmp_len;
+
+    xen_version_str[sizeof(xen_version_str)-1] = '\0';
+
+    /* NB. 0xC0000 is a safe large memory area for scratch. */
+    len = write_smbios_tables((void *)0xC0000,
+                              get_vcpu_nr(), get_memsize(),
+                              uuid, xen_version_str,
+                              xen_major_version, xen_minor_version);
+    if ( len > SMBIOS_SIZE_LIMIT )
+        goto error_out;
+    /* Okay, not too large: copy out of scratch to final location. */
+    memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
+
+    return;
 
  error_out:
-       puts("Could not write SMBIOS tables, error in hvmloader.c:"
-            "hvm_write_smbios_tables()\n");
+    printf("Could not write SMBIOS tables, error in hvmloader.c:"
+           "hvm_write_smbios_tables()\n");
 }
 
 
 static void
 smbios_entry_point_init(void *start,
-                       uint16_t max_structure_size,
-                       uint16_t structure_table_length,
-                       uint32_t structure_table_address,
-                       uint16_t number_of_structures)
-{
-       uint8_t sum;
-       int i;
-       struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
-
-       strncpy(ep->anchor_string, "_SM_", 4);
-       ep->length = 0x1f;
-       ep->smbios_major_version = 2;
-       ep->smbios_minor_version = 4;
-       ep->max_structure_size = max_structure_size;
-       ep->entry_point_revision = 0;
-       memset(ep->formatted_area, 0, 5);
-       strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
-    
-       ep->structure_table_length = structure_table_length;
-       ep->structure_table_address = structure_table_address;
-       ep->number_of_structures = number_of_structures;
-       ep->smbios_bcd_revision = 0x24;
-
-       ep->checksum = 0;
-       ep->intermediate_checksum = 0;
-    
-       sum = 0;
-       for (i = 0; i < 0x10; ++i)
-               sum += ((int8_t *)start)[i];
-       ep->checksum = -sum;
-
-       sum = 0;
-       for (i = 0x10; i < ep->length; ++i)
-               sum += ((int8_t *)start)[i];
-       ep->intermediate_checksum = -sum;
+                        uint16_t max_structure_size,
+                        uint16_t structure_table_length,
+                        uint32_t structure_table_address,
+                        uint16_t number_of_structures)
+{
+    uint8_t sum;
+    int i;
+    struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
+
+    strncpy(ep->anchor_string, "_SM_", 4);
+    ep->length = 0x1f;
+    ep->smbios_major_version = 2;
+    ep->smbios_minor_version = 4;
+    ep->max_structure_size = max_structure_size;
+    ep->entry_point_revision = 0;
+    memset(ep->formatted_area, 0, 5);
+    strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
+    
+    ep->structure_table_length = structure_table_length;
+    ep->structure_table_address = structure_table_address;
+    ep->number_of_structures = number_of_structures;
+    ep->smbios_bcd_revision = 0x24;
+
+    ep->checksum = 0;
+    ep->intermediate_checksum = 0;
+    
+    sum = 0;
+    for ( i = 0; i < 0x10; i++ )
+        sum += ((int8_t *)start)[i];
+    ep->checksum = -sum;
+
+    sum = 0;
+    for ( i = 0x10; i < ep->length; i++ )
+        sum += ((int8_t *)start)[i];
+    ep->intermediate_checksum = -sum;
 }
 
 /* Type 0 -- BIOS Information */
 static void *
 smbios_type_0_init(void *start, const char *xen_version,
-                  uint32_t xen_major_version, uint32_t xen_minor_version)
-{
-       struct smbios_type_0 *p = (struct smbios_type_0 *)start;
-    
-       p->header.type = 0;
-       p->header.length = sizeof(struct smbios_type_0);
-       p->header.handle = 0;
-    
-       p->vendor_str = 1;
-       p->version_str = 2;
-       p->starting_address_segment = 0xe800;
-       p->release_date_str = 0;
-       p->rom_size = 0;
-    
-       memset(p->characteristics, 0, 8);
-       p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
-       p->characteristics_extension_bytes[0] = 0;
-       p->characteristics_extension_bytes[1] = 0;
-    
-       p->major_release = (uint8_t) xen_major_version;
-       p->minor_release = (uint8_t) xen_minor_version;
-       p->embedded_controller_major = 0xff;
-       p->embedded_controller_minor = 0xff;
-
-       start += sizeof(struct smbios_type_0);
-       strcpy((char *)start, "Xen");
-       start += strlen("Xen") + 1;
-       strcpy((char *)start, xen_version);
-       start += strlen(xen_version) + 1;
-
-       *((uint8_t *)start) = 0;
-       return start + 1;
+                   uint32_t xen_major_version, uint32_t xen_minor_version)
+{
+    struct smbios_type_0 *p = (struct smbios_type_0 *)start;
+    
+    p->header.type = 0;
+    p->header.length = sizeof(struct smbios_type_0);
+    p->header.handle = 0;
+    
+    p->vendor_str = 1;
+    p->version_str = 2;
+    p->starting_address_segment = 0xe800;
+    p->release_date_str = 0;
+    p->rom_size = 0;
+    
+    memset(p->characteristics, 0, 8);
+    p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
+    p->characteristics_extension_bytes[0] = 0;
+    p->characteristics_extension_bytes[1] = 0;
+    
+    p->major_release = (uint8_t) xen_major_version;
+    p->minor_release = (uint8_t) xen_minor_version;
+    p->embedded_controller_major = 0xff;
+    p->embedded_controller_minor = 0xff;
+
+    start += sizeof(struct smbios_type_0);
+    strcpy((char *)start, "Xen");
+    start += strlen("Xen") + 1;
+    strcpy((char *)start, xen_version);
+    start += strlen(xen_version) + 1;
+
+    *((uint8_t *)start) = 0;
+    return start + 1;
 }
 
 /* Type 1 -- System Information */
 static void *
 smbios_type_1_init(void *start, const char *xen_version, 
-                  uint8_t uuid[16])
-{
-       char uuid_str[37];
-       struct smbios_type_1 *p = (struct smbios_type_1 *)start;
-       p->header.type = 1;
-       p->header.length = sizeof(struct smbios_type_1);
-       p->header.handle = 0x100;
-
-       p->manufacturer_str = 1;
-       p->product_name_str = 2;
-       p->version_str = 3;
-       p->serial_number_str = 4;
-    
-       memcpy(p->uuid, uuid, 16);
-
-       p->wake_up_type = 0x06; /* power switch */
-       p->sku_str = 0;
-       p->family_str = 0;
-
-       start += sizeof(struct smbios_type_1);
-    
-       strcpy((char *)start, "Xen");
-       start += strlen("Xen") + 1;
-       strcpy((char *)start, "HVM domU");
-       start += strlen("HVM domU") + 1;
-       strcpy((char *)start, xen_version);
-       start += strlen(xen_version) + 1;
-       uuid_to_string(uuid_str, uuid); 
-       strcpy((char *)start, uuid_str);
-       start += strlen(uuid_str) + 1;
-       *((uint8_t *)start) = 0;
-    
-       return start+1; 
+                   uint8_t uuid[16])
+{
+    char uuid_str[37];
+    struct smbios_type_1 *p = (struct smbios_type_1 *)start;
+    p->header.type = 1;
+    p->header.length = sizeof(struct smbios_type_1);
+    p->header.handle = 0x100;
+
+    p->manufacturer_str = 1;
+    p->product_name_str = 2;
+    p->version_str = 3;
+    p->serial_number_str = 4;
+    
+    memcpy(p->uuid, uuid, 16);
+
+    p->wake_up_type = 0x06; /* power switch */
+    p->sku_str = 0;
+    p->family_str = 0;
+
+    start += sizeof(struct smbios_type_1);
+    
+    strcpy((char *)start, "Xen");
+    start += strlen("Xen") + 1;
+    strcpy((char *)start, "HVM domU");
+    start += strlen("HVM domU") + 1;
+    strcpy((char *)start, xen_version);
+    start += strlen(xen_version) + 1;
+    uuid_to_string(uuid_str, uuid); 
+    strcpy((char *)start, uuid_str);
+    start += strlen(uuid_str) + 1;
+    *((uint8_t *)start) = 0;
+    
+    return start+1; 
 }
 
 /* Type 3 -- System Enclosure */
 static void *
 smbios_type_3_init(void *start)
 {
-       struct smbios_type_3 *p = (struct smbios_type_3 *)start;
-    
-       p->header.type = 3;
-       p->header.length = sizeof(struct smbios_type_3);
-       p->header.handle = 0x300;
-
-       p->manufacturer_str = 1;
-       p->type = 0x01; /* other */
-       p->version_str = 0;
-       p->serial_number_str = 0;
-       p->asset_tag_str = 0;
-       p->boot_up_state = 0x03; /* safe */
-       p->power_supply_state = 0x03; /* safe */
-       p->thermal_state = 0x03; /* safe */
-       p->security_status = 0x02; /* unknown */
-
-       start += sizeof(struct smbios_type_3);
-    
-       strcpy((char *)start, "Xen");
-       start += strlen("Xen") + 1;
-       *((uint8_t *)start) = 0;
-       return start+1;
+    struct smbios_type_3 *p = (struct smbios_type_3 *)start;
+    
+    p->header.type = 3;
+    p->header.length = sizeof(struct smbios_type_3);
+    p->header.handle = 0x300;
+
+    p->manufacturer_str = 1;
+    p->type = 0x01; /* other */
+    p->version_str = 0;
+    p->serial_number_str = 0;
+    p->asset_tag_str = 0;
+    p->boot_up_state = 0x03; /* safe */
+    p->power_supply_state = 0x03; /* safe */
+    p->thermal_state = 0x03; /* safe */
+    p->security_status = 0x02; /* unknown */
+
+    start += sizeof(struct smbios_type_3);
+    
+    strcpy((char *)start, "Xen");
+    start += strlen("Xen") + 1;
+    *((uint8_t *)start) = 0;
+    return start+1;
 }
 
 /* Type 4 -- Processor Information */
 static void *
 smbios_type_4_init(void *start, unsigned int cpu_number, char 
*cpu_manufacturer)
 {
-       char buf[80]; 
-       struct smbios_type_4 *p = (struct smbios_type_4 *)start;
-       uint32_t eax, ebx, ecx, edx;
-
-       p->header.type = 4;
-       p->header.length = sizeof(struct smbios_type_4);
-       p->header.handle = 0x400 + cpu_number;
-
-       p->socket_designation_str = 1;
-       p->processor_type = 0x03; /* CPU */
-       p->processor_family = 0x01; /* other */
-       p->manufacturer_str = 2;
-
-       cpuid(1, &eax, &ebx, &ecx, &edx);
-
-       p->cpuid[0] = eax;
-       p->cpuid[1] = edx;
-
-       p->version_str = 0;
-       p->voltage = 0;
-       p->external_clock = 0;
-
-       p->max_speed = 0; /* unknown */
-       p->current_speed = 0; /* unknown */
-
-       p->status = 0x41; /* socket populated, CPU enabled */
-       p->upgrade = 0x01; /* other */
-
-       start += sizeof(struct smbios_type_4);
-
-       strncpy(buf, "CPU ", sizeof(buf));
-       if ((sizeof(buf) - strlen("CPU ")) >= 3)
-               itoa(buf + strlen("CPU "), cpu_number);
-
-       strcpy((char *)start, buf);
-       start += strlen(buf) + 1;
-
-       strcpy((char *)start, cpu_manufacturer);
-       start += strlen(cpu_manufacturer) + 1;
-
-       *((uint8_t *)start) = 0;
-       return start+1;
+    char buf[80]; 
+    struct smbios_type_4 *p = (struct smbios_type_4 *)start;
+    uint32_t eax, ebx, ecx, edx;
+
+    p->header.type = 4;
+    p->header.length = sizeof(struct smbios_type_4);
+    p->header.handle = 0x400 + cpu_number;
+
+    p->socket_designation_str = 1;
+    p->processor_type = 0x03; /* CPU */
+    p->processor_family = 0x01; /* other */
+    p->manufacturer_str = 2;
+
+    cpuid(1, &eax, &ebx, &ecx, &edx);
+
+    p->cpuid[0] = eax;
+    p->cpuid[1] = edx;
+
+    p->version_str = 0;
+    p->voltage = 0;
+    p->external_clock = 0;
+
+    p->max_speed = 0; /* unknown */
+    p->current_speed = 0; /* unknown */
+
+    p->status = 0x41; /* socket populated, CPU enabled */
+    p->upgrade = 0x01; /* other */
+
+    start += sizeof(struct smbios_type_4);
+
+    strncpy(buf, "CPU ", sizeof(buf));
+    if ( (sizeof(buf) - strlen("CPU ")) >= 3 )
+        itoa(buf + strlen("CPU "), cpu_number);
+
+    strcpy((char *)start, buf);
+    start += strlen(buf) + 1;
+
+    strcpy((char *)start, cpu_manufacturer);
+    start += strlen(cpu_manufacturer) + 1;
+
+    *((uint8_t *)start) = 0;
+    return start+1;
 }
 
 /* Type 16 -- Physical Memory Array */
 static void *
 smbios_type_16_init(void *start, uint32_t memsize)
 {
-       struct smbios_type_16 *p = (struct smbios_type_16*)start;
-
-       p->header.type = 16;
-       p->header.handle = 0x1000;
-       p->header.length = sizeof(struct smbios_type_16);
-    
-       p->location = 0x01; /* other */
-       p->use = 0x03; /* system memory */
-       p->error_correction = 0x01; /* other */
-       p->maximum_capacity = memsize * 1024;
-       p->memory_error_information_handle = 0xfffe; /* none provided */
-       p->number_of_memory_devices = 1;
-
-       start += sizeof(struct smbios_type_16);
-       *((uint16_t *)start) = 0;
-       return start + 2;
+    struct smbios_type_16 *p = (struct smbios_type_16*)start;
+
+    p->header.type = 16;
+    p->header.handle = 0x1000;
+    p->header.length = sizeof(struct smbios_type_16);
+    
+    p->location = 0x01; /* other */
+    p->use = 0x03; /* system memory */
+    p->error_correction = 0x01; /* other */
+    p->maximum_capacity = memsize * 1024;
+    p->memory_error_information_handle = 0xfffe; /* none provided */
+    p->number_of_memory_devices = 1;
+
+    start += sizeof(struct smbios_type_16);
+    *((uint16_t *)start) = 0;
+    return start + 2;
 }
 
 /* Type 17 -- Memory Device */
 static void *
 smbios_type_17_init(void *start, uint32_t memory_size_mb)
 {
-       struct smbios_type_17 *p = (struct smbios_type_17 *)start;
-    
-       p->header.type = 17;
-       p->header.length = sizeof(struct smbios_type_17);
-       p->header.handle = 0x1100;
-
-       p->physical_memory_array_handle = 0x1000;
-       p->total_width = 64;
-       p->data_width = 64;
-       /* truncate memory_size_mb to 16 bits and clear most significant
-          bit [indicates size in MB] */
-       p->size = (uint16_t) memory_size_mb & 0x7fff;
-       p->form_factor = 0x09; /* DIMM */
-       p->device_set = 0;
-       p->device_locator_str = 1;
-       p->bank_locator_str = 0;
-       p->memory_type = 0x07; /* RAM */
-       p->type_detail = 0;
-
-       start += sizeof(struct smbios_type_17);
-       strcpy((char *)start, "DIMM 1");
-       start += strlen("DIMM 1") + 1;
-       *((uint8_t *)start) = 0;
-
-       return start+1;
+    struct smbios_type_17 *p = (struct smbios_type_17 *)start;
+    
+    p->header.type = 17;
+    p->header.length = sizeof(struct smbios_type_17);
+    p->header.handle = 0x1100;
+
+    p->physical_memory_array_handle = 0x1000;
+    p->total_width = 64;
+    p->data_width = 64;
+    /* truncate memory_size_mb to 16 bits and clear most significant
+       bit [indicates size in MB] */
+    p->size = (uint16_t) memory_size_mb & 0x7fff;
+    p->form_factor = 0x09; /* DIMM */
+    p->device_set = 0;
+    p->device_locator_str = 1;
+    p->bank_locator_str = 0;
+    p->memory_type = 0x07; /* RAM */
+    p->type_detail = 0;
+
+    start += sizeof(struct smbios_type_17);
+    strcpy((char *)start, "DIMM 1");
+    start += strlen("DIMM 1") + 1;
+    *((uint8_t *)start) = 0;
+
+    return start+1;
 }
 
 /* Type 19 -- Memory Array Mapped Address */
 static void *
 smbios_type_19_init(void *start, uint32_t memory_size_mb)
 {
-       struct smbios_type_19 *p = (struct smbios_type_19 *)start;
-    
-       p->header.type = 19;
-       p->header.length = sizeof(struct smbios_type_19);
-       p->header.handle = 0x1300;
-
-       p->starting_address = 0;
-       p->ending_address = (memory_size_mb-1) * 1024;
-       p->memory_array_handle = 0x1000;
-       p->partition_width = 1;
-
-       start += sizeof(struct smbios_type_19);
-       *((uint16_t *)start) = 0;
-       return start + 2;
+    struct smbios_type_19 *p = (struct smbios_type_19 *)start;
+    
+    p->header.type = 19;
+    p->header.length = sizeof(struct smbios_type_19);
+    p->header.handle = 0x1300;
+
+    p->starting_address = 0;
+    p->ending_address = (memory_size_mb-1) * 1024;
+    p->memory_array_handle = 0x1000;
+    p->partition_width = 1;
+
+    start += sizeof(struct smbios_type_19);
+    *((uint16_t *)start) = 0;
+    return start + 2;
 }
 
 /* Type 20 -- Memory Device Mapped Address */
 static void *
 smbios_type_20_init(void *start, uint32_t memory_size_mb)
 {
-       struct smbios_type_20 *p = (struct smbios_type_20 *)start;
-
-       p->header.type = 20;
-       p->header.length = sizeof(struct smbios_type_20);
-       p->header.handle = 0x1400;
-
-       p->starting_address = 0;
-       p->ending_address = (memory_size_mb-1)*1024;
-       p->memory_device_handle = 0x1100;
-       p->memory_array_mapped_address_handle = 0x1300;
-       p->partition_row_position = 1;
-       p->interleave_position = 0;
-       p->interleaved_data_depth = 0;
-
-       start += sizeof(struct smbios_type_20);
-
-       *((uint16_t *)start) = 0;
-       return start+2;
+    struct smbios_type_20 *p = (struct smbios_type_20 *)start;
+
+    p->header.type = 20;
+    p->header.length = sizeof(struct smbios_type_20);
+    p->header.handle = 0x1400;
+
+    p->starting_address = 0;
+    p->ending_address = (memory_size_mb-1)*1024;
+    p->memory_device_handle = 0x1100;
+    p->memory_array_mapped_address_handle = 0x1300;
+    p->partition_row_position = 1;
+    p->interleave_position = 0;
+    p->interleaved_data_depth = 0;
+
+    start += sizeof(struct smbios_type_20);
+
+    *((uint16_t *)start) = 0;
+    return start+2;
 }
 
 /* Type 32 -- System Boot Information */
 static void *
 smbios_type_32_init(void *start)
 {
-       struct smbios_type_32 *p = (struct smbios_type_32 *)start;
-
-       p->header.type = 32;
-       p->header.length = sizeof(struct smbios_type_32);
-       p->header.handle = 0x2000;
-       memset(p->reserved, 0, 6);
-       p->boot_status = 0; /* no errors detected */
-    
-       start += sizeof(struct smbios_type_32);
-       *((uint16_t *)start) = 0;
-       return start+2;
+    struct smbios_type_32 *p = (struct smbios_type_32 *)start;
+
+    p->header.type = 32;
+    p->header.length = sizeof(struct smbios_type_32);
+    p->header.handle = 0x2000;
+    memset(p->reserved, 0, 6);
+    p->boot_status = 0; /* no errors detected */
+    
+    start += sizeof(struct smbios_type_32);
+    *((uint16_t *)start) = 0;
+    return start+2;
 }
 
 /* Type 127 -- End of Table */
 static void *
 smbios_type_127_init(void *start)
 {
-       struct smbios_type_127 *p = (struct smbios_type_127 *)start;
-
-       p->header.type = 127;
-       p->header.length = sizeof(struct smbios_type_127);
-       p->header.handle = 0x7f00;
-
-       start += sizeof(struct smbios_type_127);
-       *((uint16_t *)start) = 0;
-       return start + 2;
-}
+    struct smbios_type_127 *p = (struct smbios_type_127 *)start;
+
+    p->header.type = 127;
+    p->header.length = sizeof(struct smbios_type_127);
+    p->header.handle = 0x7f00;
+
+    start += sizeof(struct smbios_type_127);
+    *((uint16_t *)start) = 0;
+    return start + 2;
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/util.c
--- a/tools/firmware/hvmloader/util.c   Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/util.c   Thu Nov 23 17:54:06 2006 +0000
@@ -20,175 +20,193 @@
 
 #include "acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
 #include "util.h"
+#include "config.h"
 #include <stdint.h>
+#include <xenctrl.h>
+
+void outb(uint16_t addr, uint8_t val)
+{
+    __asm__ __volatile__ ( "outb %%al, %%dx" :: "d"(addr), "a"(val) );
+}
 
 void outw(uint16_t addr, uint16_t val)
 {
-       __asm__ __volatile__ ("outw %%ax, %%dx" :: "d"(addr), "a"(val));
-}
-
-void outb(uint16_t addr, uint8_t val)
-{
-       __asm__ __volatile__ ("outb %%al, %%dx" :: "d"(addr), "a"(val));
+    __asm__ __volatile__ ( "outw %%ax, %%dx" :: "d"(addr), "a"(val) );
+}
+
+void outl(uint16_t addr, uint32_t val)
+{
+    __asm__ __volatile__ ( "outl %%eax, %%dx" :: "d"(addr), "a"(val) );
 }
 
 uint8_t inb(uint16_t addr)
 {
-       uint8_t val;
-       __asm__ __volatile__ ("inb %w1,%0" : "=a" (val) : "Nd" (addr));
-       return val;
+    uint8_t val;
+    __asm__ __volatile__ ( "inb %%dx,%%al" : "=a" (val) : "d" (addr) );
+    return val;
+}
+
+uint16_t inw(uint16_t addr)
+{
+    uint16_t val;
+    __asm__ __volatile__ ( "inw %%dx,%%ax" : "=a" (val) : "d" (addr) );
+    return val;
+}
+
+uint32_t inl(uint16_t addr)
+{
+    uint32_t val;
+    __asm__ __volatile__ ( "inl %%dx,%%eax" : "=a" (val) : "d" (addr) );
+    return val;
 }
 
 char *itoa(char *a, unsigned int i)
 {
-       unsigned int _i = i, x = 0;
-
-       do {
-               x++;
-               _i /= 10;
-       } while (_i != 0);
-
-       a += x;
-       *a-- = '\0';
-
-       do {
-               *a-- = (i % 10) + '0';
-               i /= 10;
-       } while (i != 0);
-
-       return a + 1;
+    unsigned int _i = i, x = 0;
+
+    do {
+        x++;
+        _i /= 10;
+    } while ( _i != 0 );
+
+    a += x;
+    *a-- = '\0';
+
+    do {
+        *a-- = (i % 10) + '0';
+        i /= 10;
+    } while ( i != 0 );
+
+    return a + 1;
 }
 
 int strcmp(const char *cs, const char *ct)
 {
-       signed char res;
-
-       while (((res = *cs - *ct++) == 0) && (*cs++ != '\0'))
-               continue;
-
-       return res;
+    signed char res;
+
+    while ( ((res = *cs - *ct++) == 0) && (*cs++ != '\0') )
+        continue;
+
+    return res;
 }
 
 void *memcpy(void *dest, const void *src, unsigned n)
 {
-       int t0, t1, t2;
-
-       __asm__ __volatile__(
-               "cld\n"
-               "rep; movsl\n"
-               "testb $2,%b4\n"
-               "je 1f\n"
-               "movsw\n"
-               "1: testb $1,%b4\n"
-               "je 2f\n"
-               "movsb\n"
-               "2:"
-               : "=&c" (t0), "=&D" (t1), "=&S" (t2)
-               : "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
-               : "memory"
-       );
-       return dest;
+    int t0, t1, t2;
+
+    __asm__ __volatile__ (
+        "cld\n"
+        "rep; movsl\n"
+        "testb $2,%b4\n"
+        "je 1f\n"
+        "movsw\n"
+        "1: testb $1,%b4\n"
+        "je 2f\n"
+        "movsb\n"
+        "2:"
+        : "=&c" (t0), "=&D" (t1), "=&S" (t2)
+        : "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
+        : "memory" );
+    return dest;
 }
 
 void *memmove(void *dest, const void *src, unsigned n)
 {
-       if ((long)dest > (long)src) {
-               n--;
-               while (n > 0) {
-                       ((char *)dest)[n] = ((char *)src)[n];
-                       n--;
-               }
-       } else {
-               memcpy(dest, src, n);
-       }
-       return dest;
-}
-
-
-
-
-void puts(const char *s)
-{
-       while (*s)
-               outb(0xE9, *s++);
+    if ( (long)dest > (long)src )
+    {
+        n--;
+        while ( n > 0 )
+        {
+            ((char *)dest)[n] = ((char *)src)[n];
+            n--;
+        }
+    }
+    else
+    {
+        memcpy(dest, src, n);
+    }
+    return dest;
 }
 
 char *
 strcpy(char *dest, const char *src)
 {
-       char *p = dest;
-       while (*src)
-               *p++ = *src++;
-       *p = 0;
-       return dest;
+    char *p = dest;
+    while ( *src )
+        *p++ = *src++;
+    *p = 0;
+    return dest;
 }
 
 char *
 strncpy(char *dest, const char *src, unsigned n)
 {
-       int i = 0;
-       char *p = dest;
-
-       /* write non-NUL characters from src into dest until we run
-          out of room in dest or encounter a NUL in src */
-       while (i < n && *src) {
-               *p++ = *src++;
-               ++i;
-       }
-
-       /* pad remaining bytes of dest with NUL bytes */
-       while (i < n) {
-               *p++ = 0;
-               ++i;
-       }
-
-       return dest;
+    int i = 0;
+    char *p = dest;
+
+    /* write non-NUL characters from src into dest until we run
+       out of room in dest or encounter a NUL in src */
+    while ( (i < n) && *src )
+    {
+        *p++ = *src++;
+        i++;
+    }
+
+    /* pad remaining bytes of dest with NUL bytes */
+    while ( i < n )
+    {
+        *p++ = 0;
+        i++;
+    }
+
+    return dest;
 }
 
 unsigned
 strlen(const char *s)
 {
-       int i = 0;
-       while (*s++)
-               ++i;
-       return i;
+    int i = 0;
+    while ( *s++ )
+        i++;
+    return i;
 }
 
 void *
 memset(void *s, int c, unsigned n)
 {
-       uint8_t b = (uint8_t) c;
-       uint8_t *p = (uint8_t *)s;
-       int i;
-       for (i = 0; i < n; ++i)
-               *p++ = b;
-       return s;
+    uint8_t b = (uint8_t) c;
+    uint8_t *p = (uint8_t *)s;
+    int i;
+    for ( i = 0; i < n; i++ )
+        *p++ = b;
+    return s;
 }
 
 int
 memcmp(const void *s1, const void *s2, unsigned n)
 {
-       unsigned i;
-       uint8_t *p1 = (uint8_t *) s1;
-       uint8_t *p2 = (uint8_t *) s2;
-
-       for (i = 0; i < n; ++i) {
-               if (p1[i] < p2[i])
-                       return -1;
-               else if (p1[i] > p2[i])
-                       return 1;
-       }
-
-       return 0;
+    unsigned i;
+    uint8_t *p1 = (uint8_t *) s1;
+    uint8_t *p2 = (uint8_t *) s2;
+
+    for ( i = 0; i < n; i++ )
+    {
+        if ( p1[i] < p2[i] )
+            return -1;
+        else if ( p1[i] > p2[i] )
+            return 1;
+    }
+
+    return 0;
 }
 
 void
 cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
 {
-       __asm__ __volatile__(
-               "cpuid"
-               : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
-               : "0" (idx) );
+    __asm__ __volatile__ (
+        "cpuid"
+        : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
+        : "0" (idx) );
 }
 
 /* Write a two-character hex representation of 'byte' to digits[].
@@ -196,18 +214,18 @@ void
 void
 byte_to_hex(char *digits, uint8_t byte)
 {
-       uint8_t nybbel = byte >> 4;
-
-       if (nybbel > 9)
-               digits[0] = 'a' + nybbel-10;
-       else
-               digits[0] = '0' + nybbel;
-
-       nybbel = byte & 0x0f;
-       if (nybbel > 9)
-               digits[1] = 'a' + nybbel-10;
-       else
-               digits[1] = '0' + nybbel;
+    uint8_t nybbel = byte >> 4;
+
+    if ( nybbel > 9 )
+        digits[0] = 'a' + nybbel-10;
+    else
+        digits[0] = '0' + nybbel;
+
+    nybbel = byte & 0x0f;
+    if ( nybbel > 9 )
+        digits[1] = 'a' + nybbel-10;
+    else
+        digits[1] = '0' + nybbel;
 }
 
 /* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
@@ -217,34 +235,39 @@ void
 void
 uuid_to_string(char *dest, uint8_t *uuid)
 {
-       int i = 0;
-       char *p = dest;
-
-       for (i = 0; i < 4; ++i) {
-               byte_to_hex(p, uuid[i]);
-               p += 2;
-       }
-       *p++ = '-';
-       for (i = 4; i < 6; ++i) {
-               byte_to_hex(p, uuid[i]);
-               p += 2;
-       }
-       *p++ = '-';
-       for (i = 6; i < 8; ++i) {
-               byte_to_hex(p, uuid[i]);
-               p += 2;
-       }
-       *p++ = '-';
-       for (i = 8; i < 10; ++i) {
-               byte_to_hex(p, uuid[i]);
-               p += 2;
-       }
-       *p++ = '-';
-       for (i = 10; i < 16; ++i) {
-               byte_to_hex(p, uuid[i]);
-               p += 2;
-       }
-       *p = 0;
+    int i = 0;
+    char *p = dest;
+
+    for ( i = 0; i < 4; i++ )
+    {
+        byte_to_hex(p, uuid[i]);
+        p += 2;
+    }
+    *p++ = '-';
+    for ( i = 4; i < 6; i++ )
+    {
+        byte_to_hex(p, uuid[i]);
+        p += 2;
+    }
+    *p++ = '-';
+    for ( i = 6; i < 8; i++ )
+    {
+        byte_to_hex(p, uuid[i]);
+        p += 2;
+    }
+    *p++ = '-';
+    for ( i = 8; i < 10; i++ )
+    {
+        byte_to_hex(p, uuid[i]);
+        p += 2;
+    }
+    *p++ = '-';
+    for ( i = 10; i < 16; i++ )
+    {
+        byte_to_hex(p, uuid[i]);
+        p += 2;
+    }
+    *p = '\0';
 }
 
 #include <xen/hvm/e820.h>
@@ -252,31 +275,222 @@ uuid_to_string(char *dest, uint8_t *uuid
 #define E820_MAP    ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
 uint64_t e820_malloc(uint64_t size, uint32_t type, uint64_t mask)
 {
-       uint64_t addr = 0;
-       int c = *E820_MAP_NR - 1;
-       struct e820entry *e820entry = (struct e820entry *)E820_MAP;
-
-       while (c >= 0) {
-               if (e820entry[c].type  == E820_RAM     &&
-                   (e820entry[c].addr & (~mask)) == 0 &&
-                   e820entry[c].size >= size) {
-                       addr = e820entry[c].addr;
-                       if (e820entry[c].size != size) {
-                               (*E820_MAP_NR)++;
-                               memmove(&e820entry[c+1],
-                                       &e820entry[c],
-                                       (*E820_MAP_NR - c) *
-                                           sizeof(struct e820entry));
-                               e820entry[c].size -= size;
-                               addr += e820entry[c].size;
-                               c++;
-                       }
-                       e820entry[c].addr = addr;
-                       e820entry[c].size = size;
-                       e820entry[c].type = type;
-                       break;
-               }
-               c--;
-       }
-        return addr;
-}
+    uint64_t addr = 0;
+    int c = *E820_MAP_NR - 1;
+    struct e820entry *e820entry = (struct e820entry *)E820_MAP;
+
+    while ( c >= 0 )
+    {
+        if ( (e820entry[c].type  == E820_RAM) &&
+             ((e820entry[c].addr & (~mask)) == 0) &&
+             (e820entry[c].size >= size) )
+        {
+            addr = e820entry[c].addr;
+            if ( e820entry[c].size != size )
+            {
+                (*E820_MAP_NR)++;
+                memmove(&e820entry[c+1],
+                        &e820entry[c],
+                        (*E820_MAP_NR - c) *
+                        sizeof(struct e820entry));
+                e820entry[c].size -= size;
+                addr += e820entry[c].size;
+                c++;
+            }
+            e820entry[c].addr = addr;
+            e820entry[c].size = size;
+            e820entry[c].type = type;
+            break;
+        }
+        c--;
+    }
+    return addr;
+}
+
+uint32_t ioapic_read(uint32_t reg)
+{
+    uint32_t *ioregsel = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00);
+    uint32_t *iowin    = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x10);
+
+    *ioregsel = reg;
+    mb();
+    return *iowin;
+}
+
+void ioapic_write(uint32_t reg, uint32_t val)
+{
+    uint32_t *ioregsel = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00);
+    uint32_t *iowin    = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x10);
+
+    *ioregsel = reg;
+    wmb();
+    *iowin = val;
+}
+
+#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
+    (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
+
+uint32_t pci_read(uint32_t devfn, uint32_t reg, uint32_t len)
+{
+    outl(0xcf8, PCI_CONF1_ADDRESS(0, devfn, reg));
+
+    switch ( len )
+    {
+    case 1: return inb(0xcfc + (reg & 3));
+    case 2: return inw(0xcfc + (reg & 2));
+    }
+
+    return inl(0xcfc);
+}
+
+void pci_write(uint32_t devfn, uint32_t reg, uint32_t len, uint32_t val)
+{
+    outl(0xcf8, PCI_CONF1_ADDRESS(0, devfn, reg));
+
+    switch ( len )
+    {
+    case 1: outb(0xcfc + (reg & 3), val); break;
+    case 2: outw(0xcfc + (reg & 2), val); break;
+    case 4: outl(0xcfc,             val); break;
+    }
+}
+
+static char *printnum(char *p, unsigned long num, int base)
+{
+    unsigned long n;
+
+    if ( (n = num/base) > 0 )
+        p = printnum(p, n, base);
+    *p++ = "0123456789abcdef"[(int)(num % base)];
+    *p = '\0';
+    return p;
+}
+
+static void _doprint(void (*put)(char), char const *fmt, va_list ap)
+{
+    register char *str, c;
+    int lflag, zflag, nflag;
+    char buffer[17];
+    unsigned value;
+    int i, slen, pad;
+
+    for ( ; *fmt != '\0'; fmt++ )
+    {
+        if ( *fmt != '%' )
+        {
+            put(*fmt);
+            continue;
+        }
+
+        pad = zflag = nflag = lflag = 0;
+        c = *++fmt;
+        if ( (c == '-') || isdigit(c) )
+        {
+            if ( c == '-' )
+            {
+                nflag = 1;
+                c = *++fmt;
+            }
+            zflag = c == '0';
+            for ( pad = 0; isdigit(c); c = *++fmt )
+                pad = (pad * 10) + c - '0';
+        }
+        if ( c == 'l' ) /* long extension */
+        {
+            lflag = 1;
+            c = *++fmt;
+        }
+        if ( (c == 'd') || (c == 'u') || (c == 'o') || (c == 'x') )
+        {
+            if ( lflag )
+                value = va_arg(ap, unsigned);
+            else
+                value = (unsigned) va_arg(ap, unsigned int);
+            str = buffer;
+            printnum(str, value,
+                     c == 'o' ? 8 : (c == 'x' ? 16 : 10));
+            goto printn;
+        }
+        else if ( (c == 'O') || (c == 'D') || (c == 'X') )
+        {
+            value = va_arg(ap, unsigned);
+            str = buffer;
+            printnum(str, value,
+                     c == 'O' ? 8 : (c == 'X' ? 16 : 10));
+        printn:
+            slen = strlen(str);
+            for ( i = pad - slen; i > 0; i-- )
+                put(zflag ? '0' : ' ');
+            while ( *str )
+                put(*str++);
+        }
+        else if ( c == 's' )
+        {
+            str = va_arg(ap, char *);
+            slen = strlen(str);
+            if ( nflag == 0 )
+                for ( i = pad - slen; i > 0; i-- )
+                    put(' ');
+            while ( *str )
+                put(*str++);
+            if ( nflag )
+                for ( i = pad - slen; i > 0; i-- )
+                    put(' ');
+        }
+        else if ( c == 'c' )
+        {
+            put(va_arg(ap, int));
+        }
+        else
+        {
+            put(*fmt);
+        }
+    }
+}
+
+static void putchar(char c)
+{
+    outb(0xe9, c);
+}
+
+int printf(const char *fmt, ...)
+{
+    va_list ap;
+
+    va_start(ap, fmt);
+    _doprint(putchar, fmt, ap);
+    va_end(ap);
+
+    return 0;
+}
+
+int vprintf(const char *fmt, va_list ap)
+{
+    _doprint(putchar, fmt, ap);
+    return 0;
+}
+
+void __assert_failed(char *assertion, char *file, int line)
+{
+    printf("HVMLoader assertion '%s' failed at %s:%d\n",
+           assertion, file, line);
+    for ( ; ; )
+        __asm__ __volatile__ ( "ud2" );
+}
+
+void __bug(char *file, int line)
+{
+    printf("HVMLoader bug at %s:%d\n", file, line);
+    for ( ; ; )
+        __asm__ __volatile__ ( "ud2" );
+}
+
+/*
+ * Local variables:
+ * mode: C
+ * c-set-style: "BSD"
+ * c-basic-offset: 4
+ * tab-width: 4
+ * indent-tabs-mode: nil
+ * End:
+ */
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/util.h
--- a/tools/firmware/hvmloader/util.h   Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/hvmloader/util.h   Thu Nov 23 17:54:06 2006 +0000
@@ -1,12 +1,34 @@
 #ifndef __HVMLOADER_UTIL_H__
 #define __HVMLOADER_UTIL_H__
 
+#include <stdarg.h>
+
+extern void __assert_failed(char *assertion, char *file, int line)
+    __attribute__((noreturn));
+#define ASSERT(p) \
+    do { if (!(p)) __assert_failed(#p, __FILE__, __LINE__); } while (0)
+extern void __bug(char *file, int line) __attribute__((noreturn));
+#define BUG() __bug()
+
 /* I/O output */
+void outb(uint16_t addr, uint8_t  val);
 void outw(uint16_t addr, uint16_t val);
-void outb(uint16_t addr, uint8_t val);
+void outl(uint16_t addr, uint32_t val);
 
 /* I/O input */
-uint8_t inb(uint16_t addr);
+uint8_t  inb(uint16_t addr);
+uint16_t inw(uint16_t addr);
+uint32_t inl(uint16_t addr);
+
+/* PCI access */
+uint32_t pci_read(uint32_t devfn, uint32_t reg, uint32_t len);
+#define pci_readb(devfn, reg) ((uint8_t) pci_read(devfn, reg, 1))
+#define pci_readw(devfn, reg) ((uint16_t)pci_read(devfn, reg, 2))
+#define pci_readl(devfn, reg) ((uint32_t)pci_read(devfn, reg, 4))
+void pci_write(uint32_t devfn, uint32_t reg, uint32_t len, uint32_t val);
+#define pci_writeb(devfn, reg, val) (pci_write(devfn, reg, 1, (uint8_t) val))
+#define pci_writew(devfn, reg, val) (pci_write(devfn, reg, 2, (uint16_t)val))
+#define pci_writel(devfn, reg, val) (pci_write(devfn, reg, 4, (uint32_t)val))
 
 /* Do cpuid instruction, with operation 'idx' */
 void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
@@ -31,15 +53,16 @@ void byte_to_hex(char *digits, uint8_t b
 void byte_to_hex(char *digits, uint8_t byte);
 
 /* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
-   string.
-
-   Pre-condition: sizeof(dest) >= 37 */
+   string. Pre-condition: sizeof(dest) >= 37 */
 void uuid_to_string(char *dest, uint8_t *uuid);
 
 /* Debug output */
-void puts(const char *s);
+int printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
+int vprintf(const char *fmt, va_list ap);
 
 /* Allocate region of specified type in the e820 table. */
 uint64_t e820_malloc(uint64_t size, uint32_t type, uint64_t mask);
 
+#define isdigit(c) ((c) >= '0' && (c) <= '9')
+
 #endif /* __HVMLOADER_UTIL_H__ */
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/rombios/rombios.c
--- a/tools/firmware/rombios/rombios.c  Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/firmware/rombios/rombios.c  Thu Nov 23 17:54:06 2006 +0000
@@ -9104,78 +9104,78 @@ pci_routing_table_structure:
   db 0 ;; pci bus number
   db 0x08 ;; pci device number (bit 7-3)
   db 0x61 ;; link value INTA#: pointer into PCI2ISA config space
-  dw 0xdef8 ;; IRQ bitmap INTA# 
+  dw 0x0c60 ;; IRQ bitmap INTA# 
   db 0x62 ;; link value INTB#
-  dw 0xdef8 ;; IRQ bitmap INTB# 
+  dw 0x0c60 ;; IRQ bitmap INTB# 
   db 0x63 ;; link value INTC#
-  dw 0xdef8 ;; IRQ bitmap INTC# 
+  dw 0x0c60 ;; IRQ bitmap INTC# 
   db 0x60 ;; link value INTD#
-  dw 0xdef8 ;; IRQ bitmap INTD#
+  dw 0x0c60 ;; IRQ bitmap INTD#
   db 0 ;; physical slot (0 = embedded)
   db 0 ;; reserved
   ;; second slot entry: 1st PCI slot
   db 0 ;; pci bus number
   db 0x10 ;; pci device number (bit 7-3)
   db 0x62 ;; link value INTA#
-  dw 0xdef8 ;; IRQ bitmap INTA# 
+  dw 0x0c60 ;; IRQ bitmap INTA# 
   db 0x63 ;; link value INTB#
-  dw 0xdef8 ;; IRQ bitmap INTB# 
+  dw 0x0c60 ;; IRQ bitmap INTB# 
   db 0x60 ;; link value INTC#
-  dw 0xdef8 ;; IRQ bitmap INTC# 
+  dw 0x0c60 ;; IRQ bitmap INTC# 
   db 0x61 ;; link value INTD#
-  dw 0xdef8 ;; IRQ bitmap INTD#
+  dw 0x0c60 ;; IRQ bitmap INTD#
   db 1 ;; physical slot (0 = embedded)
   db 0 ;; reserved
   ;; third slot entry: 2nd PCI slot
   db 0 ;; pci bus number
   db 0x18 ;; pci device number (bit 7-3)
   db 0x63 ;; link value INTA#
-  dw 0xdef8 ;; IRQ bitmap INTA# 
+  dw 0x0c60 ;; IRQ bitmap INTA# 
   db 0x60 ;; link value INTB#
-  dw 0xdef8 ;; IRQ bitmap INTB# 
+  dw 0x0c60 ;; IRQ bitmap INTB# 
   db 0x61 ;; link value INTC#
-  dw 0xdef8 ;; IRQ bitmap INTC# 
+  dw 0x0c60 ;; IRQ bitmap INTC# 
   db 0x62 ;; link value INTD#
-  dw 0xdef8 ;; IRQ bitmap INTD#
+  dw 0x0c60 ;; IRQ bitmap INTD#
   db 2 ;; physical slot (0 = embedded)
   db 0 ;; reserved
   ;; 4th slot entry: 3rd PCI slot
   db 0 ;; pci bus number
   db 0x20 ;; pci device number (bit 7-3)
   db 0x60 ;; link value INTA#
-  dw 0xdef8 ;; IRQ bitmap INTA# 
+  dw 0x0c60 ;; IRQ bitmap INTA# 
   db 0x61 ;; link value INTB#
-  dw 0xdef8 ;; IRQ bitmap INTB# 
+  dw 0x0c60 ;; IRQ bitmap INTB# 
   db 0x62 ;; link value INTC#
-  dw 0xdef8 ;; IRQ bitmap INTC# 
+  dw 0x0c60 ;; IRQ bitmap INTC# 
   db 0x63 ;; link value INTD#
-  dw 0xdef8 ;; IRQ bitmap INTD#
+  dw 0x0c60 ;; IRQ bitmap INTD#
   db 3 ;; physical slot (0 = embedded)
   db 0 ;; reserved
   ;; 5th slot entry: 4rd PCI slot
   db 0 ;; pci bus number
   db 0x28 ;; pci device number (bit 7-3)
   db 0x61 ;; link value INTA#
-  dw 0xdef8 ;; IRQ bitmap INTA# 
+  dw 0x0c60 ;; IRQ bitmap INTA# 
   db 0x62 ;; link value INTB#
-  dw 0xdef8 ;; IRQ bitmap INTB# 
+  dw 0x0c60 ;; IRQ bitmap INTB# 
   db 0x63 ;; link value INTC#
-  dw 0xdef8 ;; IRQ bitmap INTC# 
+  dw 0x0c60 ;; IRQ bitmap INTC# 
   db 0x60 ;; link value INTD#
-  dw 0xdef8 ;; IRQ bitmap INTD#
+  dw 0x0c60 ;; IRQ bitmap INTD#
   db 4 ;; physical slot (0 = embedded)
   db 0 ;; reserved
   ;; 6th slot entry: 5rd PCI slot
   db 0 ;; pci bus number
   db 0x30 ;; pci device number (bit 7-3)
   db 0x62 ;; link value INTA#
-  dw 0xdef8 ;; IRQ bitmap INTA# 
+  dw 0x0c60 ;; IRQ bitmap INTA# 
   db 0x63 ;; link value INTB#
-  dw 0xdef8 ;; IRQ bitmap INTB# 
+  dw 0x0c60 ;; IRQ bitmap INTB# 
   db 0x60 ;; link value INTC#
-  dw 0xdef8 ;; IRQ bitmap INTC# 
+  dw 0x0c60 ;; IRQ bitmap INTC# 
   db 0x61 ;; link value INTD#
-  dw 0xdef8 ;; IRQ bitmap INTD#
+  dw 0x0c60 ;; IRQ bitmap INTD#
   db 5 ;; physical slot (0 = embedded)
   db 0 ;; reserved
 
diff -r 2fd223c64fc6 -r cd40792968cb tools/ioemu/target-i386-dm/piix_pci-dm.c
--- a/tools/ioemu/target-i386-dm/piix_pci-dm.c  Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/ioemu/target-i386-dm/piix_pci-dm.c  Thu Nov 23 17:54:06 2006 +0000
@@ -84,12 +84,6 @@ PCIBus *i440fx_init(void)
 
 static PCIDevice *piix3_dev;
 
-static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
-{
-    /* This is the barber's pole mapping used by Xen. */
-    return (irq_num + (pci_dev->devfn >> 3)) & 3;
-}
-
 static void piix3_write_config(PCIDevice *d, 
                                uint32_t address, uint32_t val, int len)
 {
@@ -114,12 +108,9 @@ static void piix3_reset(PCIDevice *d)
     uint8_t *pci_conf = d->config;
 
     pci_conf[0x04] = 0x07; // master, memory and I/O
-    pci_conf[0x05] = 0x00;
-    pci_conf[0x06] = 0x00;
     pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
     pci_conf[0x4c] = 0x4d;
     pci_conf[0x4e] = 0x03;
-    pci_conf[0x4f] = 0x00;
     pci_conf[0x60] = 0x80;
     pci_conf[0x61] = 0x80;
     pci_conf[0x62] = 0x80;
@@ -129,22 +120,9 @@ static void piix3_reset(PCIDevice *d)
     pci_conf[0x76] = 0x0c;
     pci_conf[0x77] = 0x0c;
     pci_conf[0x78] = 0x02;
-    pci_conf[0x79] = 0x00;
-    pci_conf[0x80] = 0x00;
-    pci_conf[0x82] = 0x00;
     pci_conf[0xa0] = 0x08;
     pci_conf[0xa0] = 0x08;
-    pci_conf[0xa2] = 0x00;
-    pci_conf[0xa3] = 0x00;
-    pci_conf[0xa4] = 0x00;
-    pci_conf[0xa5] = 0x00;
-    pci_conf[0xa6] = 0x00;
-    pci_conf[0xa7] = 0x00;
     pci_conf[0xa8] = 0x0f;
-    pci_conf[0xaa] = 0x00;
-    pci_conf[0xab] = 0x00;
-    pci_conf[0xac] = 0x00;
-    pci_conf[0xae] = 0x00;
 }
 
 int piix3_init(PCIBus *bus)
@@ -171,227 +149,4 @@ int piix3_init(PCIBus *bus)
     return d->devfn;
 }
 
-/***********************************************************/
-/* XXX: the following should be moved to the PC BIOS */
-
-static __attribute__((unused)) uint32_t isa_inb(uint32_t addr)
-{
-    return cpu_inb(NULL, addr);
-}
-
-static void isa_outb(uint32_t val, uint32_t addr)
-{
-    cpu_outb(NULL, addr, val);
-}
-
-static __attribute__((unused)) uint32_t isa_inw(uint32_t addr)
-{
-    return cpu_inw(NULL, addr);
-}
-
-static __attribute__((unused)) void isa_outw(uint32_t val, uint32_t addr)
-{
-    cpu_outw(NULL, addr, val);
-}
-
-static __attribute__((unused)) uint32_t isa_inl(uint32_t addr)
-{
-    return cpu_inl(NULL, addr);
-}
-
-static __attribute__((unused)) void isa_outl(uint32_t val, uint32_t addr)
-{
-    cpu_outl(NULL, addr, val);
-}
-
-static uint32_t pci_bios_io_addr;
-static uint32_t pci_bios_mem_addr;
-/* host irqs corresponding to PCI irqs A-D */
-static uint8_t pci_irqs[4] = { 10, 11, 10, 11 };
-
-static void pci_config_writel(PCIDevice *d, uint32_t addr, uint32_t val)
-{
-    PCIBus *s = d->bus;
-    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
-    pci_data_write(s, addr, val, 4);
-}
-
-static void pci_config_writew(PCIDevice *d, uint32_t addr, uint32_t val)
-{
-    PCIBus *s = d->bus;
-    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
-    pci_data_write(s, addr, val, 2);
-}
-
-static void pci_config_writeb(PCIDevice *d, uint32_t addr, uint32_t val)
-{
-    PCIBus *s = d->bus;
-    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
-    pci_data_write(s, addr, val, 1);
-}
-
-static __attribute__((unused)) uint32_t pci_config_readl(PCIDevice *d, 
uint32_t addr)
-{
-    PCIBus *s = d->bus;
-    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
-    return pci_data_read(s, addr, 4);
-}
-
-static uint32_t pci_config_readw(PCIDevice *d, uint32_t addr)
-{
-    PCIBus *s = d->bus;
-    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
-    return pci_data_read(s, addr, 2);
-}
-
-static uint32_t pci_config_readb(PCIDevice *d, uint32_t addr)
-{
-    PCIBus *s = d->bus;
-    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
-    return pci_data_read(s, addr, 1);
-}
-
-static void pci_set_io_region_addr(PCIDevice *d, int region_num, uint32_t addr)
-{
-    PCIIORegion *r;
-    uint16_t cmd;
-    uint32_t ofs;
-
-    if ( region_num == PCI_ROM_SLOT ) {
-        ofs = 0x30;
-    }else{
-        ofs = 0x10 + region_num * 4;
-    }
-
-    pci_config_writel(d, ofs, addr);
-    r = &d->io_regions[region_num];
-
-    /* enable memory mappings */
-    cmd = pci_config_readw(d, PCI_COMMAND);
-    if ( region_num == PCI_ROM_SLOT )
-        cmd |= 2;
-    else if (r->type & PCI_ADDRESS_SPACE_IO)
-        cmd |= 1;
-    else
-        cmd |= 2;
-    pci_config_writew(d, PCI_COMMAND, cmd);
-}
-
-static void pci_bios_init_device(PCIDevice *d)
-{
-    int class;
-    PCIIORegion *r;
-    uint32_t *paddr;
-    int i, pin, pic_irq, vendor_id, device_id;
-
-    class = pci_config_readw(d, PCI_CLASS_DEVICE);
-    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
-    device_id = pci_config_readw(d, PCI_DEVICE_ID);
-    switch(class) {
-    case 0x0101:
-        if (vendor_id == 0x8086 && device_id == 0x7010) {
-            /* PIIX3 IDE */
-            pci_config_writew(d, 0x40, 0x8000); // enable IDE0
-            pci_config_writew(d, 0x42, 0x8000); // enable IDE1
-            goto default_map;
-        } else {
-            /* IDE: we map it as in ISA mode */
-            pci_set_io_region_addr(d, 0, 0x1f0);
-            pci_set_io_region_addr(d, 1, 0x3f4);
-            pci_set_io_region_addr(d, 2, 0x170);
-            pci_set_io_region_addr(d, 3, 0x374);
-        }
-        break;
-    case 0x0680:
-        if (vendor_id == 0x8086 && device_id == 0x7113) {
-            /*
-             * PIIX4 ACPI PM.
-             * Special device with special PCI config space. No ordinary BARs.
-             */
-            pci_config_writew(d, 0x20, 0x0000); // No smb bus IO enable
-            pci_config_writew(d, 0x22, 0x0000);
-            pci_config_writew(d, 0x3c, 0x0009); // Hardcoded IRQ9
-            pci_config_writew(d, 0x3d, 0x0001);
-        }
-        break;
-    case 0x0300:
-        if (vendor_id != 0x1234)
-            goto default_map;
-        /* VGA: map frame buffer to default Bochs VBE address */
-        pci_set_io_region_addr(d, 0, 0xE0000000);
-        break;
-    case 0x0800:
-        /* PIC */
-        vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
-        device_id = pci_config_readw(d, PCI_DEVICE_ID);
-        if (vendor_id == 0x1014) {
-            /* IBM */
-            if (device_id == 0x0046 || device_id == 0xFFFF) {
-                /* MPIC & MPIC2 */
-                pci_set_io_region_addr(d, 0, 0x80800000 + 0x00040000);
-            }
-        }
-        break;
-    case 0xff00:
-        if (vendor_id == 0x0106b &&
-            (device_id == 0x0017 || device_id == 0x0022)) {
-            /* macio bridge */
-            pci_set_io_region_addr(d, 0, 0x80800000);
-        }
-        break;
-    default:
-    default_map:
-        /* default memory mappings */
-        for(i = 0; i < PCI_NUM_REGIONS; i++) {
-            r = &d->io_regions[i];
-            if (r->size) {
-                if (r->type & PCI_ADDRESS_SPACE_IO)
-                    paddr = &pci_bios_io_addr;
-                else
-                    paddr = &pci_bios_mem_addr;
-                *paddr = (*paddr + r->size - 1) & ~(r->size - 1);
-                pci_set_io_region_addr(d, i, *paddr);
-                *paddr += r->size;
-            }
-        }
-        break;
-    }
-
-    /* map the interrupt */
-    pin = pci_config_readb(d, PCI_INTERRUPT_PIN);
-    if (pin != 0) {
-        pin = pci_slot_get_pirq(d, pin - 1);
-        pic_irq = pci_irqs[pin];
-        pci_config_writeb(d, PCI_INTERRUPT_LINE, pic_irq);
-    }
-}
-
-/*
- * This function initializes the PCI devices as a normal PCI BIOS
- * would do. It is provided just in case the BIOS has no support for
- * PCI.
- */
-void pci_bios_init(void)
-{
-    int i, irq;
-    uint8_t elcr[2];
-
-    pci_bios_io_addr = 0xc000;
-    pci_bios_mem_addr = HVM_BELOW_4G_MMIO_START;
-
-    /* activate IRQ mappings */
-    elcr[0] = 0x00;
-    elcr[1] = 0x00;
-    for(i = 0; i < 4; i++) {
-        irq = pci_irqs[i];
-        /* set to trigger level */
-        elcr[irq >> 3] |= (1 << (irq & 7));
-        /* activate irq remapping in PIIX */
-        pci_config_writeb(piix3_dev, 0x60 + i, irq);
-    }
-    isa_outb(elcr[0], 0x4d0);
-    isa_outb(elcr[1], 0x4d1);
-
-    pci_for_each_device(pci_bios_init_device);
-}
-
+void pci_bios_init(void) {}
diff -r 2fd223c64fc6 -r cd40792968cb tools/ioemu/vl.c
--- a/tools/ioemu/vl.c  Thu Nov 23 17:46:52 2006 +0000
+++ b/tools/ioemu/vl.c  Thu Nov 23 17:54:06 2006 +0000
@@ -2530,6 +2530,7 @@ static CharDriverState *qemu_chr_open_tc
     int is_waitconnect = 1;
     const char *ptr;
     struct sockaddr_in saddr;
+    int opt;
 
     if (parse_host_port(&saddr, host_str) < 0)
         goto fail;
@@ -2598,6 +2599,8 @@ static CharDriverState *qemu_chr_open_tc
             }
         }
         s->fd = fd;
+       opt = 1;
+       setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&opt, sizeof(opt));
         if (s->connected)
             tcp_chr_connect(chr);
         else
diff -r 2fd223c64fc6 -r cd40792968cb xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Thu Nov 23 17:46:52 2006 +0000
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Nov 23 17:54:06 2006 +0000
@@ -1441,7 +1441,7 @@ static int svm_set_cr0(unsigned long val
     /* We don't want to lose PG.  ET is reserved and should be always be 1*/
     paging_enabled = svm_paging_enabled(v);
     value |= X86_CR0_ET;
-    vmcb->cr0 = value | X86_CR0_PG;
+    vmcb->cr0 = value | X86_CR0_PG | X86_CR0_WP;
     v->arch.hvm_svm.cpu_shadow_cr0 = value;
 
     /* TS cleared? Then initialise FPU now. */
@@ -2094,7 +2094,7 @@ static int svm_do_vmmcall_reset_to_realm
     vmcb->tsc_offset = 0;
 
     /* VMCB State */
-    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG;
+    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG | X86_CR0_WP;
     v->arch.hvm_svm.cpu_shadow_cr0 = X86_CR0_ET;
 
     vmcb->cr2 = 0;
diff -r 2fd223c64fc6 -r cd40792968cb xen/arch/x86/hvm/svm/vmcb.c
--- a/xen/arch/x86/hvm/svm/vmcb.c       Thu Nov 23 17:46:52 2006 +0000
+++ b/xen/arch/x86/hvm/svm/vmcb.c       Thu Nov 23 17:54:06 2006 +0000
@@ -197,6 +197,7 @@ static int construct_vmcb(struct vcpu *v
     /* Guest CR0. */
     vmcb->cr0 = read_cr0();
     arch_svm->cpu_shadow_cr0 = vmcb->cr0 & ~(X86_CR0_PG | X86_CR0_TS);
+    vmcb->cr0 |= X86_CR0_WP;
 
     /* Guest CR4. */
     arch_svm->cpu_shadow_cr4 =
diff -r 2fd223c64fc6 -r cd40792968cb xen/arch/x86/traps.c
--- a/xen/arch/x86/traps.c      Thu Nov 23 17:46:52 2006 +0000
+++ b/xen/arch/x86/traps.c      Thu Nov 23 17:54:06 2006 +0000
@@ -1026,8 +1026,6 @@ void host_to_guest_gpr_switch(struct cpu
     __attribute__((__regparm__(1)));
 unsigned long guest_to_host_gpr_switch(unsigned long)
     __attribute__((__regparm__(1)));
-typedef unsigned long (*io_emul_stub_t)(struct cpu_user_regs *)
-    __attribute__((__regparm__(1)));
 
 /* Instruction fetch with error handling. */
 #define insn_fetch(_type, _size, cs, eip)                                   \
@@ -1048,6 +1046,7 @@ static int emulate_privileged_op(struct 
     u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
     unsigned int port, i, op_bytes = 4, data, rc;
     char io_emul_stub[16];
+    void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1)));
     u32 l, h;
 
     /* Legacy prefixes. */
@@ -1190,6 +1189,9 @@ static int emulate_privileged_op(struct 
     *(s32 *)&io_emul_stub[9] =
         (char *)guest_to_host_gpr_switch - &io_emul_stub[13];
 
+    /* Handy function-typed pointer to the stub. */
+    io_emul = (void *)io_emul_stub;
+
     /* I/O Port and Interrupt Flag instructions. */
     switch ( opcode )
     {
@@ -1204,22 +1206,20 @@ static int emulate_privileged_op(struct 
         switch ( op_bytes )
         {
         case 1:
-            res = regs->eax & ~0xffUL;
             if ( guest_inb_okay(port, v, regs) )
-                regs->eax = res | (u8)((io_emul_stub_t)io_emul_stub)(regs);
+                io_emul(regs);
             else
-                regs->eax = res | (u8)~0;
+                regs->eax |= (u8)~0;
             break;
         case 2:
-            res = regs->eax & ~0xffffUL;
             if ( guest_inw_okay(port, v, regs) )
-                regs->eax = res | (u16)((io_emul_stub_t)io_emul_stub)(regs);
+                io_emul(regs);
             else
-                regs->eax = res | (u16)~0;
+                regs->eax |= (u16)~0;
             break;
         case 4:
             if ( guest_inl_okay(port, v, regs) )
-                regs->eax = (u32)((io_emul_stub_t)io_emul_stub)(regs);
+                io_emul(regs);
             else
                 regs->eax = (u32)~0;
             break;
@@ -1244,15 +1244,15 @@ static int emulate_privileged_op(struct 
         {
         case 1:
             if ( guest_outb_okay(port, v, regs) )
-                ((io_emul_stub_t)io_emul_stub)(regs);
+                io_emul(regs);
             break;
         case 2:
             if ( guest_outw_okay(port, v, regs) )
-                ((io_emul_stub_t)io_emul_stub)(regs);
+                io_emul(regs);
             break;
         case 4:
             if ( guest_outl_okay(port, v, regs) )
-                ((io_emul_stub_t)io_emul_stub)(regs);
+                io_emul(regs);
             break;
         }
         goto done;
diff -r 2fd223c64fc6 -r cd40792968cb xen/arch/x86/x86_emulate.c
--- a/xen/arch/x86/x86_emulate.c        Thu Nov 23 17:46:52 2006 +0000
+++ b/xen/arch/x86/x86_emulate.c        Thu Nov 23 17:54:06 2006 +0000
@@ -113,12 +113,10 @@ static uint8_t opcode_table[256] = {
     /* 0xA0 - 0xA7 */
     ByteOp|DstReg|SrcMem|Mov, DstReg|SrcMem|Mov,
     ByteOp|DstMem|SrcReg|Mov, DstMem|SrcReg|Mov,
-    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov,
-    ByteOp|ImplicitOps, ImplicitOps,
+    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov, 0, 0,
     /* 0xA8 - 0xAF */
     0, 0, ByteOp|ImplicitOps|Mov, ImplicitOps|Mov,
-    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov,
-    ByteOp|ImplicitOps, ImplicitOps,
+    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov, 0, 0,
     /* 0xB0 - 0xBF */
     0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
     /* 0xC0 - 0xC7 */
@@ -368,15 +366,16 @@ do{ __asm__ __volatile__ (              
 #endif /* __i386__ */
 
 /* Fetch next part of the instruction being emulated. */
-#define insn_fetch(_type, _size)                                        \
+#define _insn_fetch(_size)                                              \
 ({ unsigned long _x, _ptr = _regs.eip;                                  \
    if ( mode == X86EMUL_MODE_REAL ) _ptr += _regs.cs << 4;              \
    rc = ops->read_std(_ptr, &_x, (_size), ctxt);                        \
    if ( rc != 0 )                                                       \
        goto done;                                                       \
    _regs.eip += (_size);                                                \
-   (_type)_x;                                                           \
+   _x;                                                                  \
 })
+#define insn_fetch(_type) ((_type)_insn_fetch(sizeof(_type)))
 
 /* Access/update address held in a register, based on addressing mode. */
 #define register_address(sel, reg)                                      \
@@ -392,6 +391,17 @@ do {                                    
         (reg) = ((reg) & ~((1UL << (ad_bytes << 3)) - 1)) |             \
                 (((reg) + _inc) & ((1UL << (ad_bytes << 3)) - 1));      \
 } while (0)
+
+/*
+ * We cannot handle a page fault on a data access that straddles two pages
+ * and faults on the second page. This is because CR2 is not equal to the
+ * memory operand's effective address in this case. Rather than fix up the
+ * effective address it is okay for us to fail the emulation.
+ */
+#define page_boundary_test() do {                               \
+    if ( ((cr2 & (PAGE_SIZE-1)) == 0) && ((ea & 3) != 0) )      \
+        goto bad_ea;                                            \
+} while ( 0 )
 
 void *
 decode_register(
@@ -438,13 +448,13 @@ x86_emulate_memop(
     struct x86_emulate_ctxt *ctxt,
     struct x86_emulate_ops  *ops)
 {
-    uint8_t b, d, sib, twobyte = 0, rex_prefix = 0;
+    uint8_t b, d, sib, sib_index, sib_base, twobyte = 0, rex_prefix = 0;
     uint8_t modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0;
     uint16_t *seg = NULL; /* override segment */
     unsigned int op_bytes, ad_bytes, lock_prefix = 0, rep_prefix = 0, i;
     int rc = 0;
     struct operand src, dst;
-    unsigned long cr2 = ctxt->cr2;
+    unsigned long ea = 0, cr2 = ctxt->cr2;
     int mode = ctxt->mode;
 
     /* Shadow copy of register state. Committed on successful emulation. */
@@ -479,7 +489,7 @@ x86_emulate_memop(
     /* Legacy prefixes. */
     for ( i = 0; i < 8; i++ )
     {
-        switch ( b = insn_fetch(uint8_t, 1) )
+        switch ( b = insn_fetch(uint8_t) )
         {
         case 0x66: /* operand-size override */
             op_bytes ^= 6;      /* switch between 2/4 bytes */
@@ -526,11 +536,9 @@ x86_emulate_memop(
     if ( (mode == X86EMUL_MODE_PROT64) && ((b & 0xf0) == 0x40) )
     {
         rex_prefix = b;
-        if ( b & 8 )
-            op_bytes = 8;          /* REX.W */
-        modrm_reg = (b & 4) << 1;  /* REX.R */
-        /* REX.B and REX.X do not need to be decoded. */
-        b = insn_fetch(uint8_t, 1);
+        if ( b & 8 ) /* REX.W */
+            op_bytes = 8;
+        b = insn_fetch(uint8_t);
     }
 
     /* Opcode byte(s). */
@@ -541,7 +549,7 @@ x86_emulate_memop(
         if ( b == 0x0f )
         {
             twobyte = 1;
-            b = insn_fetch(uint8_t, 1);
+            b = insn_fetch(uint8_t);
             d = twobyte_table[b];
         }
 
@@ -553,10 +561,10 @@ x86_emulate_memop(
     /* ModRM and SIB bytes. */
     if ( d & ModRM )
     {
-        modrm = insn_fetch(uint8_t, 1);
-        modrm_mod |= (modrm & 0xc0) >> 6;
-        modrm_reg |= (modrm & 0x38) >> 3;
-        modrm_rm  |= (modrm & 0x07);
+        modrm = insn_fetch(uint8_t);
+        modrm_mod = (modrm & 0xc0) >> 6;
+        modrm_reg = ((rex_prefix & 4) << 1) | ((modrm & 0x38) >> 3);
+        modrm_rm  = modrm & 0x07;
 
         if ( modrm_mod == 3 )
         {
@@ -567,44 +575,74 @@ x86_emulate_memop(
         if ( ad_bytes == 2 )
         {
             /* 16-bit ModR/M decode. */
+            switch ( modrm_rm )
+            {
+            case 0: ea = _regs.ebx + _regs.esi; break;
+            case 1: ea = _regs.ebx + _regs.edi; break;
+            case 2: ea = _regs.ebp + _regs.esi; break;
+            case 3: ea = _regs.ebp + _regs.edi; break;
+            case 4: ea = _regs.esi; break;
+            case 5: ea = _regs.edi; break;
+            case 6: ea = _regs.ebp; break;
+            case 7: ea = _regs.ebx; break;
+            }
+            switch ( modrm_mod )
+            {
+            case 0: if ( modrm_rm == 6 ) ea = insn_fetch(uint16_t); break;
+            case 1: ea += insn_fetch(uint8_t);  break;
+            case 2: ea += insn_fetch(uint16_t); break;
+            }
+            ea = (uint16_t)ea;
+        }
+        else
+        {
+            /* 32/64-bit ModR/M decode. */
+            if ( modrm_rm == 4 )
+            {
+                sib = insn_fetch(uint8_t);
+                sib_index = ((sib >> 3) & 7) | ((modrm << 2) & 8);
+                sib_base  = (sib & 7) | ((modrm << 3) & 8);
+                if ( sib_index != 4 )
+                    ea = *(long *)decode_register(sib_index, &_regs, 0);
+                ea <<= (sib >> 6) & 3;
+                if ( (modrm_mod == 0) && ((sib_base & 7) == 5) )
+                    ea += insn_fetch(uint32_t);
+                else
+                    ea += *(long *)decode_register(sib_base, &_regs, 0);
+            }
+            else
+            {
+                modrm_rm |= (rex_prefix & 1) << 3;
+                ea = *(long *)decode_register(modrm_rm, &_regs, 0);
+            }
             switch ( modrm_mod )
             {
             case 0:
-                if ( modrm_rm == 6 )
-                    _regs.eip += 2; /* skip disp16 */
+                if ( (modrm_rm & 7) != 5 )
+                    break;
+                ea = insn_fetch(uint32_t);
+                if ( mode != X86EMUL_MODE_PROT64 )
+                    break;
+                /* Relative to RIP of next instruction. Argh! */
+                ea += _regs.eip;
+                if ( (d & SrcMask) == SrcImm )
+                    ea += (d & ByteOp) ? 1 : op_bytes;
+                else if ( (d & SrcMask) == SrcImmByte )
+                    ea += 1;
+                else if ( ((b == 0xf6) || (b == 0xf7)) &&
+                          ((modrm_reg & 7) <= 1) )
+                    /* Special case in Grp3: test has immediate operand. */
+                    ea += (d & ByteOp) ? 1
+                        : ((op_bytes == 8) ? 4 : op_bytes);
                 break;
-            case 1:
-                _regs.eip += 1; /* skip disp8 */
-                break;
-            case 2:
-                _regs.eip += 2; /* skip disp16 */
-                break;
+            case 1: ea += insn_fetch(uint8_t);  break;
+            case 2: ea += insn_fetch(uint32_t); break;
             }
-        }
-        else
-        {
-            /* 32/64-bit ModR/M decode. */
-            switch ( modrm_mod )
-            {
-            case 0:
-                if ( (modrm_rm == 4) && 
-                     (((sib = insn_fetch(uint8_t, 1)) & 7) == 5) )
-                    _regs.eip += 4; /* skip disp32 specified by SIB.base */
-                else if ( modrm_rm == 5 )
-                    _regs.eip += 4; /* skip disp32 */
-                break;
-            case 1:
-                if ( modrm_rm == 4 )
-                    sib = insn_fetch(uint8_t, 1);
-                _regs.eip += 1; /* skip disp8 */
-                break;
-            case 2:
-                if ( modrm_rm == 4 )
-                    sib = insn_fetch(uint8_t, 1);
-                _regs.eip += 4; /* skip disp32 */
-                break;
-            }
-        }
+            if ( ad_bytes == 4 )
+                ea = (uint32_t)ea;
+        }
+
+        page_boundary_test();
     }
 
     /* Decode and fetch the destination operand: register or memory. */
@@ -692,16 +730,16 @@ x86_emulate_memop(
         /* NB. Immediates are sign-extended as necessary. */
         switch ( src.bytes )
         {
-        case 1: src.val = insn_fetch(int8_t,  1); break;
-        case 2: src.val = insn_fetch(int16_t, 2); break;
-        case 4: src.val = insn_fetch(int32_t, 4); break;
+        case 1: src.val = insn_fetch(int8_t);  break;
+        case 2: src.val = insn_fetch(int16_t); break;
+        case 4: src.val = insn_fetch(int32_t); break;
         }
         break;
     case SrcImmByte:
         src.type  = OP_IMM;
         src.ptr   = (unsigned long *)_regs.eip;
         src.bytes = 1;
-        src.val   = insn_fetch(int8_t,  1);
+        src.val   = insn_fetch(int8_t);
         break;
     }
 
@@ -740,7 +778,7 @@ x86_emulate_memop(
         dst.val = (int32_t)src.val;
         break;
     case 0x80 ... 0x83: /* Grp1 */
-        switch ( modrm_reg )
+        switch ( modrm_reg & 7 )
         {
         case 0: goto add;
         case 1: goto or;
@@ -771,11 +809,13 @@ x86_emulate_memop(
     case 0xa0 ... 0xa1: /* mov */
         dst.ptr = (unsigned long *)&_regs.eax;
         dst.val = src.val;
-        _regs.eip += ad_bytes; /* skip src displacement */
+        ea = _insn_fetch(ad_bytes); /* src effective address */
+        page_boundary_test();
         break;
     case 0xa2 ... 0xa3: /* mov */
         dst.val = (unsigned long)_regs.eax;
-        _regs.eip += ad_bytes; /* skip dst displacement */
+        ea = _insn_fetch(ad_bytes); /* dst effective address */
+        page_boundary_test();
         break;
     case 0x88 ... 0x8b: /* mov */
     case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
@@ -798,7 +838,7 @@ x86_emulate_memop(
         register_address_increment(_regs.esp, dst.bytes);
         break;
     case 0xc0 ... 0xc1: grp2: /* Grp2 */
-        switch ( modrm_reg )
+        switch ( modrm_reg & 7 )
         {
         case 0: /* rol */
             emulate_2op_SrcB("rol", src, dst, _regs.eflags);
@@ -831,7 +871,7 @@ x86_emulate_memop(
         src.val = _regs.ecx;
         goto grp2;
     case 0xf6 ... 0xf7: /* Grp3 */
-        switch ( modrm_reg )
+        switch ( modrm_reg & 7 )
         {
         case 0 ... 1: /* test */
             /* Special case in Grp3: test has an immediate source operand. */
@@ -841,9 +881,9 @@ x86_emulate_memop(
             if ( src.bytes == 8 ) src.bytes = 4;
             switch ( src.bytes )
             {
-            case 1: src.val = insn_fetch(int8_t,  1); break;
-            case 2: src.val = insn_fetch(int16_t, 2); break;
-            case 4: src.val = insn_fetch(int32_t, 4); break;
+            case 1: src.val = insn_fetch(int8_t);  break;
+            case 2: src.val = insn_fetch(int16_t); break;
+            case 4: src.val = insn_fetch(int32_t); break;
             }
             goto test;
         case 2: /* not */
@@ -857,7 +897,7 @@ x86_emulate_memop(
         }
         break;
     case 0xfe ... 0xff: /* Grp4/Grp5 */
-        switch ( modrm_reg )
+        switch ( modrm_reg & 7 )
         {
         case 0: /* inc */
             emulate_1op("inc", dst, _regs.eflags);
@@ -955,6 +995,7 @@ x86_emulate_memop(
                                                       _regs.esi),
                                      &dst.val, dst.bytes, ctxt)) != 0 )
                 goto done;
+            ea = _regs.edi & ((1UL << (ad_bytes*8)) - 1UL);
         }
         else
         {
@@ -963,15 +1004,14 @@ x86_emulate_memop(
             if ( (rc = ops->read_emulated(cr2, &dst.val,
                                           dst.bytes, ctxt)) != 0 )
                 goto done;
+            ea = _regs.esi & ((1UL << (ad_bytes*8)) - 1UL);
         }
         register_address_increment(
             _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
         register_address_increment(
             _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
-        break;
-    case 0xa6 ... 0xa7: /* cmps */
-        dprintf("Urk! I don't handle CMPS.\n");
-        goto cannot_emulate;
+        page_boundary_test();
+        break;
     case 0xaa ... 0xab: /* stos */
         dst.type  = OP_MEM;
         dst.bytes = (d & ByteOp) ? 1 : op_bytes;
@@ -979,6 +1019,8 @@ x86_emulate_memop(
         dst.val   = _regs.eax;
         register_address_increment(
             _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
+        ea = _regs.edi & ((1UL << (ad_bytes*8)) - 1UL);
+        page_boundary_test();
         break;
     case 0xac ... 0xad: /* lods */
         dst.type  = OP_REG;
@@ -988,10 +1030,9 @@ x86_emulate_memop(
             goto done;
         register_address_increment(
             _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
-        break;
-    case 0xae ... 0xaf: /* scas */
-        dprintf("Urk! I don't handle SCAS.\n");
-        goto cannot_emulate;
+        ea = _regs.esi & ((1UL << (ad_bytes*8)) - 1UL);
+        page_boundary_test();
+        break;
     }
     goto writeback;
 
@@ -1151,6 +1192,10 @@ x86_emulate_memop(
  cannot_emulate:
     dprintf("Cannot emulate %02x\n", b);
     return -1;
+
+ bad_ea:
+    dprintf("Access faulted on page boundary (cr2=%lx,ea=%lx).\n", cr2, ea);
+    return -1;
 }
 
 #ifdef __XEN__
diff -r 2fd223c64fc6 -r cd40792968cb tools/firmware/hvmloader/pci_regs.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/firmware/hvmloader/pci_regs.h       Thu Nov 23 17:54:06 2006 +0000
@@ -0,0 +1,108 @@
+/*
+ *     pci_regs.h
+ *
+ *     PCI standard defines
+ *     Copyright 1994, Drew Eckhardt
+ *     Copyright 1997--1999 Martin Mares <mj@xxxxxx>
+ *
+ *     For more information, please consult the following manuals (look at
+ *     http://www.pcisig.com/ for how to get them):
+ *
+ *     PCI BIOS Specification
+ *     PCI Local Bus Specification
+ *     PCI to PCI Bridge Specification
+ *     PCI System Design Guide
+ */
+
+#ifndef __HVMLOADER_PCI_REGS_H__
+#define __HVMLOADER_PCI_REGS_H__
+
+#define PCI_VENDOR_ID          0x00    /* 16 bits */
+#define PCI_DEVICE_ID          0x02    /* 16 bits */
+#define PCI_COMMAND            0x04    /* 16 bits */
+#define  PCI_COMMAND_IO                0x1     /* Enable response in I/O space 
*/
+#define  PCI_COMMAND_MEMORY    0x2     /* Enable response in Memory space */
+#define  PCI_COMMAND_MASTER    0x4     /* Enable bus mastering */
+#define  PCI_COMMAND_SPECIAL   0x8     /* Enable response to special cycles */
+#define  PCI_COMMAND_INVALIDATE        0x10    /* Use memory write and 
invalidate */
+#define  PCI_COMMAND_VGA_PALETTE 0x20  /* Enable palette snooping */
+#define  PCI_COMMAND_PARITY    0x40    /* Enable parity checking */
+#define  PCI_COMMAND_WAIT      0x80    /* Enable address/data stepping */
+#define  PCI_COMMAND_SERR      0x100   /* Enable SERR */
+#define  PCI_COMMAND_FAST_BACK 0x200   /* Enable back-to-back writes */
+#define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
+
+#define PCI_STATUS             0x06    /* 16 bits */
+#define  PCI_STATUS_CAP_LIST   0x10    /* Support Capability List */
+#define  PCI_STATUS_66MHZ      0x20    /* Support 66 Mhz PCI 2.1 bus */
+#define  PCI_STATUS_UDF                0x40    /* Support User Definable 
Features [obsolete] */
+#define  PCI_STATUS_FAST_BACK  0x80    /* Accept fast-back to back */
+#define  PCI_STATUS_PARITY     0x100   /* Detected parity error */
+#define  PCI_STATUS_DEVSEL_MASK        0x600   /* DEVSEL timing */
+#define  PCI_STATUS_DEVSEL_FAST                0x000
+#define  PCI_STATUS_DEVSEL_MEDIUM      0x200
+#define  PCI_STATUS_DEVSEL_SLOW                0x400
+#define  PCI_STATUS_SIG_TARGET_ABORT   0x800 /* Set on target abort */
+#define  PCI_STATUS_REC_TARGET_ABORT   0x1000 /* Master ack of " */
+#define  PCI_STATUS_REC_MASTER_ABORT   0x2000 /* Set on master abort */
+#define  PCI_STATUS_SIG_SYSTEM_ERROR   0x4000 /* Set when we drive SERR */
+#define  PCI_STATUS_DETECTED_PARITY    0x8000 /* Set on parity error */
+
+#define PCI_CLASS_REVISION     0x08    /* High 24 bits are class, low 8 
revision */
+#define PCI_REVISION_ID                0x08    /* Revision ID */
+#define PCI_CLASS_PROG         0x09    /* Reg. Level Programming Interface */
+#define PCI_CLASS_DEVICE       0x0a    /* Device class */
+
+#define PCI_CACHE_LINE_SIZE    0x0c    /* 8 bits */
+#define PCI_LATENCY_TIMER      0x0d    /* 8 bits */
+#define PCI_HEADER_TYPE                0x0e    /* 8 bits */
+#define  PCI_HEADER_TYPE_NORMAL                0
+#define  PCI_HEADER_TYPE_BRIDGE                1
+#define  PCI_HEADER_TYPE_CARDBUS       2
+
+#define PCI_BIST               0x0f    /* 8 bits */
+#define  PCI_BIST_CODE_MASK    0x0f    /* Return result */
+#define  PCI_BIST_START                0x40    /* 1 to start BIST, 2 secs or 
less */
+#define  PCI_BIST_CAPABLE      0x80    /* 1 if BIST capable */
+
+/*
+ * Base addresses specify locations in memory or I/O space.
+ * Decoded size can be determined by writing a value of
+ * 0xffffffff to the register, and reading it back.  Only
+ * 1 bits are decoded.
+ */
+#define PCI_BASE_ADDRESS_0     0x10    /* 32 bits */
+#define PCI_BASE_ADDRESS_1     0x14    /* 32 bits [htype 0,1 only] */
+#define PCI_BASE_ADDRESS_2     0x18    /* 32 bits [htype 0 only] */
+#define PCI_BASE_ADDRESS_3     0x1c    /* 32 bits */
+#define PCI_BASE_ADDRESS_4     0x20    /* 32 bits */
+#define PCI_BASE_ADDRESS_5     0x24    /* 32 bits */
+#define  PCI_BASE_ADDRESS_SPACE                0x01    /* 0 = memory, 1 = I/O 
*/
+#define  PCI_BASE_ADDRESS_SPACE_IO     0x01
+#define  PCI_BASE_ADDRESS_SPACE_MEMORY 0x00
+#define  PCI_BASE_ADDRESS_MEM_TYPE_MASK        0x06
+#define  PCI_BASE_ADDRESS_MEM_TYPE_32  0x00    /* 32 bit address */
+#define  PCI_BASE_ADDRESS_MEM_TYPE_1M  0x02    /* Below 1M [obsolete] */
+#define  PCI_BASE_ADDRESS_MEM_TYPE_64  0x04    /* 64 bit address */
+#define  PCI_BASE_ADDRESS_MEM_PREFETCH 0x08    /* prefetchable? */
+#define  PCI_BASE_ADDRESS_MEM_MASK     (~0x0fUL)
+#define  PCI_BASE_ADDRESS_IO_MASK      (~0x03UL)
+/* bit 1 is reserved if address_space = 1 */
+
+/* Header type 0 (normal devices) */
+#define PCI_CARDBUS_CIS                0x28
+#define PCI_SUBSYSTEM_VENDOR_ID        0x2c
+#define PCI_SUBSYSTEM_ID       0x2e
+#define PCI_ROM_ADDRESS                0x30    /* Bits 31..11 are address, 
10..1 reserved */
+#define  PCI_ROM_ADDRESS_ENABLE        0x01
+#define PCI_ROM_ADDRESS_MASK   (~0x7ffUL)
+
+#define PCI_CAPABILITY_LIST    0x34    /* Offset of first capability list 
entry */
+
+/* 0x35-0x3b are reserved */
+#define PCI_INTERRUPT_LINE     0x3c    /* 8 bits */
+#define PCI_INTERRUPT_PIN      0x3d    /* 8 bits */
+#define PCI_MIN_GNT            0x3e    /* 8 bits */
+#define PCI_MAX_LAT            0x3f    /* 8 bits */
+
+#endif /* __HVMLOADER_PCI_REGS_H__ */

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.