ia64/xen-unstable

changeset 12565:cd40792968cb

Merge
author Tim Deegan <Tim.Deegan@xensource.com>
date Thu Nov 23 17:54:06 2006 +0000 (2006-11-23)
parents 2fd223c64fc6 3127a43786d8
children 6d892ea6194d
files
line diff
     1.1 --- a/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Nov 23 17:46:52 2006 +0000
     1.2 +++ b/linux-2.6-xen-sparse/drivers/xen/blkfront/blkfront.c	Thu Nov 23 17:54:06 2006 +0000
     1.3 @@ -138,10 +138,10 @@ static int blkfront_resume(struct xenbus
     1.4  
     1.5  	DPRINTK("blkfront_resume: %s\n", dev->nodename);
     1.6  
     1.7 -	blkif_free(info, 1);
     1.8 +	blkif_free(info, info->connected == BLKIF_STATE_CONNECTED);
     1.9  
    1.10  	err = talk_to_backend(dev, info);
    1.11 -	if (!err)
    1.12 +	if (info->connected == BLKIF_STATE_SUSPENDED && !err)
    1.13  		blkif_recover(info);
    1.14  
    1.15  	return err;
     2.1 --- a/tools/firmware/hvmloader/acpi/acpi2_0.h	Thu Nov 23 17:46:52 2006 +0000
     2.2 +++ b/tools/firmware/hvmloader/acpi/acpi2_0.h	Thu Nov 23 17:54:06 2006 +0000
     2.3 @@ -307,10 +307,20 @@ struct acpi_20_madt_ioapic {
     2.4      uint32_t gsi_base;
     2.5  };
     2.6  
     2.7 +struct acpi_20_madt_intsrcovr {
     2.8 +    uint8_t  type;
     2.9 +    uint8_t  length;
    2.10 +    uint8_t  bus;
    2.11 +    uint8_t  source;
    2.12 +    uint32_t gsi;
    2.13 +    uint16_t flags;
    2.14 +};
    2.15 +
    2.16  struct acpi_20_madt {
    2.17 -    struct acpi_20_madt_header header;
    2.18 -    struct acpi_20_madt_ioapic io_apic[1];
    2.19 -    struct acpi_20_madt_lapic  lapic[32];
    2.20 +    struct acpi_20_madt_header    header;
    2.21 +    struct acpi_20_madt_intsrcovr intsrcovr[4];
    2.22 +    struct acpi_20_madt_ioapic    io_apic[1];
    2.23 +    struct acpi_20_madt_lapic     lapic[32];
    2.24  };
    2.25  
    2.26  /*
     3.1 --- a/tools/firmware/hvmloader/acpi/dsdt.asl	Thu Nov 23 17:46:52 2006 +0000
     3.2 +++ b/tools/firmware/hvmloader/acpi/dsdt.asl	Thu Nov 23 17:54:06 2006 +0000
     3.3 @@ -77,15 +77,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
     3.4             Name (_UID, 0x00)
     3.5             Name (_ADR, 0x00)
     3.6             Name (_BBN, 0x00)
     3.7 -           OperationRegion (PIRP, PCI_Config, 0x3c, 0x10)
     3.8 -           Field(PIRP, ByteAcc, NoLock, Preserve){        
     3.9 -               IRQ3, 3,
    3.10 -               IRQ5, 5,
    3.11 -               IRQ7, 7,
    3.12 -               IRQ9, 9,
    3.13 -               IRQA, 10,
    3.14 -               IRQB, 11
    3.15 -           }
    3.16   
    3.17             Method (_CRS, 0, NotSerialized)
    3.18             {
    3.19 @@ -140,9 +131,7 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
    3.20              }
    3.21  
    3.22              Name(BUFA, ResourceTemplate() {
    3.23 -                IRQ(Level, ActiveLow, Shared) {
    3.24 -                    3,4,5,6,7,10,11,12,14,15
    3.25 -                }
    3.26 +                IRQ(Level, ActiveLow, Shared) { 5, 6, 10, 11 }
    3.27              })
    3.28  
    3.29              Name(BUFB, Buffer() {
    3.30 @@ -299,12 +288,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
    3.31              }
    3.32  
    3.33              Name(PRTP, Package() {
    3.34 -                /* Device 0, INTA - INTD */
    3.35 -                Package(){0x0000ffff, 0, \_SB.PCI0.LNKA, 0},
    3.36 -                Package(){0x0000ffff, 1, \_SB.PCI0.LNKB, 0},
    3.37 -                Package(){0x0000ffff, 2, \_SB.PCI0.LNKC, 0},
    3.38 -                Package(){0x0000ffff, 3, \_SB.PCI0.LNKD, 0},
    3.39 -
    3.40                  /* Device 1, INTA - INTD */
    3.41                  Package(){0x0001ffff, 0, \_SB.PCI0.LNKB, 0},
    3.42                  Package(){0x0001ffff, 1, \_SB.PCI0.LNKC, 0},
    3.43 @@ -397,12 +380,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 1, 
    3.44              })
    3.45  
    3.46              Name(PRTA, Package() {
    3.47 -                /* Device 0, INTA - INTD */
    3.48 -                Package(){0x0000ffff, 0, 0, 16},
    3.49 -                Package(){0x0000ffff, 1, 0, 17},
    3.50 -                Package(){0x0000ffff, 2, 0, 18},
    3.51 -                Package(){0x0000ffff, 3, 0, 19},
    3.52 -
    3.53                  /* Device 1, INTA - INTD */
    3.54                  Package(){0x0001ffff, 0, 0, 20},
    3.55                  Package(){0x0001ffff, 1, 0, 21},
     4.1 --- a/tools/firmware/hvmloader/acpi/dsdt.c	Thu Nov 23 17:46:52 2006 +0000
     4.2 +++ b/tools/firmware/hvmloader/acpi/dsdt.c	Thu Nov 23 17:54:06 2006 +0000
     4.3 @@ -5,15 +5,15 @@
     4.4   * Copyright (C) 2000 - 2005 Intel Corporation
     4.5   * Supports ACPI Specification Revision 3.0
     4.6   * 
     4.7 - * Compilation of "dsdt.asl" - Tue Nov 21 17:20:04 2006
     4.8 + * Compilation of "dsdt.asl" - Wed Nov 22 18:26:19 2006
     4.9   * 
    4.10   * C source code output
    4.11   *
    4.12   */
    4.13  unsigned char AmlCode[] = 
    4.14  {
    4.15 -    0x44,0x53,0x44,0x54,0x2A,0x0E,0x00,0x00,  /* 00000000    "DSDT*..." */
    4.16 -    0x01,0x18,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
    4.17 +    0x44,0x53,0x44,0x54,0x9D,0x0D,0x00,0x00,  /* 00000000    "DSDT...." */
    4.18 +    0x01,0x83,0x49,0x4E,0x54,0x45,0x4C,0x00,  /* 00000008    "..INTEL." */
    4.19      0x69,0x6E,0x74,0x2D,0x78,0x65,0x6E,0x00,  /* 00000010    "int-xen." */
    4.20      0xD6,0x07,0x00,0x00,0x49,0x4E,0x54,0x4C,  /* 00000018    "....INTL" */
    4.21      0x13,0x05,0x05,0x20,0x08,0x50,0x4D,0x42,  /* 00000020    "... .PMB" */
    4.22 @@ -34,7 +34,7 @@ unsigned char AmlCode[] =
    4.23      0x12,0x08,0x04,0x0A,0x07,0x0A,0x07,0x00,  /* 00000098    "........" */
    4.24      0x00,0x08,0x50,0x49,0x43,0x44,0x00,0x14,  /* 000000A0    "..PICD.." */
    4.25      0x0C,0x5F,0x50,0x49,0x43,0x01,0x70,0x68,  /* 000000A8    "._PIC.ph" */
    4.26 -    0x50,0x49,0x43,0x44,0x10,0x45,0xD7,0x5F,  /* 000000B0    "PICD.E._" */
    4.27 +    0x50,0x49,0x43,0x44,0x10,0x48,0xCE,0x5F,  /* 000000B0    "PICD.H._" */
    4.28      0x53,0x42,0x5F,0x5B,0x82,0x49,0x04,0x4D,  /* 000000B8    "SB_[.I.M" */
    4.29      0x45,0x4D,0x30,0x08,0x5F,0x48,0x49,0x44,  /* 000000C0    "EM0._HID" */
    4.30      0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x43,  /* 000000C8    ".A...._C" */
    4.31 @@ -45,426 +45,408 @@ unsigned char AmlCode[] =
    4.32      0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000000F0    "........" */
    4.33      0x00,0x00,0x00,0x00,0x00,0x00,0x0A,0x00,  /* 000000F8    "........" */
    4.34      0x00,0x00,0x00,0x00,0x79,0x00,0x5B,0x82,  /* 00000100    "....y.[." */
    4.35 -    0x42,0xD2,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "B.PCI0._" */
    4.36 +    0x45,0xC9,0x50,0x43,0x49,0x30,0x08,0x5F,  /* 00000108    "E.PCI0._" */
    4.37      0x48,0x49,0x44,0x0C,0x41,0xD0,0x0A,0x03,  /* 00000110    "HID.A..." */
    4.38      0x08,0x5F,0x55,0x49,0x44,0x00,0x08,0x5F,  /* 00000118    "._UID.._" */
    4.39      0x41,0x44,0x52,0x00,0x08,0x5F,0x42,0x42,  /* 00000120    "ADR.._BB" */
    4.40 -    0x4E,0x00,0x5B,0x80,0x50,0x49,0x52,0x50,  /* 00000128    "N.[.PIRP" */
    4.41 -    0x02,0x0A,0x3C,0x0A,0x10,0x5B,0x81,0x24,  /* 00000130    "..<..[.$" */
    4.42 -    0x50,0x49,0x52,0x50,0x01,0x49,0x52,0x51,  /* 00000138    "PIRP.IRQ" */
    4.43 -    0x33,0x03,0x49,0x52,0x51,0x35,0x05,0x49,  /* 00000140    "3.IRQ5.I" */
    4.44 -    0x52,0x51,0x37,0x07,0x49,0x52,0x51,0x39,  /* 00000148    "RQ7.IRQ9" */
    4.45 -    0x09,0x49,0x52,0x51,0x41,0x0A,0x49,0x52,  /* 00000150    ".IRQA.IR" */
    4.46 -    0x51,0x42,0x0B,0x14,0x44,0x08,0x5F,0x43,  /* 00000158    "QB..D._C" */
    4.47 -    0x52,0x53,0x00,0x08,0x50,0x52,0x54,0x30,  /* 00000160    "RS..PRT0" */
    4.48 -    0x11,0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,  /* 00000168    ".B..n..." */
    4.49 -    0x02,0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,  /* 00000170    "........" */
    4.50 -    0x00,0x00,0x00,0x00,0x01,0x47,0x01,0xF8,  /* 00000178    ".....G.." */
    4.51 -    0x0C,0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,  /* 00000180    "........" */
    4.52 -    0x01,0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,  /* 00000188    "........" */
    4.53 -    0x0C,0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,  /* 00000190    "........" */
    4.54 -    0x01,0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,  /* 00000198    "........" */
    4.55 -    0xFF,0x00,0x00,0x00,0xF3,0x87,0x17,0x00,  /* 000001A0    "........" */
    4.56 -    0x00,0x0C,0x03,0x00,0x00,0x00,0x00,0x00,  /* 000001A8    "........" */
    4.57 -    0x00,0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00,  /* 000001B0    "........" */
    4.58 -    0x00,0x00,0x00,0x00,0x00,0x02,0x00,0x87,  /* 000001B8    "........" */
    4.59 -    0x17,0x00,0x00,0x0D,0x03,0x00,0x00,0x00,  /* 000001C0    "........" */
    4.60 -    0x00,0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,  /* 000001C8    "........" */
    4.61 -    0xF4,0x00,0x00,0x00,0x00,0x00,0x00,0x00,  /* 000001D0    "........" */
    4.62 -    0x05,0x79,0x00,0xA4,0x50,0x52,0x54,0x30,  /* 000001D8    ".y..PRT0" */
    4.63 -    0x08,0x42,0x55,0x46,0x41,0x11,0x09,0x0A,  /* 000001E0    ".BUFA..." */
    4.64 -    0x06,0x23,0xF8,0xDC,0x18,0x79,0x00,0x08,  /* 000001E8    ".#...y.." */
    4.65 -    0x42,0x55,0x46,0x42,0x11,0x09,0x0A,0x06,  /* 000001F0    "BUFB...." */
    4.66 -    0x23,0x00,0x00,0x18,0x79,0x00,0x8B,0x42,  /* 000001F8    "#...y..B" */
    4.67 -    0x55,0x46,0x42,0x01,0x49,0x52,0x51,0x56,  /* 00000200    "UFB.IRQV" */
    4.68 -    0x5B,0x82,0x48,0x08,0x4C,0x4E,0x4B,0x41,  /* 00000208    "[.H.LNKA" */
    4.69 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000210    "._HID.A." */
    4.70 -    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000218    "..._UID." */
    4.71 -    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 00000220    ".._STA.{" */
    4.72 -    0x50,0x49,0x52,0x41,0x0A,0x80,0x60,0xA0,  /* 00000228    "PIRA..`." */
    4.73 -    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 00000230    "..`....." */
    4.74 -    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 00000238    "......._" */
    4.75 -    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 00000240    "PRS..BUF" */
    4.76 -    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 00000248    "A.._DIS." */
    4.77 -    0x7D,0x50,0x49,0x52,0x41,0x0A,0x80,0x50,  /* 00000250    "}PIRA..P" */
    4.78 -    0x49,0x52,0x41,0x14,0x1A,0x5F,0x43,0x52,  /* 00000258    "IRA.._CR" */
    4.79 -    0x53,0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,  /* 00000260    "S.{PIRA." */
    4.80 -    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 00000268    ".`y.`IRQ" */
    4.81 -    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 00000270    "V.BUFB.." */
    4.82 -    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 00000278    "_SRS..h." */
    4.83 -    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 00000280    "IRQ1.IRQ" */
    4.84 -    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 00000288    "1`v`p`PI" */
    4.85 -    0x52,0x41,0x5B,0x82,0x49,0x08,0x4C,0x4E,  /* 00000290    "RA[.I.LN" */
    4.86 -    0x4B,0x42,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000298    "KB._HID." */
    4.87 -    0x41,0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,  /* 000002A0    "A...._UI" */
    4.88 -    0x44,0x0A,0x02,0x14,0x1C,0x5F,0x53,0x54,  /* 000002A8    "D...._ST" */
    4.89 -    0x41,0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,  /* 000002B0    "A.{PIRB." */
    4.90 -    0x80,0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,  /* 000002B8    ".`...`.." */
    4.91 -    0xA4,0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,  /* 000002C0    "........" */
    4.92 -    0x14,0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,  /* 000002C8    ".._PRS.." */
    4.93 -    0x42,0x55,0x46,0x41,0x14,0x11,0x5F,0x44,  /* 000002D0    "BUFA.._D" */
    4.94 -    0x49,0x53,0x00,0x7D,0x50,0x49,0x52,0x42,  /* 000002D8    "IS.}PIRB" */
    4.95 -    0x0A,0x80,0x50,0x49,0x52,0x42,0x14,0x1A,  /* 000002E0    "..PIRB.." */
    4.96 -    0x5F,0x43,0x52,0x53,0x00,0x7B,0x50,0x49,  /* 000002E8    "_CRS.{PI" */
    4.97 -    0x52,0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,  /* 000002F0    "RB..`y.`" */
    4.98 -    0x49,0x52,0x51,0x56,0xA4,0x42,0x55,0x46,  /* 000002F8    "IRQV.BUF" */
    4.99 -    0x42,0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,  /* 00000300    "B.._SRS." */
   4.100 -    0x8B,0x68,0x01,0x49,0x52,0x51,0x31,0x82,  /* 00000308    ".h.IRQ1." */
   4.101 -    0x49,0x52,0x51,0x31,0x60,0x76,0x60,0x70,  /* 00000310    "IRQ1`v`p" */
   4.102 -    0x60,0x50,0x49,0x52,0x42,0x5B,0x82,0x49,  /* 00000318    "`PIRB[.I" */
   4.103 -    0x08,0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48,  /* 00000320    ".LNKC._H" */
   4.104 -    0x49,0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,  /* 00000328    "ID.A...." */
   4.105 -    0x5F,0x55,0x49,0x44,0x0A,0x03,0x14,0x1C,  /* 00000330    "_UID...." */
   4.106 -    0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,0x49,  /* 00000338    "_STA.{PI" */
   4.107 -    0x52,0x43,0x0A,0x80,0x60,0xA0,0x08,0x93,  /* 00000340    "RC..`..." */
   4.108 -    0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,  /* 00000348    "`......." */
   4.109 -    0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,  /* 00000350    "....._PR" */
   4.110 -    0x53,0x00,0xA4,0x42,0x55,0x46,0x41,0x14,  /* 00000358    "S..BUFA." */
   4.111 -    0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,  /* 00000360    "._DIS.}P" */
   4.112 -    0x49,0x52,0x43,0x0A,0x80,0x50,0x49,0x52,  /* 00000368    "IRC..PIR" */
   4.113 -    0x43,0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,  /* 00000370    "C.._CRS." */
   4.114 -    0x7B,0x50,0x49,0x52,0x43,0x0A,0x0F,0x60,  /* 00000378    "{PIRC..`" */
   4.115 -    0x79,0x01,0x60,0x49,0x52,0x51,0x56,0xA4,  /* 00000380    "y.`IRQV." */
   4.116 -    0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,  /* 00000388    "BUFB.._S" */
   4.117 -    0x52,0x53,0x01,0x8B,0x68,0x01,0x49,0x52,  /* 00000390    "RS..h.IR" */
   4.118 -    0x51,0x31,0x82,0x49,0x52,0x51,0x31,0x60,  /* 00000398    "Q1.IRQ1`" */
   4.119 -    0x76,0x60,0x70,0x60,0x50,0x49,0x52,0x43,  /* 000003A0    "v`p`PIRC" */
   4.120 -    0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,0x44,  /* 000003A8    "[.I.LNKD" */
   4.121 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 000003B0    "._HID.A." */
   4.122 -    0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,  /* 000003B8    "..._UID." */
   4.123 -    0x04,0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,  /* 000003C0    "..._STA." */
   4.124 -    0x7B,0x50,0x49,0x52,0x44,0x0A,0x80,0x60,  /* 000003C8    "{PIRD..`" */
   4.125 -    0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,  /* 000003D0    "...`...." */
   4.126 -    0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,  /* 000003D8    "........" */
   4.127 -    0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,0x55,  /* 000003E0    "_PRS..BU" */
   4.128 -    0x46,0x41,0x14,0x11,0x5F,0x44,0x49,0x53,  /* 000003E8    "FA.._DIS" */
   4.129 -    0x00,0x7D,0x50,0x49,0x52,0x44,0x0A,0x80,  /* 000003F0    ".}PIRD.." */
   4.130 -    0x50,0x49,0x52,0x44,0x14,0x1A,0x5F,0x43,  /* 000003F8    "PIRD.._C" */
   4.131 -    0x52,0x53,0x00,0x7B,0x50,0x49,0x52,0x44,  /* 00000400    "RS.{PIRD" */
   4.132 -    0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,0x52,  /* 00000408    "..`y.`IR" */
   4.133 -    0x51,0x56,0xA4,0x42,0x55,0x46,0x42,0x14,  /* 00000410    "QV.BUFB." */
   4.134 -    0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,  /* 00000418    "._SRS..h" */
   4.135 -    0x01,0x49,0x52,0x51,0x31,0x82,0x49,0x52,  /* 00000420    ".IRQ1.IR" */
   4.136 -    0x51,0x31,0x60,0x76,0x60,0x70,0x60,0x50,  /* 00000428    "Q1`v`p`P" */
   4.137 -    0x49,0x52,0x44,0x14,0x16,0x5F,0x50,0x52,  /* 00000430    "IRD.._PR" */
   4.138 -    0x54,0x00,0xA0,0x0A,0x50,0x49,0x43,0x44,  /* 00000438    "T...PICD" */
   4.139 -    0xA4,0x50,0x52,0x54,0x41,0xA4,0x50,0x52,  /* 00000440    ".PRTA.PR" */
   4.140 -    0x54,0x50,0x08,0x50,0x52,0x54,0x50,0x12,  /* 00000448    "TP.PRTP." */
   4.141 -    0x4B,0x39,0x40,0x12,0x0B,0x04,0x0B,0xFF,  /* 00000450    "K9@....." */
   4.142 -    0xFF,0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000458    "..LNKA.." */
   4.143 -    0x0B,0x04,0x0B,0xFF,0xFF,0x01,0x4C,0x4E,  /* 00000460    "......LN" */
   4.144 -    0x4B,0x42,0x00,0x12,0x0C,0x04,0x0B,0xFF,  /* 00000468    "KB......" */
   4.145 -    0xFF,0x0A,0x02,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000470    "...LNKC." */
   4.146 -    0x12,0x0C,0x04,0x0B,0xFF,0xFF,0x0A,0x03,  /* 00000478    "........" */
   4.147 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000480    "LNKD...." */
   4.148 -    0x0C,0xFF,0xFF,0x01,0x00,0x00,0x4C,0x4E,  /* 00000488    "......LN" */
   4.149 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000490    "KB......" */
   4.150 -    0xFF,0x01,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000498    "....LNKC" */
   4.151 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x01,  /* 000004A0    "........" */
   4.152 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 000004A8    "...LNKD." */
   4.153 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 000004B0    "........" */
   4.154 -    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 000004B8    "..LNKA.." */
   4.155 -    0x0D,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x00,  /* 000004C0    "........" */
   4.156 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 000004C8    "LNKC...." */
   4.157 -    0x0C,0xFF,0xFF,0x02,0x00,0x01,0x4C,0x4E,  /* 000004D0    "......LN" */
   4.158 -    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000004D8    "KD......" */
   4.159 -    0xFF,0x02,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000004E0    ".....LNK" */
   4.160 -    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000004E8    "A......." */
   4.161 -    0x02,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000004F0    "....LNKB" */
   4.162 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x03,  /* 000004F8    "........" */
   4.163 -    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 00000500    "..LNKD.." */
   4.164 -    0x0D,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,  /* 00000508    "........" */
   4.165 -    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 00000510    "LNKA...." */
   4.166 -    0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,0x4C,  /* 00000518    ".......L" */
   4.167 -    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 00000520    "NKB....." */
   4.168 -    0xFF,0xFF,0x03,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000528    "......LN" */
   4.169 -    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000530    "KC......" */
   4.170 -    0xFF,0x04,0x00,0x00,0x4C,0x4E,0x4B,0x41,  /* 00000538    "....LNKA" */
   4.171 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,  /* 00000540    "........" */
   4.172 -    0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000548    "..LNKB.." */
   4.173 -    0x0E,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,  /* 00000550    "........" */
   4.174 -    0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000558    ".LNKC..." */
   4.175 -    0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,0x03,  /* 00000560    "........" */
   4.176 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000568    "LNKD...." */
   4.177 -    0x0C,0xFF,0xFF,0x05,0x00,0x00,0x4C,0x4E,  /* 00000570    "......LN" */
   4.178 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000578    "KB......" */
   4.179 -    0xFF,0x05,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000580    "....LNKC" */
   4.180 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x05,  /* 00000588    "........" */
   4.181 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000590    "...LNKD." */
   4.182 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x05,0x00,  /* 00000598    "........" */
   4.183 -    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 000005A0    "..LNKA.." */
   4.184 -    0x0D,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x00,  /* 000005A8    "........" */
   4.185 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 000005B0    "LNKC...." */
   4.186 -    0x0C,0xFF,0xFF,0x06,0x00,0x01,0x4C,0x4E,  /* 000005B8    "......LN" */
   4.187 -    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000005C0    "KD......" */
   4.188 -    0xFF,0x06,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000005C8    ".....LNK" */
   4.189 -    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000005D0    "A......." */
   4.190 -    0x06,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000005D8    "....LNKB" */
   4.191 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x07,  /* 000005E0    "........" */
   4.192 -    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 000005E8    "..LNKD.." */
   4.193 -    0x0D,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x01,  /* 000005F0    "........" */
   4.194 -    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 000005F8    "LNKA...." */
   4.195 -    0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x02,0x4C,  /* 00000600    ".......L" */
   4.196 -    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 00000608    "NKB....." */
   4.197 -    0xFF,0xFF,0x07,0x00,0x0A,0x03,0x4C,0x4E,  /* 00000610    "......LN" */
   4.198 -    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000618    "KC......" */
   4.199 -    0xFF,0x08,0x00,0x00,0x4C,0x4E,0x4B,0x41,  /* 00000620    "....LNKA" */
   4.200 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x08,  /* 00000628    "........" */
   4.201 -    0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000630    "..LNKB.." */
   4.202 -    0x0E,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,  /* 00000638    "........" */
   4.203 -    0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000640    ".LNKC..." */
   4.204 -    0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,0x03,  /* 00000648    "........" */
   4.205 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000650    "LNKD...." */
   4.206 -    0x0C,0xFF,0xFF,0x09,0x00,0x00,0x4C,0x4E,  /* 00000658    "......LN" */
   4.207 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000660    "KB......" */
   4.208 -    0xFF,0x09,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000668    "....LNKC" */
   4.209 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x09,  /* 00000670    "........" */
   4.210 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000678    "...LNKD." */
   4.211 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x09,0x00,  /* 00000680    "........" */
   4.212 -    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000688    "..LNKA.." */
   4.213 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x00,  /* 00000690    "........" */
   4.214 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000698    "LNKC...." */
   4.215 -    0x0C,0xFF,0xFF,0x0A,0x00,0x01,0x4C,0x4E,  /* 000006A0    "......LN" */
   4.216 -    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000006A8    "KD......" */
   4.217 -    0xFF,0x0A,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 000006B0    ".....LNK" */
   4.218 -    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000006B8    "A......." */
   4.219 -    0x0A,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000006C0    "....LNKB" */
   4.220 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0B,  /* 000006C8    "........" */
   4.221 -    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 000006D0    "..LNKD.." */
   4.222 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x01,  /* 000006D8    "........" */
   4.223 -    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 000006E0    "LNKA...." */
   4.224 -    0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x02,0x4C,  /* 000006E8    ".......L" */
   4.225 -    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000006F0    "NKB....." */
   4.226 -    0xFF,0xFF,0x0B,0x00,0x0A,0x03,0x4C,0x4E,  /* 000006F8    "......LN" */
   4.227 -    0x4B,0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000700    "KC......" */
   4.228 -    0xFF,0x0C,0x00,0x00,0x4C,0x4E,0x4B,0x41,  /* 00000708    "....LNKA" */
   4.229 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000710    "........" */
   4.230 -    0x00,0x01,0x4C,0x4E,0x4B,0x42,0x00,0x12,  /* 00000718    "..LNKB.." */
   4.231 -    0x0E,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,  /* 00000720    "........" */
   4.232 -    0x02,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000728    ".LNKC..." */
   4.233 -    0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,0x03,  /* 00000730    "........" */
   4.234 -    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,  /* 00000738    "LNKD...." */
   4.235 -    0x0C,0xFF,0xFF,0x0D,0x00,0x00,0x4C,0x4E,  /* 00000740    "......LN" */
   4.236 -    0x4B,0x42,0x00,0x12,0x0D,0x04,0x0C,0xFF,  /* 00000748    "KB......" */
   4.237 -    0xFF,0x0D,0x00,0x01,0x4C,0x4E,0x4B,0x43,  /* 00000750    "....LNKC" */
   4.238 -    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0D,  /* 00000758    "........" */
   4.239 -    0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000760    "...LNKD." */
   4.240 -    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0D,0x00,  /* 00000768    "........" */
   4.241 -    0x0A,0x03,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000770    "..LNKA.." */
   4.242 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x00,  /* 00000778    "........" */
   4.243 -    0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0D,0x04,  /* 00000780    "LNKC...." */
   4.244 -    0x0C,0xFF,0xFF,0x0E,0x00,0x01,0x4C,0x4E,  /* 00000788    "......LN" */
   4.245 -    0x4B,0x44,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 00000790    "KD......" */
   4.246 -    0xFF,0x0E,0x00,0x0A,0x02,0x4C,0x4E,0x4B,  /* 00000798    ".....LNK" */
   4.247 -    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000007A0    "A......." */
   4.248 -    0x0E,0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x42,  /* 000007A8    "....LNKB" */
   4.249 -    0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0F,  /* 000007B0    "........" */
   4.250 -    0x00,0x00,0x4C,0x4E,0x4B,0x44,0x00,0x12,  /* 000007B8    "..LNKD.." */
   4.251 -    0x0D,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x01,  /* 000007C0    "........" */
   4.252 -    0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0E,0x04,  /* 000007C8    "LNKA...." */
   4.253 -    0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x02,0x4C,  /* 000007D0    ".......L" */
   4.254 -    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000007D8    "NKB....." */
   4.255 -    0xFF,0xFF,0x0F,0x00,0x0A,0x03,0x4C,0x4E,  /* 000007E0    "......LN" */
   4.256 -    0x4B,0x43,0x00,0x08,0x50,0x52,0x54,0x41,  /* 000007E8    "KC..PRTA" */
   4.257 -    0x12,0x4B,0x31,0x40,0x12,0x09,0x04,0x0B,  /* 000007F0    ".K1@...." */
   4.258 -    0xFF,0xFF,0x00,0x00,0x0A,0x10,0x12,0x09,  /* 000007F8    "........" */
   4.259 -    0x04,0x0B,0xFF,0xFF,0x01,0x00,0x0A,0x11,  /* 00000800    "........" */
   4.260 -    0x12,0x0A,0x04,0x0B,0xFF,0xFF,0x0A,0x02,  /* 00000808    "........" */
   4.261 -    0x00,0x0A,0x12,0x12,0x0A,0x04,0x0B,0xFF,  /* 00000810    "........" */
   4.262 -    0xFF,0x0A,0x03,0x00,0x0A,0x13,0x12,0x0B,  /* 00000818    "........" */
   4.263 -    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x00,0x00,  /* 00000820    "........" */
   4.264 -    0x0A,0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000828    "........" */
   4.265 -    0x01,0x00,0x01,0x00,0x0A,0x15,0x12,0x0C,  /* 00000830    "........" */
   4.266 -    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 00000838    "........" */
   4.267 -    0x00,0x0A,0x16,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000840    "........" */
   4.268 -    0xFF,0x01,0x00,0x0A,0x03,0x00,0x0A,0x17,  /* 00000848    "........" */
   4.269 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000850    "........" */
   4.270 -    0x00,0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,  /* 00000858    "........" */
   4.271 -    0xFF,0xFF,0x02,0x00,0x01,0x00,0x0A,0x19,  /* 00000860    "........" */
   4.272 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000868    "........" */
   4.273 -    0x0A,0x02,0x00,0x0A,0x1A,0x12,0x0C,0x04,  /* 00000870    "........" */
   4.274 -    0x0C,0xFF,0xFF,0x02,0x00,0x0A,0x03,0x00,  /* 00000878    "........" */
   4.275 -    0x0A,0x1B,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000880    "........" */
   4.276 -    0x03,0x00,0x00,0x00,0x0A,0x1C,0x12,0x0B,  /* 00000888    "........" */
   4.277 -    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x01,0x00,  /* 00000890    "........" */
   4.278 -    0x0A,0x1D,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000898    "........" */
   4.279 -    0x03,0x00,0x0A,0x02,0x00,0x0A,0x1E,0x12,  /* 000008A0    "........" */
   4.280 -    0x0C,0x04,0x0C,0xFF,0xFF,0x03,0x00,0x0A,  /* 000008A8    "........" */
   4.281 -    0x03,0x00,0x0A,0x1F,0x12,0x0B,0x04,0x0C,  /* 000008B0    "........" */
   4.282 -    0xFF,0xFF,0x04,0x00,0x00,0x00,0x0A,0x20,  /* 000008B8    "....... " */
   4.283 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000008C0    "........" */
   4.284 -    0x01,0x00,0x0A,0x21,0x12,0x0C,0x04,0x0C,  /* 000008C8    "...!...." */
   4.285 -    0xFF,0xFF,0x04,0x00,0x0A,0x02,0x00,0x0A,  /* 000008D0    "........" */
   4.286 -    0x22,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x04,  /* 000008D8    ""......." */
   4.287 -    0x00,0x0A,0x03,0x00,0x0A,0x23,0x12,0x0B,  /* 000008E0    ".....#.." */
   4.288 -    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x00,0x00,  /* 000008E8    "........" */
   4.289 -    0x0A,0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 000008F0    ".$......" */
   4.290 -    0x05,0x00,0x01,0x00,0x0A,0x25,0x12,0x0C,  /* 000008F8    ".....%.." */
   4.291 -    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,  /* 00000900    "........" */
   4.292 -    0x00,0x0A,0x26,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000908    "..&....." */
   4.293 -    0xFF,0x05,0x00,0x0A,0x03,0x00,0x0A,0x27,  /* 00000910    ".......'" */
   4.294 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000918    "........" */
   4.295 -    0x00,0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,  /* 00000920    "...(...." */
   4.296 -    0xFF,0xFF,0x06,0x00,0x01,0x00,0x0A,0x29,  /* 00000928    ".......)" */
   4.297 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000930    "........" */
   4.298 -    0x0A,0x02,0x00,0x0A,0x2A,0x12,0x0C,0x04,  /* 00000938    "....*..." */
   4.299 -    0x0C,0xFF,0xFF,0x06,0x00,0x0A,0x03,0x00,  /* 00000940    "........" */
   4.300 -    0x0A,0x2B,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000948    ".+......" */
   4.301 -    0x07,0x00,0x00,0x00,0x0A,0x2C,0x12,0x0B,  /* 00000950    ".....,.." */
   4.302 -    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x01,0x00,  /* 00000958    "........" */
   4.303 -    0x0A,0x2D,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000960    ".-......" */
   4.304 -    0x07,0x00,0x0A,0x02,0x00,0x0A,0x2E,0x12,  /* 00000968    "........" */
   4.305 -    0x0C,0x04,0x0C,0xFF,0xFF,0x07,0x00,0x0A,  /* 00000970    "........" */
   4.306 -    0x03,0x00,0x0A,0x2F,0x12,0x0B,0x04,0x0C,  /* 00000978    ".../...." */
   4.307 -    0xFF,0xFF,0x08,0x00,0x00,0x00,0x0A,0x11,  /* 00000980    "........" */
   4.308 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 00000988    "........" */
   4.309 -    0x01,0x00,0x0A,0x12,0x12,0x0C,0x04,0x0C,  /* 00000990    "........" */
   4.310 -    0xFF,0xFF,0x08,0x00,0x0A,0x02,0x00,0x0A,  /* 00000998    "........" */
   4.311 -    0x13,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x08,  /* 000009A0    "........" */
   4.312 -    0x00,0x0A,0x03,0x00,0x0A,0x14,0x12,0x0B,  /* 000009A8    "........" */
   4.313 -    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x00,0x00,  /* 000009B0    "........" */
   4.314 -    0x0A,0x15,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 000009B8    "........" */
   4.315 -    0x09,0x00,0x01,0x00,0x0A,0x16,0x12,0x0C,  /* 000009C0    "........" */
   4.316 -    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02,  /* 000009C8    "........" */
   4.317 -    0x00,0x0A,0x17,0x12,0x0C,0x04,0x0C,0xFF,  /* 000009D0    "........" */
   4.318 -    0xFF,0x09,0x00,0x0A,0x03,0x00,0x0A,0x18,  /* 000009D8    "........" */
   4.319 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 000009E0    "........" */
   4.320 -    0x00,0x00,0x0A,0x19,0x12,0x0B,0x04,0x0C,  /* 000009E8    "........" */
   4.321 -    0xFF,0xFF,0x0A,0x00,0x01,0x00,0x0A,0x1A,  /* 000009F0    "........" */
   4.322 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 000009F8    "........" */
   4.323 -    0x0A,0x02,0x00,0x0A,0x1B,0x12,0x0C,0x04,  /* 00000A00    "........" */
   4.324 -    0x0C,0xFF,0xFF,0x0A,0x00,0x0A,0x03,0x00,  /* 00000A08    "........" */
   4.325 -    0x0A,0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A10    "........" */
   4.326 -    0x0B,0x00,0x00,0x00,0x0A,0x1D,0x12,0x0B,  /* 00000A18    "........" */
   4.327 -    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x01,0x00,  /* 00000A20    "........" */
   4.328 -    0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000A28    "........" */
   4.329 -    0x0B,0x00,0x0A,0x02,0x00,0x0A,0x1F,0x12,  /* 00000A30    "........" */
   4.330 -    0x0C,0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x0A,  /* 00000A38    "........" */
   4.331 -    0x03,0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,  /* 00000A40    "... ...." */
   4.332 -    0xFF,0xFF,0x0C,0x00,0x00,0x00,0x0A,0x21,  /* 00000A48    ".......!" */
   4.333 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 00000A50    "........" */
   4.334 -    0x01,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C,  /* 00000A58    "..."...." */
   4.335 -    0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x00,0x0A,  /* 00000A60    "........" */
   4.336 -    0x23,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0C,  /* 00000A68    "#......." */
   4.337 -    0x00,0x0A,0x03,0x00,0x0A,0x24,0x12,0x0B,  /* 00000A70    ".....$.." */
   4.338 -    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x00,0x00,  /* 00000A78    "........" */
   4.339 -    0x0A,0x25,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000A80    ".%......" */
   4.340 -    0x0D,0x00,0x01,0x00,0x0A,0x26,0x12,0x0C,  /* 00000A88    ".....&.." */
   4.341 -    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02,  /* 00000A90    "........" */
   4.342 -    0x00,0x0A,0x27,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000A98    "..'....." */
   4.343 -    0xFF,0x0D,0x00,0x0A,0x03,0x00,0x0A,0x28,  /* 00000AA0    ".......(" */
   4.344 -    0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000AA8    "........" */
   4.345 -    0x00,0x00,0x0A,0x29,0x12,0x0B,0x04,0x0C,  /* 00000AB0    "...)...." */
   4.346 -    0xFF,0xFF,0x0E,0x00,0x01,0x00,0x0A,0x2A,  /* 00000AB8    ".......*" */
   4.347 -    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000AC0    "........" */
   4.348 -    0x0A,0x02,0x00,0x0A,0x2B,0x12,0x0C,0x04,  /* 00000AC8    "....+..." */
   4.349 -    0x0C,0xFF,0xFF,0x0E,0x00,0x0A,0x03,0x00,  /* 00000AD0    "........" */
   4.350 -    0x0A,0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,  /* 00000AD8    ".,......" */
   4.351 -    0x0F,0x00,0x00,0x00,0x0A,0x2D,0x12,0x0B,  /* 00000AE0    ".....-.." */
   4.352 -    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x01,0x00,  /* 00000AE8    "........" */
   4.353 -    0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000AF0    "........" */
   4.354 -    0x0F,0x00,0x0A,0x02,0x00,0x0A,0x2F,0x12,  /* 00000AF8    "....../." */
   4.355 -    0x0C,0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x0A,  /* 00000B00    "........" */
   4.356 -    0x03,0x00,0x0A,0x10,0x5B,0x82,0x4C,0x31,  /* 00000B08    "....[.L1" */
   4.357 -    0x49,0x53,0x41,0x5F,0x08,0x5F,0x41,0x44,  /* 00000B10    "ISA_._AD" */
   4.358 -    0x52,0x0C,0x00,0x00,0x01,0x00,0x5B,0x80,  /* 00000B18    "R.....[." */
   4.359 -    0x50,0x49,0x52,0x51,0x02,0x0A,0x60,0x0A,  /* 00000B20    "PIRQ..`." */
   4.360 -    0x04,0x10,0x2E,0x5C,0x00,0x5B,0x81,0x29,  /* 00000B28    "...\.[.)" */
   4.361 -    0x5C,0x2F,0x04,0x5F,0x53,0x42,0x5F,0x50,  /* 00000B30    "\/._SB_P" */
   4.362 -    0x43,0x49,0x30,0x49,0x53,0x41,0x5F,0x50,  /* 00000B38    "CI0ISA_P" */
   4.363 -    0x49,0x52,0x51,0x01,0x50,0x49,0x52,0x41,  /* 00000B40    "IRQ.PIRA" */
   4.364 -    0x08,0x50,0x49,0x52,0x42,0x08,0x50,0x49,  /* 00000B48    ".PIRB.PI" */
   4.365 -    0x52,0x43,0x08,0x50,0x49,0x52,0x44,0x08,  /* 00000B50    "RC.PIRD." */
   4.366 -    0x5B,0x82,0x46,0x0B,0x53,0x59,0x53,0x52,  /* 00000B58    "[.F.SYSR" */
   4.367 -    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000B60    "._HID.A." */
   4.368 -    0x0C,0x02,0x08,0x5F,0x55,0x49,0x44,0x01,  /* 00000B68    "..._UID." */
   4.369 -    0x08,0x43,0x52,0x53,0x5F,0x11,0x4E,0x08,  /* 00000B70    ".CRS_.N." */
   4.370 -    0x0A,0x8A,0x47,0x01,0x10,0x00,0x10,0x00,  /* 00000B78    "..G....." */
   4.371 -    0x00,0x10,0x47,0x01,0x22,0x00,0x22,0x00,  /* 00000B80    "..G."."." */
   4.372 -    0x00,0x0C,0x47,0x01,0x30,0x00,0x30,0x00,  /* 00000B88    "..G.0.0." */
   4.373 -    0x00,0x10,0x47,0x01,0x44,0x00,0x44,0x00,  /* 00000B90    "..G.D.D." */
   4.374 -    0x00,0x1C,0x47,0x01,0x62,0x00,0x62,0x00,  /* 00000B98    "..G.b.b." */
   4.375 -    0x00,0x02,0x47,0x01,0x65,0x00,0x65,0x00,  /* 00000BA0    "..G.e.e." */
   4.376 -    0x00,0x0B,0x47,0x01,0x72,0x00,0x72,0x00,  /* 00000BA8    "..G.r.r." */
   4.377 -    0x00,0x0E,0x47,0x01,0x80,0x00,0x80,0x00,  /* 00000BB0    "..G....." */
   4.378 -    0x00,0x01,0x47,0x01,0x84,0x00,0x84,0x00,  /* 00000BB8    "..G....." */
   4.379 -    0x00,0x03,0x47,0x01,0x88,0x00,0x88,0x00,  /* 00000BC0    "..G....." */
   4.380 -    0x00,0x01,0x47,0x01,0x8C,0x00,0x8C,0x00,  /* 00000BC8    "..G....." */
   4.381 -    0x00,0x03,0x47,0x01,0x90,0x00,0x90,0x00,  /* 00000BD0    "..G....." */
   4.382 -    0x00,0x10,0x47,0x01,0xA2,0x00,0xA2,0x00,  /* 00000BD8    "..G....." */
   4.383 -    0x00,0x1C,0x47,0x01,0xE0,0x00,0xE0,0x00,  /* 00000BE0    "..G....." */
   4.384 -    0x00,0x10,0x47,0x01,0xA0,0x08,0xA0,0x08,  /* 00000BE8    "..G....." */
   4.385 -    0x00,0x04,0x47,0x01,0xC0,0x0C,0xC0,0x0C,  /* 00000BF0    "..G....." */
   4.386 -    0x00,0x10,0x47,0x01,0xD0,0x04,0xD0,0x04,  /* 00000BF8    "..G....." */
   4.387 -    0x00,0x02,0x79,0x00,0x14,0x0B,0x5F,0x43,  /* 00000C00    "..y..._C" */
   4.388 -    0x52,0x53,0x00,0xA4,0x43,0x52,0x53,0x5F,  /* 00000C08    "RS..CRS_" */
   4.389 -    0x5B,0x82,0x2B,0x50,0x49,0x43,0x5F,0x08,  /* 00000C10    "[.+PIC_." */
   4.390 -    0x5F,0x48,0x49,0x44,0x0B,0x41,0xD0,0x08,  /* 00000C18    "_HID.A.." */
   4.391 -    0x5F,0x43,0x52,0x53,0x11,0x18,0x0A,0x15,  /* 00000C20    "_CRS...." */
   4.392 -    0x47,0x01,0x20,0x00,0x20,0x00,0x01,0x02,  /* 00000C28    "G. . ..." */
   4.393 -    0x47,0x01,0xA0,0x00,0xA0,0x00,0x01,0x02,  /* 00000C30    "G......." */
   4.394 -    0x22,0x04,0x00,0x79,0x00,0x5B,0x82,0x47,  /* 00000C38    ""..y.[.G" */
   4.395 -    0x05,0x44,0x4D,0x41,0x30,0x08,0x5F,0x48,  /* 00000C40    ".DMA0._H" */
   4.396 -    0x49,0x44,0x0C,0x41,0xD0,0x02,0x00,0x08,  /* 00000C48    "ID.A...." */
   4.397 -    0x5F,0x43,0x52,0x53,0x11,0x41,0x04,0x0A,  /* 00000C50    "_CRS.A.." */
   4.398 -    0x3D,0x2A,0x10,0x04,0x47,0x01,0x00,0x00,  /* 00000C58    "=*..G..." */
   4.399 -    0x00,0x00,0x00,0x10,0x47,0x01,0x81,0x00,  /* 00000C60    "....G..." */
   4.400 -    0x81,0x00,0x00,0x03,0x47,0x01,0x87,0x00,  /* 00000C68    "....G..." */
   4.401 -    0x87,0x00,0x00,0x01,0x47,0x01,0x89,0x00,  /* 00000C70    "....G..." */
   4.402 -    0x89,0x00,0x00,0x03,0x47,0x01,0x8F,0x00,  /* 00000C78    "....G..." */
   4.403 -    0x8F,0x00,0x00,0x01,0x47,0x01,0xC0,0x00,  /* 00000C80    "....G..." */
   4.404 -    0xC0,0x00,0x00,0x20,0x47,0x01,0x80,0x04,  /* 00000C88    "... G..." */
   4.405 -    0x80,0x04,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000C90    "....y.[." */
   4.406 -    0x25,0x54,0x4D,0x52,0x5F,0x08,0x5F,0x48,  /* 00000C98    "%TMR_._H" */
   4.407 -    0x49,0x44,0x0C,0x41,0xD0,0x01,0x00,0x08,  /* 00000CA0    "ID.A...." */
   4.408 -    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000CA8    "_CRS...." */
   4.409 -    0x47,0x01,0x40,0x00,0x40,0x00,0x00,0x04,  /* 00000CB0    "G.@.@..." */
   4.410 -    0x22,0x01,0x00,0x79,0x00,0x5B,0x82,0x25,  /* 00000CB8    ""..y.[.%" */
   4.411 -    0x52,0x54,0x43,0x5F,0x08,0x5F,0x48,0x49,  /* 00000CC0    "RTC_._HI" */
   4.412 -    0x44,0x0C,0x41,0xD0,0x0B,0x00,0x08,0x5F,  /* 00000CC8    "D.A...._" */
   4.413 -    0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,0x47,  /* 00000CD0    "CRS....G" */
   4.414 -    0x01,0x70,0x00,0x70,0x00,0x00,0x02,0x22,  /* 00000CD8    ".p.p..."" */
   4.415 -    0x00,0x01,0x79,0x00,0x5B,0x82,0x22,0x53,  /* 00000CE0    "..y.[."S" */
   4.416 -    0x50,0x4B,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000CE8    "PKR._HID" */
   4.417 -    0x0C,0x41,0xD0,0x08,0x00,0x08,0x5F,0x43,  /* 00000CF0    ".A...._C" */
   4.418 -    0x52,0x53,0x11,0x0D,0x0A,0x0A,0x47,0x01,  /* 00000CF8    "RS....G." */
   4.419 -    0x61,0x00,0x61,0x00,0x00,0x01,0x79,0x00,  /* 00000D00    "a.a...y." */
   4.420 -    0x5B,0x82,0x31,0x50,0x53,0x32,0x4D,0x08,  /* 00000D08    "[.1PS2M." */
   4.421 -    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0F,  /* 00000D10    "_HID.A.." */
   4.422 -    0x13,0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,  /* 00000D18    ".._CID.A" */
   4.423 -    0xD0,0x0F,0x13,0x14,0x09,0x5F,0x53,0x54,  /* 00000D20    "....._ST" */
   4.424 -    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000D28    "A....._C" */
   4.425 -    0x52,0x53,0x11,0x08,0x0A,0x05,0x22,0x00,  /* 00000D30    "RS...."." */
   4.426 -    0x10,0x79,0x00,0x5B,0x82,0x42,0x04,0x50,  /* 00000D38    ".y.[.B.P" */
   4.427 -    0x53,0x32,0x4B,0x08,0x5F,0x48,0x49,0x44,  /* 00000D40    "S2K._HID" */
   4.428 -    0x0C,0x41,0xD0,0x03,0x03,0x08,0x5F,0x43,  /* 00000D48    ".A...._C" */
   4.429 -    0x49,0x44,0x0C,0x41,0xD0,0x03,0x0B,0x14,  /* 00000D50    "ID.A...." */
   4.430 -    0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,  /* 00000D58    "._STA..." */
   4.431 -    0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,0x18,  /* 00000D60    ".._CRS.." */
   4.432 -    0x0A,0x15,0x47,0x01,0x60,0x00,0x60,0x00,  /* 00000D68    "..G.`.`." */
   4.433 -    0x00,0x01,0x47,0x01,0x64,0x00,0x64,0x00,  /* 00000D70    "..G.d.d." */
   4.434 -    0x00,0x01,0x22,0x02,0x00,0x79,0x00,0x5B,  /* 00000D78    ".."..y.[" */
   4.435 -    0x82,0x3A,0x46,0x44,0x43,0x30,0x08,0x5F,  /* 00000D80    ".:FDC0._" */
   4.436 -    0x48,0x49,0x44,0x0C,0x41,0xD0,0x07,0x00,  /* 00000D88    "HID.A..." */
   4.437 -    0x14,0x09,0x5F,0x53,0x54,0x41,0x00,0xA4,  /* 00000D90    ".._STA.." */
   4.438 -    0x0A,0x0F,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000D98    "..._CRS." */
   4.439 -    0x1B,0x0A,0x18,0x47,0x01,0xF0,0x03,0xF0,  /* 00000DA0    "...G...." */
   4.440 -    0x03,0x01,0x06,0x47,0x01,0xF7,0x03,0xF7,  /* 00000DA8    "...G...." */
   4.441 -    0x03,0x01,0x01,0x22,0x40,0x00,0x2A,0x04,  /* 00000DB0    "..."@.*." */
   4.442 -    0x00,0x79,0x00,0x5B,0x82,0x35,0x55,0x41,  /* 00000DB8    ".y.[.5UA" */
   4.443 -    0x52,0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000DC0    "R1._HID." */
   4.444 -    0x41,0xD0,0x05,0x01,0x08,0x5F,0x55,0x49,  /* 00000DC8    "A...._UI" */
   4.445 -    0x44,0x01,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000DD0    "D..._STA" */
   4.446 -    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000DD8    "....._CR" */
   4.447 -    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0xF8,  /* 00000DE0    "S....G.." */
   4.448 -    0x03,0xF8,0x03,0x01,0x08,0x22,0x10,0x00,  /* 00000DE8    ".....".." */
   4.449 -    0x79,0x00,0x5B,0x82,0x36,0x4C,0x54,0x50,  /* 00000DF0    "y.[.6LTP" */
   4.450 -    0x31,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000DF8    "1._HID.A" */
   4.451 -    0xD0,0x04,0x00,0x08,0x5F,0x55,0x49,0x44,  /* 00000E00    "...._UID" */
   4.452 -    0x0A,0x02,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000E08    "...._STA" */
   4.453 -    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000E10    "....._CR" */
   4.454 -    0x53,0x11,0x10,0x0A,0x0D,0x47,0x01,0x78,  /* 00000E18    "S....G.x" */
   4.455 -    0x03,0x78,0x03,0x08,0x08,0x22,0x80,0x00,  /* 00000E20    ".x...".." */
   4.456 -    0x79,0x00,
   4.457 +    0x4E,0x00,0x14,0x44,0x08,0x5F,0x43,0x52,  /* 00000128    "N..D._CR" */
   4.458 +    0x53,0x00,0x08,0x50,0x52,0x54,0x30,0x11,  /* 00000130    "S..PRT0." */
   4.459 +    0x42,0x07,0x0A,0x6E,0x88,0x0D,0x00,0x02,  /* 00000138    "B..n...." */
   4.460 +    0x0F,0x00,0x00,0x00,0x00,0x00,0xFF,0x00,  /* 00000140    "........" */
   4.461 +    0x00,0x00,0x00,0x01,0x47,0x01,0xF8,0x0C,  /* 00000148    "....G..." */
   4.462 +    0xF8,0x0C,0x01,0x08,0x88,0x0D,0x00,0x01,  /* 00000150    "........" */
   4.463 +    0x0C,0x03,0x00,0x00,0x00,0x00,0xF7,0x0C,  /* 00000158    "........" */
   4.464 +    0x00,0x00,0xF8,0x0C,0x88,0x0D,0x00,0x01,  /* 00000160    "........" */
   4.465 +    0x0C,0x03,0x00,0x00,0x00,0x0D,0xFF,0xFF,  /* 00000168    "........" */
   4.466 +    0x00,0x00,0x00,0xF3,0x87,0x17,0x00,0x00,  /* 00000170    "........" */
   4.467 +    0x0C,0x03,0x00,0x00,0x00,0x00,0x00,0x00,  /* 00000178    "........" */
   4.468 +    0x0A,0x00,0xFF,0xFF,0x0B,0x00,0x00,0x00,  /* 00000180    "........" */
   4.469 +    0x00,0x00,0x00,0x00,0x02,0x00,0x87,0x17,  /* 00000188    "........" */
   4.470 +    0x00,0x00,0x0D,0x03,0x00,0x00,0x00,0x00,  /* 00000190    "........" */
   4.471 +    0x00,0x00,0x00,0xF0,0xFF,0xFF,0xFF,0xF4,  /* 00000198    "........" */
   4.472 +    0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x05,  /* 000001A0    "........" */
   4.473 +    0x79,0x00,0xA4,0x50,0x52,0x54,0x30,0x08,  /* 000001A8    "y..PRT0." */
   4.474 +    0x42,0x55,0x46,0x41,0x11,0x09,0x0A,0x06,  /* 000001B0    "BUFA...." */
   4.475 +    0x23,0x60,0x0C,0x18,0x79,0x00,0x08,0x42,  /* 000001B8    "#`..y..B" */
   4.476 +    0x55,0x46,0x42,0x11,0x09,0x0A,0x06,0x23,  /* 000001C0    "UFB....#" */
   4.477 +    0x00,0x00,0x18,0x79,0x00,0x8B,0x42,0x55,  /* 000001C8    "...y..BU" */
   4.478 +    0x46,0x42,0x01,0x49,0x52,0x51,0x56,0x5B,  /* 000001D0    "FB.IRQV[" */
   4.479 +    0x82,0x48,0x08,0x4C,0x4E,0x4B,0x41,0x08,  /* 000001D8    ".H.LNKA." */
   4.480 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 000001E0    "_HID.A.." */
   4.481 +    0x0F,0x08,0x5F,0x55,0x49,0x44,0x01,0x14,  /* 000001E8    ".._UID.." */
   4.482 +    0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,0x50,  /* 000001F0    "._STA.{P" */
   4.483 +    0x49,0x52,0x41,0x0A,0x80,0x60,0xA0,0x08,  /* 000001F8    "IRA..`.." */
   4.484 +    0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,0xA1,  /* 00000200    ".`......" */
   4.485 +    0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,0x50,  /* 00000208    "......_P" */
   4.486 +    0x52,0x53,0x00,0xA4,0x42,0x55,0x46,0x41,  /* 00000210    "RS..BUFA" */
   4.487 +    0x14,0x11,0x5F,0x44,0x49,0x53,0x00,0x7D,  /* 00000218    ".._DIS.}" */
   4.488 +    0x50,0x49,0x52,0x41,0x0A,0x80,0x50,0x49,  /* 00000220    "PIRA..PI" */
   4.489 +    0x52,0x41,0x14,0x1A,0x5F,0x43,0x52,0x53,  /* 00000228    "RA.._CRS" */
   4.490 +    0x00,0x7B,0x50,0x49,0x52,0x41,0x0A,0x0F,  /* 00000230    ".{PIRA.." */
   4.491 +    0x60,0x79,0x01,0x60,0x49,0x52,0x51,0x56,  /* 00000238    "`y.`IRQV" */
   4.492 +    0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,0x5F,  /* 00000240    ".BUFB.._" */
   4.493 +    0x53,0x52,0x53,0x01,0x8B,0x68,0x01,0x49,  /* 00000248    "SRS..h.I" */
   4.494 +    0x52,0x51,0x31,0x82,0x49,0x52,0x51,0x31,  /* 00000250    "RQ1.IRQ1" */
   4.495 +    0x60,0x76,0x60,0x70,0x60,0x50,0x49,0x52,  /* 00000258    "`v`p`PIR" */
   4.496 +    0x41,0x5B,0x82,0x49,0x08,0x4C,0x4E,0x4B,  /* 00000260    "A[.I.LNK" */
   4.497 +    0x42,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000268    "B._HID.A" */
   4.498 +    0xD0,0x0C,0x0F,0x08,0x5F,0x55,0x49,0x44,  /* 00000270    "...._UID" */
   4.499 +    0x0A,0x02,0x14,0x1C,0x5F,0x53,0x54,0x41,  /* 00000278    "...._STA" */
   4.500 +    0x00,0x7B,0x50,0x49,0x52,0x42,0x0A,0x80,  /* 00000280    ".{PIRB.." */
   4.501 +    0x60,0xA0,0x08,0x93,0x60,0x0A,0x80,0xA4,  /* 00000288    "`...`..." */
   4.502 +    0x0A,0x09,0xA1,0x04,0xA4,0x0A,0x0B,0x14,  /* 00000290    "........" */
   4.503 +    0x0B,0x5F,0x50,0x52,0x53,0x00,0xA4,0x42,  /* 00000298    "._PRS..B" */
   4.504 +    0x55,0x46,0x41,0x14,0x11,0x5F,0x44,0x49,  /* 000002A0    "UFA.._DI" */
   4.505 +    0x53,0x00,0x7D,0x50,0x49,0x52,0x42,0x0A,  /* 000002A8    "S.}PIRB." */
   4.506 +    0x80,0x50,0x49,0x52,0x42,0x14,0x1A,0x5F,  /* 000002B0    ".PIRB.._" */
   4.507 +    0x43,0x52,0x53,0x00,0x7B,0x50,0x49,0x52,  /* 000002B8    "CRS.{PIR" */
   4.508 +    0x42,0x0A,0x0F,0x60,0x79,0x01,0x60,0x49,  /* 000002C0    "B..`y.`I" */
   4.509 +    0x52,0x51,0x56,0xA4,0x42,0x55,0x46,0x42,  /* 000002C8    "RQV.BUFB" */
   4.510 +    0x14,0x1B,0x5F,0x53,0x52,0x53,0x01,0x8B,  /* 000002D0    ".._SRS.." */
   4.511 +    0x68,0x01,0x49,0x52,0x51,0x31,0x82,0x49,  /* 000002D8    "h.IRQ1.I" */
   4.512 +    0x52,0x51,0x31,0x60,0x76,0x60,0x70,0x60,  /* 000002E0    "RQ1`v`p`" */
   4.513 +    0x50,0x49,0x52,0x42,0x5B,0x82,0x49,0x08,  /* 000002E8    "PIRB[.I." */
   4.514 +    0x4C,0x4E,0x4B,0x43,0x08,0x5F,0x48,0x49,  /* 000002F0    "LNKC._HI" */
   4.515 +    0x44,0x0C,0x41,0xD0,0x0C,0x0F,0x08,0x5F,  /* 000002F8    "D.A...._" */
   4.516 +    0x55,0x49,0x44,0x0A,0x03,0x14,0x1C,0x5F,  /* 00000300    "UID...._" */
   4.517 +    0x53,0x54,0x41,0x00,0x7B,0x50,0x49,0x52,  /* 00000308    "STA.{PIR" */
   4.518 +    0x43,0x0A,0x80,0x60,0xA0,0x08,0x93,0x60,  /* 00000310    "C..`...`" */
   4.519 +    0x0A,0x80,0xA4,0x0A,0x09,0xA1,0x04,0xA4,  /* 00000318    "........" */
   4.520 +    0x0A,0x0B,0x14,0x0B,0x5F,0x50,0x52,0x53,  /* 00000320    "...._PRS" */
   4.521 +    0x00,0xA4,0x42,0x55,0x46,0x41,0x14,0x11,  /* 00000328    "..BUFA.." */
   4.522 +    0x5F,0x44,0x49,0x53,0x00,0x7D,0x50,0x49,  /* 00000330    "_DIS.}PI" */
   4.523 +    0x52,0x43,0x0A,0x80,0x50,0x49,0x52,0x43,  /* 00000338    "RC..PIRC" */
   4.524 +    0x14,0x1A,0x5F,0x43,0x52,0x53,0x00,0x7B,  /* 00000340    ".._CRS.{" */
   4.525 +    0x50,0x49,0x52,0x43,0x0A,0x0F,0x60,0x79,  /* 00000348    "PIRC..`y" */
   4.526 +    0x01,0x60,0x49,0x52,0x51,0x56,0xA4,0x42,  /* 00000350    ".`IRQV.B" */
   4.527 +    0x55,0x46,0x42,0x14,0x1B,0x5F,0x53,0x52,  /* 00000358    "UFB.._SR" */
   4.528 +    0x53,0x01,0x8B,0x68,0x01,0x49,0x52,0x51,  /* 00000360    "S..h.IRQ" */
   4.529 +    0x31,0x82,0x49,0x52,0x51,0x31,0x60,0x76,  /* 00000368    "1.IRQ1`v" */
   4.530 +    0x60,0x70,0x60,0x50,0x49,0x52,0x43,0x5B,  /* 00000370    "`p`PIRC[" */
   4.531 +    0x82,0x49,0x08,0x4C,0x4E,0x4B,0x44,0x08,  /* 00000378    ".I.LNKD." */
   4.532 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0C,  /* 00000380    "_HID.A.." */
   4.533 +    0x0F,0x08,0x5F,0x55,0x49,0x44,0x0A,0x04,  /* 00000388    ".._UID.." */
   4.534 +    0x14,0x1C,0x5F,0x53,0x54,0x41,0x00,0x7B,  /* 00000390    ".._STA.{" */
   4.535 +    0x50,0x49,0x52,0x44,0x0A,0x80,0x60,0xA0,  /* 00000398    "PIRD..`." */
   4.536 +    0x08,0x93,0x60,0x0A,0x80,0xA4,0x0A,0x09,  /* 000003A0    "..`....." */
   4.537 +    0xA1,0x04,0xA4,0x0A,0x0B,0x14,0x0B,0x5F,  /* 000003A8    "......._" */
   4.538 +    0x50,0x52,0x53,0x00,0xA4,0x42,0x55,0x46,  /* 000003B0    "PRS..BUF" */
   4.539 +    0x41,0x14,0x11,0x5F,0x44,0x49,0x53,0x00,  /* 000003B8    "A.._DIS." */
   4.540 +    0x7D,0x50,0x49,0x52,0x44,0x0A,0x80,0x50,  /* 000003C0    "}PIRD..P" */
   4.541 +    0x49,0x52,0x44,0x14,0x1A,0x5F,0x43,0x52,  /* 000003C8    "IRD.._CR" */
   4.542 +    0x53,0x00,0x7B,0x50,0x49,0x52,0x44,0x0A,  /* 000003D0    "S.{PIRD." */
   4.543 +    0x0F,0x60,0x79,0x01,0x60,0x49,0x52,0x51,  /* 000003D8    ".`y.`IRQ" */
   4.544 +    0x56,0xA4,0x42,0x55,0x46,0x42,0x14,0x1B,  /* 000003E0    "V.BUFB.." */
   4.545 +    0x5F,0x53,0x52,0x53,0x01,0x8B,0x68,0x01,  /* 000003E8    "_SRS..h." */
   4.546 +    0x49,0x52,0x51,0x31,0x82,0x49,0x52,0x51,  /* 000003F0    "IRQ1.IRQ" */
   4.547 +    0x31,0x60,0x76,0x60,0x70,0x60,0x50,0x49,  /* 000003F8    "1`v`p`PI" */
   4.548 +    0x52,0x44,0x14,0x16,0x5F,0x50,0x52,0x54,  /* 00000400    "RD.._PRT" */
   4.549 +    0x00,0xA0,0x0A,0x50,0x49,0x43,0x44,0xA4,  /* 00000408    "...PICD." */
   4.550 +    0x50,0x52,0x54,0x41,0xA4,0x50,0x52,0x54,  /* 00000410    "PRTA.PRT" */
   4.551 +    0x50,0x08,0x50,0x52,0x54,0x50,0x12,0x49,  /* 00000418    "P.PRTP.I" */
   4.552 +    0x36,0x3C,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000420    "6<......" */
   4.553 +    0x01,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000428    "...LNKB." */
   4.554 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x01,0x00,  /* 00000430    "........" */
   4.555 +    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000438    ".LNKC..." */
   4.556 +    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x02,  /* 00000440    "........" */
   4.557 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000448    "LNKD...." */
   4.558 +    0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,0x4C,  /* 00000450    ".......L" */
   4.559 +    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000458    "NKA....." */
   4.560 +    0xFF,0xFF,0x02,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000460    ".....LNK" */
   4.561 +    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000468    "C......." */
   4.562 +    0x02,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000470    "...LNKD." */
   4.563 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 00000478    "........" */
   4.564 +    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000480    "..LNKA.." */
   4.565 +    0x0E,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x0A,  /* 00000488    "........" */
   4.566 +    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000490    ".LNKB..." */
   4.567 +    0x04,0x0C,0xFF,0xFF,0x03,0x00,0x00,0x4C,  /* 00000498    ".......L" */
   4.568 +    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 000004A0    "NKD....." */
   4.569 +    0xFF,0xFF,0x03,0x00,0x01,0x4C,0x4E,0x4B,  /* 000004A8    ".....LNK" */
   4.570 +    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 000004B0    "A......." */
   4.571 +    0x03,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 000004B8    "....LNKB" */
   4.572 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x03,  /* 000004C0    "........" */
   4.573 +    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 000004C8    "...LNKC." */
   4.574 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x04,0x00,  /* 000004D0    "........" */
   4.575 +    0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,  /* 000004D8    ".LNKA..." */
   4.576 +    0x04,0x0C,0xFF,0xFF,0x04,0x00,0x01,0x4C,  /* 000004E0    ".......L" */
   4.577 +    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000004E8    "NKB....." */
   4.578 +    0xFF,0xFF,0x04,0x00,0x0A,0x02,0x4C,0x4E,  /* 000004F0    "......LN" */
   4.579 +    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000004F8    "KC......" */
   4.580 +    0xFF,0x04,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 00000500    ".....LNK" */
   4.581 +    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000508    "D......." */
   4.582 +    0x05,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 00000510    "...LNKB." */
   4.583 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x05,0x00,  /* 00000518    "........" */
   4.584 +    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000520    ".LNKC..." */
   4.585 +    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x02,  /* 00000528    "........" */
   4.586 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000530    "LNKD...." */
   4.587 +    0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,0x4C,  /* 00000538    ".......L" */
   4.588 +    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000540    "NKA....." */
   4.589 +    0xFF,0xFF,0x06,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000548    ".....LNK" */
   4.590 +    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000550    "C......." */
   4.591 +    0x06,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000558    "...LNKD." */
   4.592 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 00000560    "........" */
   4.593 +    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000568    "..LNKA.." */
   4.594 +    0x0E,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x0A,  /* 00000570    "........" */
   4.595 +    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000578    ".LNKB..." */
   4.596 +    0x04,0x0C,0xFF,0xFF,0x07,0x00,0x00,0x4C,  /* 00000580    ".......L" */
   4.597 +    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000588    "NKD....." */
   4.598 +    0xFF,0xFF,0x07,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000590    ".....LNK" */
   4.599 +    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000598    "A......." */
   4.600 +    0x07,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 000005A0    "....LNKB" */
   4.601 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x07,  /* 000005A8    "........" */
   4.602 +    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 000005B0    "...LNKC." */
   4.603 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x08,0x00,  /* 000005B8    "........" */
   4.604 +    0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,  /* 000005C0    ".LNKA..." */
   4.605 +    0x04,0x0C,0xFF,0xFF,0x08,0x00,0x01,0x4C,  /* 000005C8    ".......L" */
   4.606 +    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000005D0    "NKB....." */
   4.607 +    0xFF,0xFF,0x08,0x00,0x0A,0x02,0x4C,0x4E,  /* 000005D8    "......LN" */
   4.608 +    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000005E0    "KC......" */
   4.609 +    0xFF,0x08,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000005E8    ".....LNK" */
   4.610 +    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000005F0    "D......." */
   4.611 +    0x09,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000005F8    "...LNKB." */
   4.612 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x09,0x00,  /* 00000600    "........" */
   4.613 +    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 00000608    ".LNKC..." */
   4.614 +    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x02,  /* 00000610    "........" */
   4.615 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000618    "LNKD...." */
   4.616 +    0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,0x4C,  /* 00000620    ".......L" */
   4.617 +    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000628    "NKA....." */
   4.618 +    0xFF,0xFF,0x0A,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000630    ".....LNK" */
   4.619 +    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000638    "C......." */
   4.620 +    0x0A,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000640    "...LNKD." */
   4.621 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000648    "........" */
   4.622 +    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000650    "..LNKA.." */
   4.623 +    0x0E,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x0A,  /* 00000658    "........" */
   4.624 +    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000660    ".LNKB..." */
   4.625 +    0x04,0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x4C,  /* 00000668    ".......L" */
   4.626 +    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000670    "NKD....." */
   4.627 +    0xFF,0xFF,0x0B,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000678    ".....LNK" */
   4.628 +    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000680    "A......." */
   4.629 +    0x0B,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000688    "....LNKB" */
   4.630 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0B,  /* 00000690    "........" */
   4.631 +    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000698    "...LNKC." */
   4.632 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0C,0x00,  /* 000006A0    "........" */
   4.633 +    0x00,0x4C,0x4E,0x4B,0x41,0x00,0x12,0x0D,  /* 000006A8    ".LNKA..." */
   4.634 +    0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x01,0x4C,  /* 000006B0    ".......L" */
   4.635 +    0x4E,0x4B,0x42,0x00,0x12,0x0E,0x04,0x0C,  /* 000006B8    "NKB....." */
   4.636 +    0xFF,0xFF,0x0C,0x00,0x0A,0x02,0x4C,0x4E,  /* 000006C0    "......LN" */
   4.637 +    0x4B,0x43,0x00,0x12,0x0E,0x04,0x0C,0xFF,  /* 000006C8    "KC......" */
   4.638 +    0xFF,0x0C,0x00,0x0A,0x03,0x4C,0x4E,0x4B,  /* 000006D0    ".....LNK" */
   4.639 +    0x44,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 000006D8    "D......." */
   4.640 +    0x0D,0x00,0x00,0x4C,0x4E,0x4B,0x42,0x00,  /* 000006E0    "...LNKB." */
   4.641 +    0x12,0x0D,0x04,0x0C,0xFF,0xFF,0x0D,0x00,  /* 000006E8    "........" */
   4.642 +    0x01,0x4C,0x4E,0x4B,0x43,0x00,0x12,0x0E,  /* 000006F0    ".LNKC..." */
   4.643 +    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x02,  /* 000006F8    "........" */
   4.644 +    0x4C,0x4E,0x4B,0x44,0x00,0x12,0x0E,0x04,  /* 00000700    "LNKD...." */
   4.645 +    0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,0x4C,  /* 00000708    ".......L" */
   4.646 +    0x4E,0x4B,0x41,0x00,0x12,0x0D,0x04,0x0C,  /* 00000710    "NKA....." */
   4.647 +    0xFF,0xFF,0x0E,0x00,0x00,0x4C,0x4E,0x4B,  /* 00000718    ".....LNK" */
   4.648 +    0x43,0x00,0x12,0x0D,0x04,0x0C,0xFF,0xFF,  /* 00000720    "C......." */
   4.649 +    0x0E,0x00,0x01,0x4C,0x4E,0x4B,0x44,0x00,  /* 00000728    "...LNKD." */
   4.650 +    0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000730    "........" */
   4.651 +    0x0A,0x02,0x4C,0x4E,0x4B,0x41,0x00,0x12,  /* 00000738    "..LNKA.." */
   4.652 +    0x0E,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x0A,  /* 00000740    "........" */
   4.653 +    0x03,0x4C,0x4E,0x4B,0x42,0x00,0x12,0x0D,  /* 00000748    ".LNKB..." */
   4.654 +    0x04,0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x4C,  /* 00000750    ".......L" */
   4.655 +    0x4E,0x4B,0x44,0x00,0x12,0x0D,0x04,0x0C,  /* 00000758    "NKD....." */
   4.656 +    0xFF,0xFF,0x0F,0x00,0x01,0x4C,0x4E,0x4B,  /* 00000760    ".....LNK" */
   4.657 +    0x41,0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,  /* 00000768    "A......." */
   4.658 +    0x0F,0x00,0x0A,0x02,0x4C,0x4E,0x4B,0x42,  /* 00000770    "....LNKB" */
   4.659 +    0x00,0x12,0x0E,0x04,0x0C,0xFF,0xFF,0x0F,  /* 00000778    "........" */
   4.660 +    0x00,0x0A,0x03,0x4C,0x4E,0x4B,0x43,0x00,  /* 00000780    "...LNKC." */
   4.661 +    0x08,0x50,0x52,0x54,0x41,0x12,0x41,0x2F,  /* 00000788    ".PRTA.A/" */
   4.662 +    0x3C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x01,  /* 00000790    "<......." */
   4.663 +    0x00,0x00,0x00,0x0A,0x14,0x12,0x0B,0x04,  /* 00000798    "........" */
   4.664 +    0x0C,0xFF,0xFF,0x01,0x00,0x01,0x00,0x0A,  /* 000007A0    "........" */
   4.665 +    0x15,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x01,  /* 000007A8    "........" */
   4.666 +    0x00,0x0A,0x02,0x00,0x0A,0x16,0x12,0x0C,  /* 000007B0    "........" */
   4.667 +    0x04,0x0C,0xFF,0xFF,0x01,0x00,0x0A,0x03,  /* 000007B8    "........" */
   4.668 +    0x00,0x0A,0x17,0x12,0x0B,0x04,0x0C,0xFF,  /* 000007C0    "........" */
   4.669 +    0xFF,0x02,0x00,0x00,0x00,0x0A,0x18,0x12,  /* 000007C8    "........" */
   4.670 +    0x0B,0x04,0x0C,0xFF,0xFF,0x02,0x00,0x01,  /* 000007D0    "........" */
   4.671 +    0x00,0x0A,0x19,0x12,0x0C,0x04,0x0C,0xFF,  /* 000007D8    "........" */
   4.672 +    0xFF,0x02,0x00,0x0A,0x02,0x00,0x0A,0x1A,  /* 000007E0    "........" */
   4.673 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x02,0x00,  /* 000007E8    "........" */
   4.674 +    0x0A,0x03,0x00,0x0A,0x1B,0x12,0x0B,0x04,  /* 000007F0    "........" */
   4.675 +    0x0C,0xFF,0xFF,0x03,0x00,0x00,0x00,0x0A,  /* 000007F8    "........" */
   4.676 +    0x1C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x03,  /* 00000800    "........" */
   4.677 +    0x00,0x01,0x00,0x0A,0x1D,0x12,0x0C,0x04,  /* 00000808    "........" */
   4.678 +    0x0C,0xFF,0xFF,0x03,0x00,0x0A,0x02,0x00,  /* 00000810    "........" */
   4.679 +    0x0A,0x1E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000818    "........" */
   4.680 +    0x03,0x00,0x0A,0x03,0x00,0x0A,0x1F,0x12,  /* 00000820    "........" */
   4.681 +    0x0B,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x00,  /* 00000828    "........" */
   4.682 +    0x00,0x0A,0x20,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000830    ".. ....." */
   4.683 +    0xFF,0x04,0x00,0x01,0x00,0x0A,0x21,0x12,  /* 00000838    "......!." */
   4.684 +    0x0C,0x04,0x0C,0xFF,0xFF,0x04,0x00,0x0A,  /* 00000840    "........" */
   4.685 +    0x02,0x00,0x0A,0x22,0x12,0x0C,0x04,0x0C,  /* 00000848    "..."...." */
   4.686 +    0xFF,0xFF,0x04,0x00,0x0A,0x03,0x00,0x0A,  /* 00000850    "........" */
   4.687 +    0x23,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x05,  /* 00000858    "#......." */
   4.688 +    0x00,0x00,0x00,0x0A,0x24,0x12,0x0B,0x04,  /* 00000860    "....$..." */
   4.689 +    0x0C,0xFF,0xFF,0x05,0x00,0x01,0x00,0x0A,  /* 00000868    "........" */
   4.690 +    0x25,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x05,  /* 00000870    "%......." */
   4.691 +    0x00,0x0A,0x02,0x00,0x0A,0x26,0x12,0x0C,  /* 00000878    ".....&.." */
   4.692 +    0x04,0x0C,0xFF,0xFF,0x05,0x00,0x0A,0x03,  /* 00000880    "........" */
   4.693 +    0x00,0x0A,0x27,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000888    "..'....." */
   4.694 +    0xFF,0x06,0x00,0x00,0x00,0x0A,0x28,0x12,  /* 00000890    "......(." */
   4.695 +    0x0B,0x04,0x0C,0xFF,0xFF,0x06,0x00,0x01,  /* 00000898    "........" */
   4.696 +    0x00,0x0A,0x29,0x12,0x0C,0x04,0x0C,0xFF,  /* 000008A0    "..)....." */
   4.697 +    0xFF,0x06,0x00,0x0A,0x02,0x00,0x0A,0x2A,  /* 000008A8    ".......*" */
   4.698 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x06,0x00,  /* 000008B0    "........" */
   4.699 +    0x0A,0x03,0x00,0x0A,0x2B,0x12,0x0B,0x04,  /* 000008B8    "....+..." */
   4.700 +    0x0C,0xFF,0xFF,0x07,0x00,0x00,0x00,0x0A,  /* 000008C0    "........" */
   4.701 +    0x2C,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x07,  /* 000008C8    ",......." */
   4.702 +    0x00,0x01,0x00,0x0A,0x2D,0x12,0x0C,0x04,  /* 000008D0    "....-..." */
   4.703 +    0x0C,0xFF,0xFF,0x07,0x00,0x0A,0x02,0x00,  /* 000008D8    "........" */
   4.704 +    0x0A,0x2E,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 000008E0    "........" */
   4.705 +    0x07,0x00,0x0A,0x03,0x00,0x0A,0x2F,0x12,  /* 000008E8    "....../." */
   4.706 +    0x0B,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x00,  /* 000008F0    "........" */
   4.707 +    0x00,0x0A,0x11,0x12,0x0B,0x04,0x0C,0xFF,  /* 000008F8    "........" */
   4.708 +    0xFF,0x08,0x00,0x01,0x00,0x0A,0x12,0x12,  /* 00000900    "........" */
   4.709 +    0x0C,0x04,0x0C,0xFF,0xFF,0x08,0x00,0x0A,  /* 00000908    "........" */
   4.710 +    0x02,0x00,0x0A,0x13,0x12,0x0C,0x04,0x0C,  /* 00000910    "........" */
   4.711 +    0xFF,0xFF,0x08,0x00,0x0A,0x03,0x00,0x0A,  /* 00000918    "........" */
   4.712 +    0x14,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x09,  /* 00000920    "........" */
   4.713 +    0x00,0x00,0x00,0x0A,0x15,0x12,0x0B,0x04,  /* 00000928    "........" */
   4.714 +    0x0C,0xFF,0xFF,0x09,0x00,0x01,0x00,0x0A,  /* 00000930    "........" */
   4.715 +    0x16,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x09,  /* 00000938    "........" */
   4.716 +    0x00,0x0A,0x02,0x00,0x0A,0x17,0x12,0x0C,  /* 00000940    "........" */
   4.717 +    0x04,0x0C,0xFF,0xFF,0x09,0x00,0x0A,0x03,  /* 00000948    "........" */
   4.718 +    0x00,0x0A,0x18,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000950    "........" */
   4.719 +    0xFF,0x0A,0x00,0x00,0x00,0x0A,0x19,0x12,  /* 00000958    "........" */
   4.720 +    0x0B,0x04,0x0C,0xFF,0xFF,0x0A,0x00,0x01,  /* 00000960    "........" */
   4.721 +    0x00,0x0A,0x1A,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000968    "........" */
   4.722 +    0xFF,0x0A,0x00,0x0A,0x02,0x00,0x0A,0x1B,  /* 00000970    "........" */
   4.723 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0A,0x00,  /* 00000978    "........" */
   4.724 +    0x0A,0x03,0x00,0x0A,0x1C,0x12,0x0B,0x04,  /* 00000980    "........" */
   4.725 +    0x0C,0xFF,0xFF,0x0B,0x00,0x00,0x00,0x0A,  /* 00000988    "........" */
   4.726 +    0x1D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0B,  /* 00000990    "........" */
   4.727 +    0x00,0x01,0x00,0x0A,0x1E,0x12,0x0C,0x04,  /* 00000998    "........" */
   4.728 +    0x0C,0xFF,0xFF,0x0B,0x00,0x0A,0x02,0x00,  /* 000009A0    "........" */
   4.729 +    0x0A,0x1F,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 000009A8    "........" */
   4.730 +    0x0B,0x00,0x0A,0x03,0x00,0x0A,0x20,0x12,  /* 000009B0    "...... ." */
   4.731 +    0x0B,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x00,  /* 000009B8    "........" */
   4.732 +    0x00,0x0A,0x21,0x12,0x0B,0x04,0x0C,0xFF,  /* 000009C0    "..!....." */
   4.733 +    0xFF,0x0C,0x00,0x01,0x00,0x0A,0x22,0x12,  /* 000009C8    "......"." */
   4.734 +    0x0C,0x04,0x0C,0xFF,0xFF,0x0C,0x00,0x0A,  /* 000009D0    "........" */
   4.735 +    0x02,0x00,0x0A,0x23,0x12,0x0C,0x04,0x0C,  /* 000009D8    "...#...." */
   4.736 +    0xFF,0xFF,0x0C,0x00,0x0A,0x03,0x00,0x0A,  /* 000009E0    "........" */
   4.737 +    0x24,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0D,  /* 000009E8    "$......." */
   4.738 +    0x00,0x00,0x00,0x0A,0x25,0x12,0x0B,0x04,  /* 000009F0    "....%..." */
   4.739 +    0x0C,0xFF,0xFF,0x0D,0x00,0x01,0x00,0x0A,  /* 000009F8    "........" */
   4.740 +    0x26,0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0D,  /* 00000A00    "&......." */
   4.741 +    0x00,0x0A,0x02,0x00,0x0A,0x27,0x12,0x0C,  /* 00000A08    ".....'.." */
   4.742 +    0x04,0x0C,0xFF,0xFF,0x0D,0x00,0x0A,0x03,  /* 00000A10    "........" */
   4.743 +    0x00,0x0A,0x28,0x12,0x0B,0x04,0x0C,0xFF,  /* 00000A18    "..(....." */
   4.744 +    0xFF,0x0E,0x00,0x00,0x00,0x0A,0x29,0x12,  /* 00000A20    "......)." */
   4.745 +    0x0B,0x04,0x0C,0xFF,0xFF,0x0E,0x00,0x01,  /* 00000A28    "........" */
   4.746 +    0x00,0x0A,0x2A,0x12,0x0C,0x04,0x0C,0xFF,  /* 00000A30    "..*....." */
   4.747 +    0xFF,0x0E,0x00,0x0A,0x02,0x00,0x0A,0x2B,  /* 00000A38    ".......+" */
   4.748 +    0x12,0x0C,0x04,0x0C,0xFF,0xFF,0x0E,0x00,  /* 00000A40    "........" */
   4.749 +    0x0A,0x03,0x00,0x0A,0x2C,0x12,0x0B,0x04,  /* 00000A48    "....,..." */
   4.750 +    0x0C,0xFF,0xFF,0x0F,0x00,0x00,0x00,0x0A,  /* 00000A50    "........" */
   4.751 +    0x2D,0x12,0x0B,0x04,0x0C,0xFF,0xFF,0x0F,  /* 00000A58    "-......." */
   4.752 +    0x00,0x01,0x00,0x0A,0x2E,0x12,0x0C,0x04,  /* 00000A60    "........" */
   4.753 +    0x0C,0xFF,0xFF,0x0F,0x00,0x0A,0x02,0x00,  /* 00000A68    "........" */
   4.754 +    0x0A,0x2F,0x12,0x0C,0x04,0x0C,0xFF,0xFF,  /* 00000A70    "./......" */
   4.755 +    0x0F,0x00,0x0A,0x03,0x00,0x0A,0x10,0x5B,  /* 00000A78    ".......[" */
   4.756 +    0x82,0x4C,0x31,0x49,0x53,0x41,0x5F,0x08,  /* 00000A80    ".L1ISA_." */
   4.757 +    0x5F,0x41,0x44,0x52,0x0C,0x00,0x00,0x01,  /* 00000A88    "_ADR...." */
   4.758 +    0x00,0x5B,0x80,0x50,0x49,0x52,0x51,0x02,  /* 00000A90    ".[.PIRQ." */
   4.759 +    0x0A,0x60,0x0A,0x04,0x10,0x2E,0x5C,0x00,  /* 00000A98    ".`....\." */
   4.760 +    0x5B,0x81,0x29,0x5C,0x2F,0x04,0x5F,0x53,  /* 00000AA0    "[.)\/._S" */
   4.761 +    0x42,0x5F,0x50,0x43,0x49,0x30,0x49,0x53,  /* 00000AA8    "B_PCI0IS" */
   4.762 +    0x41,0x5F,0x50,0x49,0x52,0x51,0x01,0x50,  /* 00000AB0    "A_PIRQ.P" */
   4.763 +    0x49,0x52,0x41,0x08,0x50,0x49,0x52,0x42,  /* 00000AB8    "IRA.PIRB" */
   4.764 +    0x08,0x50,0x49,0x52,0x43,0x08,0x50,0x49,  /* 00000AC0    ".PIRC.PI" */
   4.765 +    0x52,0x44,0x08,0x5B,0x82,0x46,0x0B,0x53,  /* 00000AC8    "RD.[.F.S" */
   4.766 +    0x59,0x53,0x52,0x08,0x5F,0x48,0x49,0x44,  /* 00000AD0    "YSR._HID" */
   4.767 +    0x0C,0x41,0xD0,0x0C,0x02,0x08,0x5F,0x55,  /* 00000AD8    ".A...._U" */
   4.768 +    0x49,0x44,0x01,0x08,0x43,0x52,0x53,0x5F,  /* 00000AE0    "ID..CRS_" */
   4.769 +    0x11,0x4E,0x08,0x0A,0x8A,0x47,0x01,0x10,  /* 00000AE8    ".N...G.." */
   4.770 +    0x00,0x10,0x00,0x00,0x10,0x47,0x01,0x22,  /* 00000AF0    ".....G."" */
   4.771 +    0x00,0x22,0x00,0x00,0x0C,0x47,0x01,0x30,  /* 00000AF8    "."...G.0" */
   4.772 +    0x00,0x30,0x00,0x00,0x10,0x47,0x01,0x44,  /* 00000B00    ".0...G.D" */
   4.773 +    0x00,0x44,0x00,0x00,0x1C,0x47,0x01,0x62,  /* 00000B08    ".D...G.b" */
   4.774 +    0x00,0x62,0x00,0x00,0x02,0x47,0x01,0x65,  /* 00000B10    ".b...G.e" */
   4.775 +    0x00,0x65,0x00,0x00,0x0B,0x47,0x01,0x72,  /* 00000B18    ".e...G.r" */
   4.776 +    0x00,0x72,0x00,0x00,0x0E,0x47,0x01,0x80,  /* 00000B20    ".r...G.." */
   4.777 +    0x00,0x80,0x00,0x00,0x01,0x47,0x01,0x84,  /* 00000B28    ".....G.." */
   4.778 +    0x00,0x84,0x00,0x00,0x03,0x47,0x01,0x88,  /* 00000B30    ".....G.." */
   4.779 +    0x00,0x88,0x00,0x00,0x01,0x47,0x01,0x8C,  /* 00000B38    ".....G.." */
   4.780 +    0x00,0x8C,0x00,0x00,0x03,0x47,0x01,0x90,  /* 00000B40    ".....G.." */
   4.781 +    0x00,0x90,0x00,0x00,0x10,0x47,0x01,0xA2,  /* 00000B48    ".....G.." */
   4.782 +    0x00,0xA2,0x00,0x00,0x1C,0x47,0x01,0xE0,  /* 00000B50    ".....G.." */
   4.783 +    0x00,0xE0,0x00,0x00,0x10,0x47,0x01,0xA0,  /* 00000B58    ".....G.." */
   4.784 +    0x08,0xA0,0x08,0x00,0x04,0x47,0x01,0xC0,  /* 00000B60    ".....G.." */
   4.785 +    0x0C,0xC0,0x0C,0x00,0x10,0x47,0x01,0xD0,  /* 00000B68    ".....G.." */
   4.786 +    0x04,0xD0,0x04,0x00,0x02,0x79,0x00,0x14,  /* 00000B70    ".....y.." */
   4.787 +    0x0B,0x5F,0x43,0x52,0x53,0x00,0xA4,0x43,  /* 00000B78    "._CRS..C" */
   4.788 +    0x52,0x53,0x5F,0x5B,0x82,0x2B,0x50,0x49,  /* 00000B80    "RS_[.+PI" */
   4.789 +    0x43,0x5F,0x08,0x5F,0x48,0x49,0x44,0x0B,  /* 00000B88    "C_._HID." */
   4.790 +    0x41,0xD0,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000B90    "A.._CRS." */
   4.791 +    0x18,0x0A,0x15,0x47,0x01,0x20,0x00,0x20,  /* 00000B98    "...G. . " */
   4.792 +    0x00,0x01,0x02,0x47,0x01,0xA0,0x00,0xA0,  /* 00000BA0    "...G...." */
   4.793 +    0x00,0x01,0x02,0x22,0x04,0x00,0x79,0x00,  /* 00000BA8    "..."..y." */
   4.794 +    0x5B,0x82,0x47,0x05,0x44,0x4D,0x41,0x30,  /* 00000BB0    "[.G.DMA0" */
   4.795 +    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000BB8    "._HID.A." */
   4.796 +    0x02,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000BC0    "..._CRS." */
   4.797 +    0x41,0x04,0x0A,0x3D,0x2A,0x10,0x04,0x47,  /* 00000BC8    "A..=*..G" */
   4.798 +    0x01,0x00,0x00,0x00,0x00,0x00,0x10,0x47,  /* 00000BD0    ".......G" */
   4.799 +    0x01,0x81,0x00,0x81,0x00,0x00,0x03,0x47,  /* 00000BD8    ".......G" */
   4.800 +    0x01,0x87,0x00,0x87,0x00,0x00,0x01,0x47,  /* 00000BE0    ".......G" */
   4.801 +    0x01,0x89,0x00,0x89,0x00,0x00,0x03,0x47,  /* 00000BE8    ".......G" */
   4.802 +    0x01,0x8F,0x00,0x8F,0x00,0x00,0x01,0x47,  /* 00000BF0    ".......G" */
   4.803 +    0x01,0xC0,0x00,0xC0,0x00,0x00,0x20,0x47,  /* 00000BF8    "...... G" */
   4.804 +    0x01,0x80,0x04,0x80,0x04,0x00,0x10,0x79,  /* 00000C00    ".......y" */
   4.805 +    0x00,0x5B,0x82,0x25,0x54,0x4D,0x52,0x5F,  /* 00000C08    ".[.%TMR_" */
   4.806 +    0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,  /* 00000C10    "._HID.A." */
   4.807 +    0x01,0x00,0x08,0x5F,0x43,0x52,0x53,0x11,  /* 00000C18    "..._CRS." */
   4.808 +    0x10,0x0A,0x0D,0x47,0x01,0x40,0x00,0x40,  /* 00000C20    "...G.@.@" */
   4.809 +    0x00,0x00,0x04,0x22,0x01,0x00,0x79,0x00,  /* 00000C28    "..."..y." */
   4.810 +    0x5B,0x82,0x25,0x52,0x54,0x43,0x5F,0x08,  /* 00000C30    "[.%RTC_." */
   4.811 +    0x5F,0x48,0x49,0x44,0x0C,0x41,0xD0,0x0B,  /* 00000C38    "_HID.A.." */
   4.812 +    0x00,0x08,0x5F,0x43,0x52,0x53,0x11,0x10,  /* 00000C40    ".._CRS.." */
   4.813 +    0x0A,0x0D,0x47,0x01,0x70,0x00,0x70,0x00,  /* 00000C48    "..G.p.p." */
   4.814 +    0x00,0x02,0x22,0x00,0x01,0x79,0x00,0x5B,  /* 00000C50    ".."..y.[" */
   4.815 +    0x82,0x22,0x53,0x50,0x4B,0x52,0x08,0x5F,  /* 00000C58    "."SPKR._" */
   4.816 +    0x48,0x49,0x44,0x0C,0x41,0xD0,0x08,0x00,  /* 00000C60    "HID.A..." */
   4.817 +    0x08,0x5F,0x43,0x52,0x53,0x11,0x0D,0x0A,  /* 00000C68    "._CRS..." */
   4.818 +    0x0A,0x47,0x01,0x61,0x00,0x61,0x00,0x00,  /* 00000C70    ".G.a.a.." */
   4.819 +    0x01,0x79,0x00,0x5B,0x82,0x31,0x50,0x53,  /* 00000C78    ".y.[.1PS" */
   4.820 +    0x32,0x4D,0x08,0x5F,0x48,0x49,0x44,0x0C,  /* 00000C80    "2M._HID." */
   4.821 +    0x41,0xD0,0x0F,0x13,0x08,0x5F,0x43,0x49,  /* 00000C88    "A...._CI" */
   4.822 +    0x44,0x0C,0x41,0xD0,0x0F,0x13,0x14,0x09,  /* 00000C90    "D.A....." */
   4.823 +    0x5F,0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,  /* 00000C98    "_STA...." */
   4.824 +    0x08,0x5F,0x43,0x52,0x53,0x11,0x08,0x0A,  /* 00000CA0    "._CRS..." */
   4.825 +    0x05,0x22,0x00,0x10,0x79,0x00,0x5B,0x82,  /* 00000CA8    "."..y.[." */
   4.826 +    0x42,0x04,0x50,0x53,0x32,0x4B,0x08,0x5F,  /* 00000CB0    "B.PS2K._" */
   4.827 +    0x48,0x49,0x44,0x0C,0x41,0xD0,0x03,0x03,  /* 00000CB8    "HID.A..." */
   4.828 +    0x08,0x5F,0x43,0x49,0x44,0x0C,0x41,0xD0,  /* 00000CC0    "._CID.A." */
   4.829 +    0x03,0x0B,0x14,0x09,0x5F,0x53,0x54,0x41,  /* 00000CC8    "...._STA" */
   4.830 +    0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,0x52,  /* 00000CD0    "....._CR" */
   4.831 +    0x53,0x11,0x18,0x0A,0x15,0x47,0x01,0x60,  /* 00000CD8    "S....G.`" */
   4.832 +    0x00,0x60,0x00,0x00,0x01,0x47,0x01,0x64,  /* 00000CE0    ".`...G.d" */
   4.833 +    0x00,0x64,0x00,0x00,0x01,0x22,0x02,0x00,  /* 00000CE8    ".d...".." */
   4.834 +    0x79,0x00,0x5B,0x82,0x3A,0x46,0x44,0x43,  /* 00000CF0    "y.[.:FDC" */
   4.835 +    0x30,0x08,0x5F,0x48,0x49,0x44,0x0C,0x41,  /* 00000CF8    "0._HID.A" */
   4.836 +    0xD0,0x07,0x00,0x14,0x09,0x5F,0x53,0x54,  /* 00000D00    "....._ST" */
   4.837 +    0x41,0x00,0xA4,0x0A,0x0F,0x08,0x5F,0x43,  /* 00000D08    "A....._C" */
   4.838 +    0x52,0x53,0x11,0x1B,0x0A,0x18,0x47,0x01,  /* 00000D10    "RS....G." */
   4.839 +    0xF0,0x03,0xF0,0x03,0x01,0x06,0x47,0x01,  /* 00000D18    "......G." */
   4.840 +    0xF7,0x03,0xF7,0x03,0x01,0x01,0x22,0x40,  /* 00000D20    "......"@" */
   4.841 +    0x00,0x2A,0x04,0x00,0x79,0x00,0x5B,0x82,  /* 00000D28    ".*..y.[." */
   4.842 +    0x35,0x55,0x41,0x52,0x31,0x08,0x5F,0x48,  /* 00000D30    "5UAR1._H" */
   4.843 +    0x49,0x44,0x0C,0x41,0xD0,0x05,0x01,0x08,  /* 00000D38    "ID.A...." */
   4.844 +    0x5F,0x55,0x49,0x44,0x01,0x14,0x09,0x5F,  /* 00000D40    "_UID..._" */
   4.845 +    0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,  /* 00000D48    "STA....." */
   4.846 +    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000D50    "_CRS...." */
   4.847 +    0x47,0x01,0xF8,0x03,0xF8,0x03,0x01,0x08,  /* 00000D58    "G......." */
   4.848 +    0x22,0x10,0x00,0x79,0x00,0x5B,0x82,0x36,  /* 00000D60    ""..y.[.6" */
   4.849 +    0x4C,0x54,0x50,0x31,0x08,0x5F,0x48,0x49,  /* 00000D68    "LTP1._HI" */
   4.850 +    0x44,0x0C,0x41,0xD0,0x04,0x00,0x08,0x5F,  /* 00000D70    "D.A...._" */
   4.851 +    0x55,0x49,0x44,0x0A,0x02,0x14,0x09,0x5F,  /* 00000D78    "UID...._" */
   4.852 +    0x53,0x54,0x41,0x00,0xA4,0x0A,0x0F,0x08,  /* 00000D80    "STA....." */
   4.853 +    0x5F,0x43,0x52,0x53,0x11,0x10,0x0A,0x0D,  /* 00000D88    "_CRS...." */
   4.854 +    0x47,0x01,0x78,0x03,0x78,0x03,0x08,0x08,  /* 00000D90    "G.x.x..." */
   4.855 +    0x22,0x80,0x00,0x79,0x00,
   4.856  };
   4.857  int DsdtLen=sizeof(AmlCode);
     5.1 --- a/tools/firmware/hvmloader/acpi/static_tables.c	Thu Nov 23 17:46:52 2006 +0000
     5.2 +++ b/tools/firmware/hvmloader/acpi/static_tables.c	Thu Nov 23 17:54:06 2006 +0000
     5.3 @@ -40,6 +40,37 @@ struct acpi_20_madt Madt = {
     5.4          .flags      = ACPI_PCAT_COMPAT
     5.5      },
     5.6  
     5.7 +    .intsrcovr = {
     5.8 +        [0] = {
     5.9 +            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
    5.10 +            .length = sizeof(struct acpi_20_madt_intsrcovr),
    5.11 +            .source = 5,
    5.12 +            .gsi    = 5,
    5.13 +            .flags  = 0xf /* PCI: active-low level-triggered */
    5.14 +        },
    5.15 +        [1] = {
    5.16 +            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
    5.17 +            .length = sizeof(struct acpi_20_madt_intsrcovr),
    5.18 +            .source = 6,
    5.19 +            .gsi    = 6,
    5.20 +            .flags  = 0xf /* PCI: active-low level-triggered */
    5.21 +        },
    5.22 +        [2] = {
    5.23 +            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
    5.24 +            .length = sizeof(struct acpi_20_madt_intsrcovr),
    5.25 +            .source = 10,
    5.26 +            .gsi    = 10,
    5.27 +            .flags  = 0xf /* PCI: active-low level-triggered */
    5.28 +        },
    5.29 +        [3] = {
    5.30 +            .type   = ACPI_INTERRUPT_SOURCE_OVERRIDE,
    5.31 +            .length = sizeof(struct acpi_20_madt_intsrcovr),
    5.32 +            .source = 11,
    5.33 +            .gsi    = 11,
    5.34 +            .flags  = 0xf /* PCI: active-low level-triggered */
    5.35 +        }
    5.36 +    },
    5.37 +
    5.38      /* IO APIC */
    5.39      .io_apic = {
    5.40          [0] = {
    5.41 @@ -55,7 +86,7 @@ struct acpi_20_madt Madt = {
    5.42          [0] = {
    5.43              .type   = ACPI_PROCESSOR_LOCAL_APIC,
    5.44              .length = sizeof(struct acpi_20_madt_lapic),
    5.45 -            .flags  = 0x00000001
    5.46 +            .flags  = ACPI_LOCAL_APIC_ENABLED
    5.47          }
    5.48      }
    5.49  };
     6.1 --- a/tools/firmware/hvmloader/acpi_madt.c	Thu Nov 23 17:46:52 2006 +0000
     6.2 +++ b/tools/firmware/hvmloader/acpi_madt.c	Thu Nov 23 17:54:06 2006 +0000
     6.3 @@ -35,32 +35,34 @@ static int validate_hvm_info(struct hvm_
     6.4      int i;
     6.5  
     6.6      /* strncmp(t->signature, "HVM INFO", 8) */
     6.7 -    for (i = 0; i < 8; i++) {
     6.8 -        if (signature[i] != t->signature[i]) {
     6.9 -            puts("Bad hvm info signature\n");
    6.10 +    for ( i = 0; i < 8; i++ )
    6.11 +    {
    6.12 +        if ( signature[i] != t->signature[i] )
    6.13 +        {
    6.14 +            printf("Bad hvm info signature\n");
    6.15              return 0;
    6.16          }
    6.17      }
    6.18  
    6.19 -    for (i = 0; i < t->length; i++)
    6.20 +    for ( i = 0; i < t->length; i++ )
    6.21          sum += ptr[i];
    6.22  
    6.23      return (sum == 0);
    6.24  }
    6.25  
    6.26  /* xc_vmx_builder wrote hvm info at 0x9F800. Return it. */
    6.27 -struct hvm_info_table *
    6.28 -get_hvm_info_table(void)
    6.29 +struct hvm_info_table *get_hvm_info_table(void)
    6.30  {
    6.31      struct hvm_info_table *t;
    6.32  
    6.33 -    if (table != NULL)
    6.34 +    if ( table != NULL )
    6.35          return table;
    6.36  
    6.37      t = (struct hvm_info_table *)HVM_INFO_PADDR;
    6.38  
    6.39 -    if (!validate_hvm_info(t)) {
    6.40 -        puts("Bad hvm info table\n");
    6.41 +    if ( !validate_hvm_info(t) )
    6.42 +    {
    6.43 +        printf("Bad hvm info table\n");
    6.44          return NULL;
    6.45      }
    6.46  
    6.47 @@ -69,15 +71,13 @@ get_hvm_info_table(void)
    6.48      return table;
    6.49  }
    6.50  
    6.51 -int
    6.52 -get_vcpu_nr(void)
    6.53 +int get_vcpu_nr(void)
    6.54  {
    6.55      struct hvm_info_table *t = get_hvm_info_table();
    6.56      return (t ? t->nr_vcpus : 1); /* default 1 vcpu */
    6.57  }
    6.58  
    6.59 -int
    6.60 -get_acpi_enabled(void)
    6.61 +int get_acpi_enabled(void)
    6.62  {
    6.63      struct hvm_info_table *t = get_hvm_info_table();
    6.64      return (t ? t->acpi_enabled : 0); /* default no acpi */
    6.65 @@ -91,13 +91,14 @@ acpi_madt_get_madt(unsigned char *acpi_s
    6.66      struct acpi_20_madt *madt;
    6.67  
    6.68      rsdt = acpi_rsdt_get(acpi_start);
    6.69 -    if (rsdt == NULL)
    6.70 +    if ( rsdt == NULL )
    6.71          return NULL;
    6.72  
    6.73      madt = (struct acpi_20_madt *)(acpi_start + rsdt->entry[1] -
    6.74                                     ACPI_PHYSICAL_ADDRESS);
    6.75 -    if (madt->header.header.signature != ACPI_2_0_MADT_SIGNATURE) {
    6.76 -        puts("Bad MADT signature \n");
    6.77 +    if ( madt->header.header.signature != ACPI_2_0_MADT_SIGNATURE )
    6.78 +    {
    6.79 +        printf("Bad MADT signature \n");
    6.80          return NULL;
    6.81      }
    6.82  
    6.83 @@ -111,10 +112,11 @@ acpi_madt_set_local_apics(
    6.84  {
    6.85      int i;
    6.86  
    6.87 -    if ((nr_vcpu > MAX_VIRT_CPUS) || (nr_vcpu < 0) || !madt)
    6.88 +    if ( (nr_vcpu > MAX_VIRT_CPUS) || (nr_vcpu < 0) || !madt )
    6.89          return -1;
    6.90  
    6.91 -    for (i = 0; i < nr_vcpu; i++) {
    6.92 +    for ( i = 0; i < nr_vcpu; i++ )
    6.93 +    {
    6.94          madt->lapic[i].type    = ACPI_PROCESSOR_LOCAL_APIC;
    6.95          madt->lapic[i].length  = sizeof(struct acpi_20_madt_lapic);
    6.96          madt->lapic[i].acpi_processor_id = i;
    6.97 @@ -137,11 +139,11 @@ int acpi_madt_update(unsigned char *acpi
    6.98      struct acpi_20_madt *madt;
    6.99  
   6.100      madt = acpi_madt_get_madt(acpi_start);
   6.101 -    if (!madt)
   6.102 +    if ( !madt )
   6.103          return -1;
   6.104  
   6.105      rc = acpi_madt_set_local_apics(get_vcpu_nr(), madt);
   6.106 -    if (rc != 0)
   6.107 +    if ( rc != 0 )
   6.108          return rc;
   6.109  
   6.110      set_checksum(
     7.1 --- a/tools/firmware/hvmloader/acpi_utils.c	Thu Nov 23 17:46:52 2006 +0000
     7.2 +++ b/tools/firmware/hvmloader/acpi_utils.c	Thu Nov 23 17:54:06 2006 +0000
     7.3 @@ -78,7 +78,7 @@ static void acpi_tpm_tis_probe(unsigned 
     7.4                  sizeof(tis_did_vid_rid)) != 0 )
     7.5          return;
     7.6  
     7.7 -    puts("TIS is available\n");
     7.8 +    printf("TIS is available\n");
     7.9      addr = acpi_xsdt_add_entry(acpi_start, freemem, limit,
    7.10                                 AmlCode_TPM, sizeof(AmlCode_TPM));
    7.11      if ( addr == NULL )
    7.12 @@ -133,7 +133,7 @@ struct acpi_20_rsdt *acpi_rsdt_get(unsig
    7.13      rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
    7.14      if ( rsdp->signature != ACPI_2_0_RSDP_SIGNATURE )
    7.15      {
    7.16 -        puts("Bad RSDP signature\n");
    7.17 +        printf("Bad RSDP signature\n");
    7.18          return NULL;
    7.19      }
    7.20  
    7.21 @@ -141,7 +141,7 @@ struct acpi_20_rsdt *acpi_rsdt_get(unsig
    7.22          (acpi_start + rsdp->rsdt_address - ACPI_PHYSICAL_ADDRESS);
    7.23      if ( rsdt->header.signature != ACPI_2_0_RSDT_SIGNATURE )
    7.24      {
    7.25 -        puts("Bad RSDT signature\n");
    7.26 +        printf("Bad RSDT signature\n");
    7.27          return NULL;
    7.28      }
    7.29  
    7.30 @@ -192,7 +192,7 @@ struct acpi_20_xsdt *acpi_xsdt_get(unsig
    7.31      rsdp = (struct acpi_20_rsdp *)(acpi_start + sizeof(struct acpi_20_facs));
    7.32      if ( rsdp->signature != ACPI_2_0_RSDP_SIGNATURE )
    7.33      {
    7.34 -        puts("Bad RSDP signature\n");
    7.35 +        printf("Bad RSDP signature\n");
    7.36          return NULL;
    7.37      }
    7.38  
    7.39 @@ -200,7 +200,7 @@ struct acpi_20_xsdt *acpi_xsdt_get(unsig
    7.40          (acpi_start + rsdp->xsdt_address - ACPI_PHYSICAL_ADDRESS);
    7.41      if ( xsdt->header.signature != ACPI_2_0_XSDT_SIGNATURE )
    7.42      {
    7.43 -        puts("Bad XSDT signature\n");
    7.44 +        printf("Bad XSDT signature\n");
    7.45          return NULL;
    7.46      }
    7.47      return xsdt;
    7.48 @@ -270,8 +270,9 @@ static unsigned char *acpi_xsdt_add_entr
    7.49      if ( found )
    7.50      {
    7.51          /* memory below hard limit ? */
    7.52 -        if (*freemem + table_size <= limit) {
    7.53 -            puts("Copying SSDT entry!\n");
    7.54 +        if ( (*freemem + table_size) <= limit )
    7.55 +        {
    7.56 +            printf("Copying SSDT entry\n");
    7.57              addr = *freemem;
    7.58              memcpy(addr, table, table_size);
    7.59              *freemem += table_size;
     8.1 --- a/tools/firmware/hvmloader/config.h	Thu Nov 23 17:46:52 2006 +0000
     8.2 +++ b/tools/firmware/hvmloader/config.h	Thu Nov 23 17:54:06 2006 +0000
     8.3 @@ -7,4 +7,7 @@
     8.4  
     8.5  #define LAPIC_BASE_ADDRESS  0xfee00000
     8.6  
     8.7 +#define PCI_ISA_DEVFN       0x08    /* dev 1, fn 0 */
     8.8 +#define PCI_ISA_IRQ_MASK    0x0c60U /* ISA IRQs 5,6,10,11 are PCI connected */
     8.9 +
    8.10  #endif /* __HVMLOADER_CONFIG_H__ */
     9.1 --- a/tools/firmware/hvmloader/hvmloader.c	Thu Nov 23 17:46:52 2006 +0000
     9.2 +++ b/tools/firmware/hvmloader/hvmloader.c	Thu Nov 23 17:54:06 2006 +0000
     9.3 @@ -1,13 +1,11 @@
     9.4  /*
     9.5   * hvmloader.c: HVM ROMBIOS/VGABIOS/ACPI/VMXAssist image loader.
     9.6   *
     9.7 - * A quicky so that we can boot rom images as if they were a Linux kernel.
     9.8 - * This code will copy the rom images (ROMBIOS/VGABIOS/VM86) into their
     9.9 - * respective spaces and transfer control to VM86 to execute the BIOSes.
    9.10 - *
    9.11   * Leendert van Doorn, leendert@watson.ibm.com
    9.12   * Copyright (c) 2005, International Business Machines Corporation.
    9.13   *
    9.14 + * Copyright (c) 2006, Keir Fraser, XenSource Inc.
    9.15 + *
    9.16   * This program is free software; you can redistribute it and/or modify it
    9.17   * under the terms and conditions of the GNU General Public License,
    9.18   * version 2, as published by the Free Software Foundation.
    9.19 @@ -28,8 +26,10 @@
    9.20  #include "acpi_utils.h"
    9.21  #include "smbios.h"
    9.22  #include "config.h"
    9.23 +#include "pci_regs.h"
    9.24  #include <xen/version.h>
    9.25  #include <xen/hvm/params.h>
    9.26 +#include <xen/hvm/e820.h>
    9.27  
    9.28  /* memory map */
    9.29  #define HYPERCALL_PHYSICAL_ADDRESS    0x00080000
    9.30 @@ -125,7 +125,7 @@ init_hypercalls(void)
    9.31  {
    9.32      uint32_t eax, ebx, ecx, edx;
    9.33      unsigned long i;
    9.34 -    char signature[13], number[13];
    9.35 +    char signature[13];
    9.36      xen_extraversion_t extraversion;
    9.37  
    9.38      cpuid(0x40000000, &eax, &ebx, &ecx, &edx);
    9.39 @@ -137,25 +137,19 @@ init_hypercalls(void)
    9.40  
    9.41      if ( strcmp("XenVMMXenVMM", signature) || (eax < 0x40000002) )
    9.42      {
    9.43 -        puts("FATAL: Xen hypervisor not detected\n");
    9.44 +        printf("FATAL: Xen hypervisor not detected\n");
    9.45          __asm__ __volatile__( "ud2" );
    9.46      }
    9.47  
    9.48 -    cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
    9.49 -
    9.50 -    puts("Detected Xen v");
    9.51 -    puts(itoa(number, eax >> 16));
    9.52 -    puts(".");
    9.53 -    puts(itoa(number, eax & 0xffff));
    9.54 -
    9.55 +    /* Fill in hypercall transfer pages. */
    9.56      cpuid(0x40000002, &eax, &ebx, &ecx, &edx);
    9.57 -
    9.58      for ( i = 0; i < eax; i++ )
    9.59          wrmsr(ebx, HYPERCALL_PHYSICAL_ADDRESS + (i << 12) + i);
    9.60  
    9.61 +    /* Print version information. */
    9.62 +    cpuid(0x40000001, &eax, &ebx, &ecx, &edx);
    9.63      hypercall_xen_version(XENVER_extraversion, extraversion);
    9.64 -    puts(extraversion);
    9.65 -    puts("\n");
    9.66 +    printf("Detected Xen v%u.%u%s\n", eax >> 16, eax & 0xffff, extraversion);
    9.67  }
    9.68  
    9.69  static void apic_setup(void)
    9.70 @@ -172,38 +166,157 @@ static void apic_setup(void)
    9.71      *iowin    = IOAPIC_ID;
    9.72  }
    9.73  
    9.74 +static void pci_setup(void)
    9.75 +{
    9.76 +    uint32_t devfn, bar_reg, bar_data, bar_sz, cmd;
    9.77 +    uint32_t *base, io_base = 0xc000, mem_base = HVM_BELOW_4G_MMIO_START;
    9.78 +    uint16_t class, vendor_id, device_id;
    9.79 +    unsigned int bar, pin, link, isa_irq;
    9.80 +
    9.81 +    /* Program PCI-ISA bridge with appropriate link routes. */
    9.82 +    link = 0;
    9.83 +    for ( isa_irq = 0; isa_irq < 15; isa_irq++ )
    9.84 +    {
    9.85 +        if ( !(PCI_ISA_IRQ_MASK & (1U << isa_irq)) )
    9.86 +            continue;
    9.87 +        pci_writeb(PCI_ISA_DEVFN, 0x60 + link, isa_irq);
    9.88 +        printf("PCI-ISA link %u routed to IRQ%u\n", link, isa_irq);
    9.89 +        if ( link++ == 4 )
    9.90 +            break;
    9.91 +    }
    9.92 +
    9.93 +    /* Program ELCR to match PCI-wired IRQs. */
    9.94 +    outb(0x4d0, (uint8_t)(PCI_ISA_IRQ_MASK >> 0));
    9.95 +    outb(0x4d1, (uint8_t)(PCI_ISA_IRQ_MASK >> 8));
    9.96 +
    9.97 +    /* Scan the PCI bus and map resources. */
    9.98 +    for ( devfn = 0; devfn < 128; devfn++ )
    9.99 +    {
   9.100 +        class     = pci_readw(devfn, PCI_CLASS_DEVICE);
   9.101 +        vendor_id = pci_readw(devfn, PCI_VENDOR_ID);
   9.102 +        device_id = pci_readw(devfn, PCI_DEVICE_ID);
   9.103 +        if ( (vendor_id == 0xffff) && (device_id == 0xffff) )
   9.104 +            continue;
   9.105 +
   9.106 +        ASSERT((devfn != PCI_ISA_DEVFN) ||
   9.107 +               ((vendor_id == 0x8086) && (device_id == 0x7000)));
   9.108 +
   9.109 +        switch ( class )
   9.110 +        {
   9.111 +        case 0x0680:
   9.112 +            ASSERT((vendor_id == 0x8086) && (device_id == 0x7113));
   9.113 +            /*
   9.114 +             * PIIX4 ACPI PM. Special device with special PCI config space.
   9.115 +             * No ordinary BARs.
   9.116 +             */
   9.117 +            pci_writew(devfn, 0x20, 0x0000); /* No smb bus IO enable */
   9.118 +            pci_writew(devfn, 0x22, 0x0000);
   9.119 +            pci_writew(devfn, 0x3c, 0x0009); /* Hardcoded IRQ9 */
   9.120 +            pci_writew(devfn, 0x3d, 0x0001);
   9.121 +            break;
   9.122 +        case 0x0101:
   9.123 +            /* PIIX3 IDE */
   9.124 +            ASSERT((vendor_id == 0x8086) && (device_id == 0x7010));
   9.125 +            pci_writew(devfn, 0x40, 0x8000); /* enable IDE0 */
   9.126 +            pci_writew(devfn, 0x42, 0x8000); /* enable IDE1 */
   9.127 +            /* fall through */
   9.128 +        default:
   9.129 +            /* Default memory mappings. */
   9.130 +            for ( bar = 0; bar < 7; bar++ )
   9.131 +            {
   9.132 +                bar_reg = PCI_BASE_ADDRESS_0 + 4*bar;
   9.133 +                if ( bar == 6 )
   9.134 +                    bar_reg = PCI_ROM_ADDRESS;
   9.135 +
   9.136 +                bar_data = pci_readl(devfn, bar_reg);
   9.137 +
   9.138 +                pci_writel(devfn, bar_reg, ~0);
   9.139 +                bar_sz = pci_readl(devfn, bar_reg);
   9.140 +                if ( bar_sz == 0 )
   9.141 +                    continue;
   9.142 +
   9.143 +                if ( (bar_data & PCI_BASE_ADDRESS_SPACE) ==
   9.144 +                     PCI_BASE_ADDRESS_SPACE_MEMORY )
   9.145 +                {
   9.146 +                    base = &mem_base;
   9.147 +                    bar_sz &= PCI_BASE_ADDRESS_MEM_MASK;
   9.148 +                    bar_data &= ~PCI_BASE_ADDRESS_MEM_MASK;
   9.149 +                }
   9.150 +                else
   9.151 +                {
   9.152 +                    base = &io_base;
   9.153 +                    bar_sz &= PCI_BASE_ADDRESS_IO_MASK & 0xffff;
   9.154 +                    bar_data &= ~PCI_BASE_ADDRESS_IO_MASK;
   9.155 +                }
   9.156 +                bar_sz &= ~(bar_sz - 1);
   9.157 +
   9.158 +                *base = (*base + bar_sz - 1) & ~(bar_sz - 1);
   9.159 +                bar_data |= *base;
   9.160 +                *base += bar_sz;
   9.161 +
   9.162 +                pci_writel(devfn, bar_reg, bar_data);
   9.163 +                printf("pci dev %02x:%x bar %02x size %08x: %08x\n",
   9.164 +                       devfn>>3, devfn&7, bar_reg, bar_sz, bar_data);
   9.165 +
   9.166 +                /* Now enable the memory or I/O mapping. */
   9.167 +                cmd = pci_readw(devfn, PCI_COMMAND);
   9.168 +                if ( (bar_reg == PCI_ROM_ADDRESS) ||
   9.169 +                     ((bar_data & PCI_BASE_ADDRESS_SPACE) ==
   9.170 +                      PCI_BASE_ADDRESS_SPACE_MEMORY) )
   9.171 +                    cmd |= PCI_COMMAND_MEMORY;
   9.172 +                else
   9.173 +                    cmd |= PCI_COMMAND_IO;
   9.174 +                pci_writew(devfn, PCI_COMMAND, cmd);
   9.175 +            }
   9.176 +            break;
   9.177 +        }
   9.178 +
   9.179 +        /* Map the interrupt. */
   9.180 +        pin = pci_readb(devfn, PCI_INTERRUPT_PIN);
   9.181 +        if ( pin != 0 )
   9.182 +        {
   9.183 +            /* This is the barber's pole mapping used by Xen. */
   9.184 +            link = ((pin - 1) + (devfn >> 3)) & 3;
   9.185 +            isa_irq = pci_readb(PCI_ISA_DEVFN, 0x60 + link);
   9.186 +            pci_writeb(devfn, PCI_INTERRUPT_LINE, isa_irq);
   9.187 +            printf("pci dev %02x:%x INT%c->IRQ%u\n",
   9.188 +                   devfn>>3, devfn&7, 'A'+pin-1, isa_irq);
   9.189 +        }
   9.190 +    }
   9.191 +}
   9.192 +
   9.193  int main(void)
   9.194  {
   9.195 -    puts("HVM Loader\n");
   9.196 +    printf("HVM Loader\n");
   9.197  
   9.198      init_hypercalls();
   9.199  
   9.200 -    puts("Writing SMBIOS tables ...\n");
   9.201 +    printf("Writing SMBIOS tables ...\n");
   9.202      hvm_write_smbios_tables();
   9.203  
   9.204 -    puts("Loading ROMBIOS ...\n");
   9.205 +    printf("Loading ROMBIOS ...\n");
   9.206      memcpy((void *)ROMBIOS_PHYSICAL_ADDRESS, rombios, sizeof(rombios));
   9.207  
   9.208      apic_setup();
   9.209 -
   9.210 +    pci_setup();
   9.211      create_mp_tables();
   9.212  
   9.213      if ( cirrus_check() )
   9.214      {
   9.215 -        puts("Loading Cirrus VGABIOS ...\n");
   9.216 +        printf("Loading Cirrus VGABIOS ...\n");
   9.217          memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
   9.218                 vgabios_cirrusvga, sizeof(vgabios_cirrusvga));
   9.219      }
   9.220      else
   9.221      {
   9.222 -        puts("Loading Standard VGABIOS ...\n");
   9.223 +        printf("Loading Standard VGABIOS ...\n");
   9.224          memcpy((void *)VGABIOS_PHYSICAL_ADDRESS,
   9.225                 vgabios_stdvga, sizeof(vgabios_stdvga));
   9.226      }
   9.227  
   9.228      if ( get_acpi_enabled() != 0 )
   9.229      {
   9.230 -        puts("Loading ACPI ...\n");
   9.231 +        printf("Loading ACPI ...\n");
   9.232          acpi_madt_update((unsigned char *) acpi);
   9.233          if ( (ACPI_PHYSICAL_ADDRESS + sizeof(acpi)) <= 0xF0000 )
   9.234          {
   9.235 @@ -225,23 +338,23 @@ int main(void)
   9.236      if ( check_amd() )
   9.237      {
   9.238          /* AMD implies this is SVM */
   9.239 -        puts("SVM go ...\n");
   9.240 +        printf("SVM go ...\n");
   9.241          vmmcall(SVM_VMMCALL_RESET_TO_REALMODE, 0, 0, 0, 0, 0);
   9.242      }
   9.243      else
   9.244      {
   9.245 -        puts("Loading VMXAssist ...\n");
   9.246 +        printf("Loading VMXAssist ...\n");
   9.247          memcpy((void *)VMXASSIST_PHYSICAL_ADDRESS,
   9.248                 vmxassist, sizeof(vmxassist));
   9.249  
   9.250 -        puts("VMX go ...\n");
   9.251 +        printf("VMX go ...\n");
   9.252          __asm__ __volatile__(
   9.253              "jmp *%%eax"
   9.254              : : "a" (VMXASSIST_PHYSICAL_ADDRESS), "d" (0)
   9.255              );
   9.256      }
   9.257  
   9.258 -    puts("Failed to invoke ROMBIOS\n");
   9.259 +    printf("Failed to invoke ROMBIOS\n");
   9.260      return 0;
   9.261  }
   9.262  
    10.1 --- a/tools/firmware/hvmloader/mp_tables.c	Thu Nov 23 17:46:52 2006 +0000
    10.2 +++ b/tools/firmware/hvmloader/mp_tables.c	Thu Nov 23 17:54:06 2006 +0000
    10.3 @@ -263,10 +263,7 @@ void fill_mp_io_intr_entry(
    10.4  {
    10.5      mpiie->type = ENTRY_TYPE_IO_INTR;
    10.6      mpiie->intr_type = INTR_TYPE_INT;
    10.7 -    mpiie->io_intr_flags = 0;
    10.8 -    /* IRQs 10 and 11 are PCI, so level triggered and active low. */
    10.9 -    if ( (src_bus_irq == 10) || (src_bus_irq == 11) )
   10.10 -        mpiie->io_intr_flags = 0xf;
   10.11 +    mpiie->io_intr_flags = (PCI_ISA_IRQ_MASK & (1U<<src_bus_irq)) ? 0xf : 0x0;
   10.12      mpiie->src_bus_id = src_bus_id;
   10.13      mpiie->src_bus_irq = src_bus_irq;
   10.14      mpiie->dst_ioapic_id = ioapic_id;
   10.15 @@ -349,13 +346,13 @@ void create_mp_tables(void)
   10.16  
   10.17      vcpu_nr = get_vcpu_nr();
   10.18  
   10.19 -    puts("Creating MP tables ...\n");
   10.20 +    printf("Creating MP tables ...\n");
   10.21  
   10.22      /* Find the 'safe' place in ROMBIOS for the MP tables. */
   10.23      mp_table_base = get_mp_table_start();
   10.24      if ( mp_table_base == NULL )
   10.25      {
   10.26 -        puts("Couldn't find start point for MP tables\n");
   10.27 +        printf("Couldn't find start point for MP tables\n");
   10.28          return;
   10.29      }
   10.30  
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/tools/firmware/hvmloader/pci_regs.h	Thu Nov 23 17:54:06 2006 +0000
    11.3 @@ -0,0 +1,108 @@
    11.4 +/*
    11.5 + *	pci_regs.h
    11.6 + *
    11.7 + *	PCI standard defines
    11.8 + *	Copyright 1994, Drew Eckhardt
    11.9 + *	Copyright 1997--1999 Martin Mares <mj@ucw.cz>
   11.10 + *
   11.11 + *	For more information, please consult the following manuals (look at
   11.12 + *	http://www.pcisig.com/ for how to get them):
   11.13 + *
   11.14 + *	PCI BIOS Specification
   11.15 + *	PCI Local Bus Specification
   11.16 + *	PCI to PCI Bridge Specification
   11.17 + *	PCI System Design Guide
   11.18 + */
   11.19 +
   11.20 +#ifndef __HVMLOADER_PCI_REGS_H__
   11.21 +#define __HVMLOADER_PCI_REGS_H__
   11.22 +
   11.23 +#define PCI_VENDOR_ID		0x00	/* 16 bits */
   11.24 +#define PCI_DEVICE_ID		0x02	/* 16 bits */
   11.25 +#define PCI_COMMAND		0x04	/* 16 bits */
   11.26 +#define  PCI_COMMAND_IO		0x1	/* Enable response in I/O space */
   11.27 +#define  PCI_COMMAND_MEMORY	0x2	/* Enable response in Memory space */
   11.28 +#define  PCI_COMMAND_MASTER	0x4	/* Enable bus mastering */
   11.29 +#define  PCI_COMMAND_SPECIAL	0x8	/* Enable response to special cycles */
   11.30 +#define  PCI_COMMAND_INVALIDATE	0x10	/* Use memory write and invalidate */
   11.31 +#define  PCI_COMMAND_VGA_PALETTE 0x20	/* Enable palette snooping */
   11.32 +#define  PCI_COMMAND_PARITY	0x40	/* Enable parity checking */
   11.33 +#define  PCI_COMMAND_WAIT 	0x80	/* Enable address/data stepping */
   11.34 +#define  PCI_COMMAND_SERR	0x100	/* Enable SERR */
   11.35 +#define  PCI_COMMAND_FAST_BACK	0x200	/* Enable back-to-back writes */
   11.36 +#define  PCI_COMMAND_INTX_DISABLE 0x400 /* INTx Emulation Disable */
   11.37 +
   11.38 +#define PCI_STATUS		0x06	/* 16 bits */
   11.39 +#define  PCI_STATUS_CAP_LIST	0x10	/* Support Capability List */
   11.40 +#define  PCI_STATUS_66MHZ	0x20	/* Support 66 Mhz PCI 2.1 bus */
   11.41 +#define  PCI_STATUS_UDF		0x40	/* Support User Definable Features [obsolete] */
   11.42 +#define  PCI_STATUS_FAST_BACK	0x80	/* Accept fast-back to back */
   11.43 +#define  PCI_STATUS_PARITY	0x100	/* Detected parity error */
   11.44 +#define  PCI_STATUS_DEVSEL_MASK	0x600	/* DEVSEL timing */
   11.45 +#define  PCI_STATUS_DEVSEL_FAST		0x000
   11.46 +#define  PCI_STATUS_DEVSEL_MEDIUM	0x200
   11.47 +#define  PCI_STATUS_DEVSEL_SLOW		0x400
   11.48 +#define  PCI_STATUS_SIG_TARGET_ABORT	0x800 /* Set on target abort */
   11.49 +#define  PCI_STATUS_REC_TARGET_ABORT	0x1000 /* Master ack of " */
   11.50 +#define  PCI_STATUS_REC_MASTER_ABORT	0x2000 /* Set on master abort */
   11.51 +#define  PCI_STATUS_SIG_SYSTEM_ERROR	0x4000 /* Set when we drive SERR */
   11.52 +#define  PCI_STATUS_DETECTED_PARITY	0x8000 /* Set on parity error */
   11.53 +
   11.54 +#define PCI_CLASS_REVISION	0x08	/* High 24 bits are class, low 8 revision */
   11.55 +#define PCI_REVISION_ID		0x08	/* Revision ID */
   11.56 +#define PCI_CLASS_PROG		0x09	/* Reg. Level Programming Interface */
   11.57 +#define PCI_CLASS_DEVICE	0x0a	/* Device class */
   11.58 +
   11.59 +#define PCI_CACHE_LINE_SIZE	0x0c	/* 8 bits */
   11.60 +#define PCI_LATENCY_TIMER	0x0d	/* 8 bits */
   11.61 +#define PCI_HEADER_TYPE		0x0e	/* 8 bits */
   11.62 +#define  PCI_HEADER_TYPE_NORMAL		0
   11.63 +#define  PCI_HEADER_TYPE_BRIDGE		1
   11.64 +#define  PCI_HEADER_TYPE_CARDBUS	2
   11.65 +
   11.66 +#define PCI_BIST		0x0f	/* 8 bits */
   11.67 +#define  PCI_BIST_CODE_MASK	0x0f	/* Return result */
   11.68 +#define  PCI_BIST_START		0x40	/* 1 to start BIST, 2 secs or less */
   11.69 +#define  PCI_BIST_CAPABLE	0x80	/* 1 if BIST capable */
   11.70 +
   11.71 +/*
   11.72 + * Base addresses specify locations in memory or I/O space.
   11.73 + * Decoded size can be determined by writing a value of
   11.74 + * 0xffffffff to the register, and reading it back.  Only
   11.75 + * 1 bits are decoded.
   11.76 + */
   11.77 +#define PCI_BASE_ADDRESS_0	0x10	/* 32 bits */
   11.78 +#define PCI_BASE_ADDRESS_1	0x14	/* 32 bits [htype 0,1 only] */
   11.79 +#define PCI_BASE_ADDRESS_2	0x18	/* 32 bits [htype 0 only] */
   11.80 +#define PCI_BASE_ADDRESS_3	0x1c	/* 32 bits */
   11.81 +#define PCI_BASE_ADDRESS_4	0x20	/* 32 bits */
   11.82 +#define PCI_BASE_ADDRESS_5	0x24	/* 32 bits */
   11.83 +#define  PCI_BASE_ADDRESS_SPACE		0x01	/* 0 = memory, 1 = I/O */
   11.84 +#define  PCI_BASE_ADDRESS_SPACE_IO	0x01
   11.85 +#define  PCI_BASE_ADDRESS_SPACE_MEMORY	0x00
   11.86 +#define  PCI_BASE_ADDRESS_MEM_TYPE_MASK	0x06
   11.87 +#define  PCI_BASE_ADDRESS_MEM_TYPE_32	0x00	/* 32 bit address */
   11.88 +#define  PCI_BASE_ADDRESS_MEM_TYPE_1M	0x02	/* Below 1M [obsolete] */
   11.89 +#define  PCI_BASE_ADDRESS_MEM_TYPE_64	0x04	/* 64 bit address */
   11.90 +#define  PCI_BASE_ADDRESS_MEM_PREFETCH	0x08	/* prefetchable? */
   11.91 +#define  PCI_BASE_ADDRESS_MEM_MASK	(~0x0fUL)
   11.92 +#define  PCI_BASE_ADDRESS_IO_MASK	(~0x03UL)
   11.93 +/* bit 1 is reserved if address_space = 1 */
   11.94 +
   11.95 +/* Header type 0 (normal devices) */
   11.96 +#define PCI_CARDBUS_CIS		0x28
   11.97 +#define PCI_SUBSYSTEM_VENDOR_ID	0x2c
   11.98 +#define PCI_SUBSYSTEM_ID	0x2e
   11.99 +#define PCI_ROM_ADDRESS		0x30	/* Bits 31..11 are address, 10..1 reserved */
  11.100 +#define  PCI_ROM_ADDRESS_ENABLE	0x01
  11.101 +#define PCI_ROM_ADDRESS_MASK	(~0x7ffUL)
  11.102 +
  11.103 +#define PCI_CAPABILITY_LIST	0x34	/* Offset of first capability list entry */
  11.104 +
  11.105 +/* 0x35-0x3b are reserved */
  11.106 +#define PCI_INTERRUPT_LINE	0x3c	/* 8 bits */
  11.107 +#define PCI_INTERRUPT_PIN	0x3d	/* 8 bits */
  11.108 +#define PCI_MIN_GNT		0x3e	/* 8 bits */
  11.109 +#define PCI_MAX_LAT		0x3f	/* 8 bits */
  11.110 +
  11.111 +#endif /* __HVMLOADER_PCI_REGS_H__ */
    12.1 --- a/tools/firmware/hvmloader/smbios.c	Thu Nov 23 17:46:52 2006 +0000
    12.2 +++ b/tools/firmware/hvmloader/smbios.c	Thu Nov 23 17:54:06 2006 +0000
    12.3 @@ -30,29 +30,29 @@
    12.4  
    12.5  static size_t
    12.6  write_smbios_tables(void *start,
    12.7 -		    uint32_t vcpus, uint64_t memsize,
    12.8 -		    uint8_t uuid[16], char *xen_version,
    12.9 -		    uint32_t xen_major_version, uint32_t xen_minor_version);
   12.10 +                    uint32_t vcpus, uint64_t memsize,
   12.11 +                    uint8_t uuid[16], char *xen_version,
   12.12 +                    uint32_t xen_major_version, uint32_t xen_minor_version);
   12.13  
   12.14  static void
   12.15  get_cpu_manufacturer(char *buf, int len);
   12.16  static void
   12.17  smbios_entry_point_init(void *start,
   12.18 -			uint16_t max_structure_size,
   12.19 -			uint16_t structure_table_length,
   12.20 -			uint32_t structure_table_address,
   12.21 -			uint16_t number_of_structures);
   12.22 +                        uint16_t max_structure_size,
   12.23 +                        uint16_t structure_table_length,
   12.24 +                        uint32_t structure_table_address,
   12.25 +                        uint16_t number_of_structures);
   12.26  static void *
   12.27  smbios_type_0_init(void *start, const char *xen_version,
   12.28 -		   uint32_t xen_major_version, uint32_t xen_minor_version);
   12.29 +                   uint32_t xen_major_version, uint32_t xen_minor_version);
   12.30  static void *
   12.31  smbios_type_1_init(void *start, const char *xen_version, 
   12.32 -		   uint8_t uuid[16]);
   12.33 +                   uint8_t uuid[16]);
   12.34  static void *
   12.35  smbios_type_3_init(void *start);
   12.36  static void *
   12.37  smbios_type_4_init(void *start, unsigned int cpu_number,
   12.38 -		   char *cpu_manufacturer);
   12.39 +                   char *cpu_manufacturer);
   12.40  static void *
   12.41  smbios_type_16_init(void *start, uint32_t memory_size_mb);
   12.42  static void *
   12.43 @@ -69,64 +69,64 @@ smbios_type_127_init(void *start);
   12.44  static void
   12.45  get_cpu_manufacturer(char *buf, int len)
   12.46  {
   12.47 -	char id[12];
   12.48 -	uint32_t eax = 0;
   12.49 +    char id[12];
   12.50 +    uint32_t eax = 0;
   12.51  
   12.52 -	cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
   12.53 -	      (uint32_t *)&id[4]);
   12.54 +    cpuid(0, &eax, (uint32_t *)&id[0], (uint32_t *)&id[8],
   12.55 +          (uint32_t *)&id[4]);
   12.56  
   12.57 -	if (memcmp(id, "GenuineIntel", 12) == 0)
   12.58 -		strncpy(buf, "Intel", len);
   12.59 -	else if (memcmp(id, "AuthenticAMD", 12) == 0)
   12.60 -		strncpy(buf, "AMD", len);
   12.61 -	else
   12.62 -		strncpy(buf, "unknown", len);
   12.63 +    if (memcmp(id, "GenuineIntel", 12) == 0)
   12.64 +        strncpy(buf, "Intel", len);
   12.65 +    else if (memcmp(id, "AuthenticAMD", 12) == 0)
   12.66 +        strncpy(buf, "AMD", len);
   12.67 +    else
   12.68 +        strncpy(buf, "unknown", len);
   12.69  }
   12.70  
   12.71  static size_t
   12.72  write_smbios_tables(void *start,
   12.73 -		    uint32_t vcpus, uint64_t memsize,
   12.74 -		    uint8_t uuid[16], char *xen_version,
   12.75 -		    uint32_t xen_major_version, uint32_t xen_minor_version)
   12.76 +                    uint32_t vcpus, uint64_t memsize,
   12.77 +                    uint8_t uuid[16], char *xen_version,
   12.78 +                    uint32_t xen_major_version, uint32_t xen_minor_version)
   12.79  {
   12.80 -	unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
   12.81 -	char *p, *q;
   12.82 -	char cpu_manufacturer[15];
   12.83 +    unsigned cpu_num, nr_structs = 0, max_struct_size = 0;
   12.84 +    char *p, *q;
   12.85 +    char cpu_manufacturer[15];
   12.86  
   12.87 -	get_cpu_manufacturer(cpu_manufacturer, 15);
   12.88 +    get_cpu_manufacturer(cpu_manufacturer, 15);
   12.89  
   12.90 -	p = (char *)start + sizeof(struct smbios_entry_point);
   12.91 +    p = (char *)start + sizeof(struct smbios_entry_point);
   12.92  
   12.93 -#define do_struct(fn) do {			\
   12.94 -	q = (fn);				\
   12.95 -	nr_structs++;				\
   12.96 -	if ((q - p) > max_struct_size)		\
   12.97 -		max_struct_size = q - p;	\
   12.98 -	p = q;					\
   12.99 +#define do_struct(fn) do {                      \
  12.100 +    q = (fn);                                   \
  12.101 +    nr_structs++;                               \
  12.102 +    if ( (q - p) > max_struct_size )            \
  12.103 +        max_struct_size = q - p;                \
  12.104 +    p = q;                                      \
  12.105  } while (0)
  12.106  
  12.107 -	do_struct(smbios_type_0_init(p, xen_version, xen_major_version,
  12.108 -				     xen_minor_version));
  12.109 -	do_struct(smbios_type_1_init(p, xen_version, uuid));
  12.110 -	do_struct(smbios_type_3_init(p));
  12.111 -	for (cpu_num = 1; cpu_num <= vcpus; cpu_num++)
  12.112 -		do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
  12.113 -	do_struct(smbios_type_16_init(p, memsize));
  12.114 -	do_struct(smbios_type_17_init(p, memsize));
  12.115 -	do_struct(smbios_type_19_init(p, memsize));
  12.116 -	do_struct(smbios_type_20_init(p, memsize));
  12.117 -	do_struct(smbios_type_32_init(p));
  12.118 -	do_struct(smbios_type_127_init(p));
  12.119 +    do_struct(smbios_type_0_init(p, xen_version, xen_major_version,
  12.120 +                                 xen_minor_version));
  12.121 +    do_struct(smbios_type_1_init(p, xen_version, uuid));
  12.122 +    do_struct(smbios_type_3_init(p));
  12.123 +    for ( cpu_num = 1; cpu_num <= vcpus; cpu_num++ )
  12.124 +        do_struct(smbios_type_4_init(p, cpu_num, cpu_manufacturer));
  12.125 +    do_struct(smbios_type_16_init(p, memsize));
  12.126 +    do_struct(smbios_type_17_init(p, memsize));
  12.127 +    do_struct(smbios_type_19_init(p, memsize));
  12.128 +    do_struct(smbios_type_20_init(p, memsize));
  12.129 +    do_struct(smbios_type_32_init(p));
  12.130 +    do_struct(smbios_type_127_init(p));
  12.131  
  12.132  #undef do_struct
  12.133  
  12.134 -	smbios_entry_point_init(
  12.135 -		start, max_struct_size,
  12.136 -		(p - (char *)start) - sizeof(struct smbios_entry_point),
  12.137 -		SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
  12.138 -		nr_structs);
  12.139 +    smbios_entry_point_init(
  12.140 +        start, max_struct_size,
  12.141 +        (p - (char *)start) - sizeof(struct smbios_entry_point),
  12.142 +        SMBIOS_PHYSICAL_ADDRESS + sizeof(struct smbios_entry_point),
  12.143 +        nr_structs);
  12.144  
  12.145 -	return (size_t)((char *)p - (char *)start);
  12.146 +    return (size_t)((char *)p - (char *)start);
  12.147  }
  12.148  
  12.149  /* This tries to figure out how much pseudo-physical memory (in MB)
  12.150 @@ -142,428 +142,439 @@ write_smbios_tables(void *start,
  12.151  static uint64_t
  12.152  get_memsize(void)
  12.153  {
  12.154 -	struct e820entry *map = NULL;
  12.155 -	uint8_t num_entries = 0;
  12.156 -	uint64_t memsize = 0;
  12.157 -	uint8_t i;
  12.158 +    struct e820entry *map = NULL;
  12.159 +    uint8_t num_entries = 0;
  12.160 +    uint64_t memsize = 0;
  12.161 +    uint8_t i;
  12.162  
  12.163 -	map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
  12.164 -	num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
  12.165 +    map = (struct e820entry *) (E820_MAP_PAGE + E820_MAP_OFFSET);
  12.166 +    num_entries = *((uint8_t *) (E820_MAP_PAGE + E820_MAP_NR_OFFSET));
  12.167  
  12.168 -	/* walk through e820map, ignoring any entries that aren't marked
  12.169 -	   as usable or reserved. */
  12.170 +    /* walk through e820map, ignoring any entries that aren't marked
  12.171 +       as usable or reserved. */
  12.172  
  12.173 -	for (i = 0; i < num_entries; i++) {
  12.174 -		if (map->type == E820_RAM || map->type == E820_RESERVED)
  12.175 -			memsize += map->size;
  12.176 -		map++;
  12.177 -	}
  12.178 +    for ( i = 0; i < num_entries; i++ )
  12.179 +    {
  12.180 +        if (map->type == E820_RAM || map->type == E820_RESERVED)
  12.181 +            memsize += map->size;
  12.182 +        map++;
  12.183 +    }
  12.184  
  12.185 -	/* Round up to the nearest MB.  The user specifies domU
  12.186 -	   pseudo-physical memory in megabytes, so not doing this
  12.187 -	   could easily lead to reporting one less MB than the user
  12.188 -	   specified. */
  12.189 -	if (memsize & ((1<<20)-1))
  12.190 -		memsize = (memsize >> 20) + 1;
  12.191 -	else
  12.192 -		memsize = (memsize >> 20);
  12.193 +    /* Round up to the nearest MB.  The user specifies domU
  12.194 +       pseudo-physical memory in megabytes, so not doing this
  12.195 +       could easily lead to reporting one less MB than the user
  12.196 +       specified. */
  12.197 +    if ( memsize & ((1<<20)-1) )
  12.198 +        memsize = (memsize >> 20) + 1;
  12.199 +    else
  12.200 +        memsize = (memsize >> 20);
  12.201  
  12.202 -	return memsize;
  12.203 +    return memsize;
  12.204  }
  12.205  
  12.206  void
  12.207  hvm_write_smbios_tables(void)
  12.208  {
  12.209 -	uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
  12.210 -			     not uint8_t[16]. ** */
  12.211 -	uint16_t xen_major_version, xen_minor_version;
  12.212 -	uint32_t xen_version;
  12.213 -	char xen_extra_version[XEN_EXTRAVERSION_LEN];
  12.214 -	/* guess conservatively on buffer length for Xen version string */
  12.215 -	char xen_version_str[80];
  12.216 -	/* temporary variables used to build up Xen version string */
  12.217 -	char *p = NULL; /* points to next point of insertion */
  12.218 -	unsigned len = 0; /* length of string already composed */
  12.219 -	char *tmp = NULL; /* holds result of itoa() */
  12.220 -	unsigned tmp_len; /* length of next string to add */
  12.221 +    uint8_t uuid[16]; /* ** This will break if xen_domain_handle_t is
  12.222 +                         not uint8_t[16]. ** */
  12.223 +    uint16_t xen_major_version, xen_minor_version;
  12.224 +    uint32_t xen_version;
  12.225 +    char xen_extra_version[XEN_EXTRAVERSION_LEN];
  12.226 +    /* guess conservatively on buffer length for Xen version string */
  12.227 +    char xen_version_str[80];
  12.228 +    /* temporary variables used to build up Xen version string */
  12.229 +    char *p = NULL; /* points to next point of insertion */
  12.230 +    unsigned len = 0; /* length of string already composed */
  12.231 +    char *tmp = NULL; /* holds result of itoa() */
  12.232 +    unsigned tmp_len; /* length of next string to add */
  12.233  
  12.234 -	hypercall_xen_version(XENVER_guest_handle, uuid);
  12.235 +    hypercall_xen_version(XENVER_guest_handle, uuid);
  12.236  
  12.237 -	/* xen_version major and minor */
  12.238 -	xen_version = hypercall_xen_version(XENVER_version, NULL);
  12.239 -	xen_major_version = (uint16_t) (xen_version >> 16);
  12.240 -	xen_minor_version = (uint16_t) xen_version;
  12.241 +    /* xen_version major and minor */
  12.242 +    xen_version = hypercall_xen_version(XENVER_version, NULL);
  12.243 +    xen_major_version = (uint16_t) (xen_version >> 16);
  12.244 +    xen_minor_version = (uint16_t) xen_version;
  12.245  
  12.246 -	hypercall_xen_version(XENVER_extraversion, xen_extra_version);
  12.247 +    hypercall_xen_version(XENVER_extraversion, xen_extra_version);
  12.248  
  12.249 -	/* build up human-readable Xen version string */
  12.250 -	p = xen_version_str;
  12.251 -	len = 0;
  12.252 +    /* build up human-readable Xen version string */
  12.253 +    p = xen_version_str;
  12.254 +    len = 0;
  12.255  
  12.256 -	itoa(tmp, xen_major_version);
  12.257 -	tmp_len = strlen(tmp);
  12.258 -	len += tmp_len;
  12.259 -	if (len >= sizeof(xen_version_str))
  12.260 -		goto error_out;
  12.261 -	strcpy(p, tmp);
  12.262 -	p += tmp_len;
  12.263 +    itoa(tmp, xen_major_version);
  12.264 +    tmp_len = strlen(tmp);
  12.265 +    len += tmp_len;
  12.266 +    if ( len >= sizeof(xen_version_str) )
  12.267 +        goto error_out;
  12.268 +    strcpy(p, tmp);
  12.269 +    p += tmp_len;
  12.270  
  12.271 -	len++;
  12.272 -	if (len >= sizeof(xen_version_str))
  12.273 -		goto error_out;
  12.274 -	*p = '.';
  12.275 -	p++;
  12.276 +    len++;
  12.277 +    if ( len >= sizeof(xen_version_str) )
  12.278 +        goto error_out;
  12.279 +    *p = '.';
  12.280 +    p++;
  12.281  
  12.282 -	itoa(tmp, xen_minor_version);
  12.283 -	tmp_len = strlen(tmp);
  12.284 -	len += tmp_len;
  12.285 -	if (len >= sizeof(xen_version_str))
  12.286 -		goto error_out;
  12.287 -	strcpy(p, tmp);
  12.288 -	p += tmp_len;
  12.289 +    itoa(tmp, xen_minor_version);
  12.290 +    tmp_len = strlen(tmp);
  12.291 +    len += tmp_len;
  12.292 +    if ( len >= sizeof(xen_version_str) )
  12.293 +        goto error_out;
  12.294 +    strcpy(p, tmp);
  12.295 +    p += tmp_len;
  12.296  
  12.297 -	tmp_len = strlen(xen_extra_version);
  12.298 -	len += tmp_len;
  12.299 -	if (len >= sizeof(xen_version_str))
  12.300 -		goto error_out;
  12.301 -	strcpy(p, xen_extra_version);
  12.302 -	p += tmp_len;
  12.303 +    tmp_len = strlen(xen_extra_version);
  12.304 +    len += tmp_len;
  12.305 +    if ( len >= sizeof(xen_version_str) )
  12.306 +        goto error_out;
  12.307 +    strcpy(p, xen_extra_version);
  12.308 +    p += tmp_len;
  12.309  
  12.310 -	xen_version_str[sizeof(xen_version_str)-1] = '\0';
  12.311 +    xen_version_str[sizeof(xen_version_str)-1] = '\0';
  12.312  
  12.313 -	/* NB. 0xC0000 is a safe large memory area for scratch. */
  12.314 -	len = write_smbios_tables((void *)0xC0000,
  12.315 -				  get_vcpu_nr(), get_memsize(),
  12.316 -				  uuid, xen_version_str,
  12.317 -				  xen_major_version, xen_minor_version);
  12.318 -	if (len > SMBIOS_SIZE_LIMIT)
  12.319 -		goto error_out;
  12.320 -	/* Okay, not too large: copy out of scratch to final location. */
  12.321 -	memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
  12.322 +    /* NB. 0xC0000 is a safe large memory area for scratch. */
  12.323 +    len = write_smbios_tables((void *)0xC0000,
  12.324 +                              get_vcpu_nr(), get_memsize(),
  12.325 +                              uuid, xen_version_str,
  12.326 +                              xen_major_version, xen_minor_version);
  12.327 +    if ( len > SMBIOS_SIZE_LIMIT )
  12.328 +        goto error_out;
  12.329 +    /* Okay, not too large: copy out of scratch to final location. */
  12.330 +    memcpy((void *)SMBIOS_PHYSICAL_ADDRESS, (void *)0xC0000, len);
  12.331  
  12.332 -	return;
  12.333 +    return;
  12.334  
  12.335   error_out:
  12.336 -	puts("Could not write SMBIOS tables, error in hvmloader.c:"
  12.337 -	     "hvm_write_smbios_tables()\n");
  12.338 +    printf("Could not write SMBIOS tables, error in hvmloader.c:"
  12.339 +           "hvm_write_smbios_tables()\n");
  12.340  }
  12.341  
  12.342  
  12.343  static void
  12.344  smbios_entry_point_init(void *start,
  12.345 -			uint16_t max_structure_size,
  12.346 -			uint16_t structure_table_length,
  12.347 -			uint32_t structure_table_address,
  12.348 -			uint16_t number_of_structures)
  12.349 +                        uint16_t max_structure_size,
  12.350 +                        uint16_t structure_table_length,
  12.351 +                        uint32_t structure_table_address,
  12.352 +                        uint16_t number_of_structures)
  12.353  {
  12.354 -	uint8_t sum;
  12.355 -	int i;
  12.356 -	struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
  12.357 +    uint8_t sum;
  12.358 +    int i;
  12.359 +    struct smbios_entry_point *ep = (struct smbios_entry_point *)start;
  12.360  
  12.361 -	strncpy(ep->anchor_string, "_SM_", 4);
  12.362 -	ep->length = 0x1f;
  12.363 -	ep->smbios_major_version = 2;
  12.364 -	ep->smbios_minor_version = 4;
  12.365 -	ep->max_structure_size = max_structure_size;
  12.366 -	ep->entry_point_revision = 0;
  12.367 -	memset(ep->formatted_area, 0, 5);
  12.368 -	strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
  12.369 +    strncpy(ep->anchor_string, "_SM_", 4);
  12.370 +    ep->length = 0x1f;
  12.371 +    ep->smbios_major_version = 2;
  12.372 +    ep->smbios_minor_version = 4;
  12.373 +    ep->max_structure_size = max_structure_size;
  12.374 +    ep->entry_point_revision = 0;
  12.375 +    memset(ep->formatted_area, 0, 5);
  12.376 +    strncpy(ep->intermediate_anchor_string, "_DMI_", 5);
  12.377      
  12.378 -	ep->structure_table_length = structure_table_length;
  12.379 -	ep->structure_table_address = structure_table_address;
  12.380 -	ep->number_of_structures = number_of_structures;
  12.381 -	ep->smbios_bcd_revision = 0x24;
  12.382 +    ep->structure_table_length = structure_table_length;
  12.383 +    ep->structure_table_address = structure_table_address;
  12.384 +    ep->number_of_structures = number_of_structures;
  12.385 +    ep->smbios_bcd_revision = 0x24;
  12.386  
  12.387 -	ep->checksum = 0;
  12.388 -	ep->intermediate_checksum = 0;
  12.389 +    ep->checksum = 0;
  12.390 +    ep->intermediate_checksum = 0;
  12.391      
  12.392 -	sum = 0;
  12.393 -	for (i = 0; i < 0x10; ++i)
  12.394 -		sum += ((int8_t *)start)[i];
  12.395 -	ep->checksum = -sum;
  12.396 +    sum = 0;
  12.397 +    for ( i = 0; i < 0x10; i++ )
  12.398 +        sum += ((int8_t *)start)[i];
  12.399 +    ep->checksum = -sum;
  12.400  
  12.401 -	sum = 0;
  12.402 -	for (i = 0x10; i < ep->length; ++i)
  12.403 -		sum += ((int8_t *)start)[i];
  12.404 -	ep->intermediate_checksum = -sum;
  12.405 +    sum = 0;
  12.406 +    for ( i = 0x10; i < ep->length; i++ )
  12.407 +        sum += ((int8_t *)start)[i];
  12.408 +    ep->intermediate_checksum = -sum;
  12.409  }
  12.410  
  12.411  /* Type 0 -- BIOS Information */
  12.412  static void *
  12.413  smbios_type_0_init(void *start, const char *xen_version,
  12.414 -		   uint32_t xen_major_version, uint32_t xen_minor_version)
  12.415 +                   uint32_t xen_major_version, uint32_t xen_minor_version)
  12.416  {
  12.417 -	struct smbios_type_0 *p = (struct smbios_type_0 *)start;
  12.418 +    struct smbios_type_0 *p = (struct smbios_type_0 *)start;
  12.419      
  12.420 -	p->header.type = 0;
  12.421 -	p->header.length = sizeof(struct smbios_type_0);
  12.422 -	p->header.handle = 0;
  12.423 +    p->header.type = 0;
  12.424 +    p->header.length = sizeof(struct smbios_type_0);
  12.425 +    p->header.handle = 0;
  12.426      
  12.427 -	p->vendor_str = 1;
  12.428 -	p->version_str = 2;
  12.429 -	p->starting_address_segment = 0xe800;
  12.430 -	p->release_date_str = 0;
  12.431 -	p->rom_size = 0;
  12.432 +    p->vendor_str = 1;
  12.433 +    p->version_str = 2;
  12.434 +    p->starting_address_segment = 0xe800;
  12.435 +    p->release_date_str = 0;
  12.436 +    p->rom_size = 0;
  12.437      
  12.438 -	memset(p->characteristics, 0, 8);
  12.439 -	p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
  12.440 -	p->characteristics_extension_bytes[0] = 0;
  12.441 -	p->characteristics_extension_bytes[1] = 0;
  12.442 +    memset(p->characteristics, 0, 8);
  12.443 +    p->characteristics[7] = 0x08; /* BIOS characteristics not supported */
  12.444 +    p->characteristics_extension_bytes[0] = 0;
  12.445 +    p->characteristics_extension_bytes[1] = 0;
  12.446      
  12.447 -	p->major_release = (uint8_t) xen_major_version;
  12.448 -	p->minor_release = (uint8_t) xen_minor_version;
  12.449 -	p->embedded_controller_major = 0xff;
  12.450 -	p->embedded_controller_minor = 0xff;
  12.451 +    p->major_release = (uint8_t) xen_major_version;
  12.452 +    p->minor_release = (uint8_t) xen_minor_version;
  12.453 +    p->embedded_controller_major = 0xff;
  12.454 +    p->embedded_controller_minor = 0xff;
  12.455  
  12.456 -	start += sizeof(struct smbios_type_0);
  12.457 -	strcpy((char *)start, "Xen");
  12.458 -	start += strlen("Xen") + 1;
  12.459 -	strcpy((char *)start, xen_version);
  12.460 -	start += strlen(xen_version) + 1;
  12.461 +    start += sizeof(struct smbios_type_0);
  12.462 +    strcpy((char *)start, "Xen");
  12.463 +    start += strlen("Xen") + 1;
  12.464 +    strcpy((char *)start, xen_version);
  12.465 +    start += strlen(xen_version) + 1;
  12.466  
  12.467 -	*((uint8_t *)start) = 0;
  12.468 -	return start + 1;
  12.469 +    *((uint8_t *)start) = 0;
  12.470 +    return start + 1;
  12.471  }
  12.472  
  12.473  /* Type 1 -- System Information */
  12.474  static void *
  12.475  smbios_type_1_init(void *start, const char *xen_version, 
  12.476 -		   uint8_t uuid[16])
  12.477 +                   uint8_t uuid[16])
  12.478  {
  12.479 -	char uuid_str[37];
  12.480 -	struct smbios_type_1 *p = (struct smbios_type_1 *)start;
  12.481 -	p->header.type = 1;
  12.482 -	p->header.length = sizeof(struct smbios_type_1);
  12.483 -	p->header.handle = 0x100;
  12.484 +    char uuid_str[37];
  12.485 +    struct smbios_type_1 *p = (struct smbios_type_1 *)start;
  12.486 +    p->header.type = 1;
  12.487 +    p->header.length = sizeof(struct smbios_type_1);
  12.488 +    p->header.handle = 0x100;
  12.489  
  12.490 -	p->manufacturer_str = 1;
  12.491 -	p->product_name_str = 2;
  12.492 -	p->version_str = 3;
  12.493 -	p->serial_number_str = 4;
  12.494 +    p->manufacturer_str = 1;
  12.495 +    p->product_name_str = 2;
  12.496 +    p->version_str = 3;
  12.497 +    p->serial_number_str = 4;
  12.498      
  12.499 -	memcpy(p->uuid, uuid, 16);
  12.500 +    memcpy(p->uuid, uuid, 16);
  12.501  
  12.502 -	p->wake_up_type = 0x06; /* power switch */
  12.503 -	p->sku_str = 0;
  12.504 -	p->family_str = 0;
  12.505 +    p->wake_up_type = 0x06; /* power switch */
  12.506 +    p->sku_str = 0;
  12.507 +    p->family_str = 0;
  12.508  
  12.509 -	start += sizeof(struct smbios_type_1);
  12.510 +    start += sizeof(struct smbios_type_1);
  12.511      
  12.512 -	strcpy((char *)start, "Xen");
  12.513 -	start += strlen("Xen") + 1;
  12.514 -	strcpy((char *)start, "HVM domU");
  12.515 -	start += strlen("HVM domU") + 1;
  12.516 -	strcpy((char *)start, xen_version);
  12.517 -	start += strlen(xen_version) + 1;
  12.518 -	uuid_to_string(uuid_str, uuid);	
  12.519 -	strcpy((char *)start, uuid_str);
  12.520 -	start += strlen(uuid_str) + 1;
  12.521 -	*((uint8_t *)start) = 0;
  12.522 +    strcpy((char *)start, "Xen");
  12.523 +    start += strlen("Xen") + 1;
  12.524 +    strcpy((char *)start, "HVM domU");
  12.525 +    start += strlen("HVM domU") + 1;
  12.526 +    strcpy((char *)start, xen_version);
  12.527 +    start += strlen(xen_version) + 1;
  12.528 +    uuid_to_string(uuid_str, uuid); 
  12.529 +    strcpy((char *)start, uuid_str);
  12.530 +    start += strlen(uuid_str) + 1;
  12.531 +    *((uint8_t *)start) = 0;
  12.532      
  12.533 -	return start+1; 
  12.534 +    return start+1; 
  12.535  }
  12.536  
  12.537  /* Type 3 -- System Enclosure */
  12.538  static void *
  12.539  smbios_type_3_init(void *start)
  12.540  {
  12.541 -	struct smbios_type_3 *p = (struct smbios_type_3 *)start;
  12.542 +    struct smbios_type_3 *p = (struct smbios_type_3 *)start;
  12.543      
  12.544 -	p->header.type = 3;
  12.545 -	p->header.length = sizeof(struct smbios_type_3);
  12.546 -	p->header.handle = 0x300;
  12.547 +    p->header.type = 3;
  12.548 +    p->header.length = sizeof(struct smbios_type_3);
  12.549 +    p->header.handle = 0x300;
  12.550  
  12.551 -	p->manufacturer_str = 1;
  12.552 -	p->type = 0x01; /* other */
  12.553 -	p->version_str = 0;
  12.554 -	p->serial_number_str = 0;
  12.555 -	p->asset_tag_str = 0;
  12.556 -	p->boot_up_state = 0x03; /* safe */
  12.557 -	p->power_supply_state = 0x03; /* safe */
  12.558 -	p->thermal_state = 0x03; /* safe */
  12.559 -	p->security_status = 0x02; /* unknown */
  12.560 +    p->manufacturer_str = 1;
  12.561 +    p->type = 0x01; /* other */
  12.562 +    p->version_str = 0;
  12.563 +    p->serial_number_str = 0;
  12.564 +    p->asset_tag_str = 0;
  12.565 +    p->boot_up_state = 0x03; /* safe */
  12.566 +    p->power_supply_state = 0x03; /* safe */
  12.567 +    p->thermal_state = 0x03; /* safe */
  12.568 +    p->security_status = 0x02; /* unknown */
  12.569  
  12.570 -	start += sizeof(struct smbios_type_3);
  12.571 +    start += sizeof(struct smbios_type_3);
  12.572      
  12.573 -	strcpy((char *)start, "Xen");
  12.574 -	start += strlen("Xen") + 1;
  12.575 -	*((uint8_t *)start) = 0;
  12.576 -	return start+1;
  12.577 +    strcpy((char *)start, "Xen");
  12.578 +    start += strlen("Xen") + 1;
  12.579 +    *((uint8_t *)start) = 0;
  12.580 +    return start+1;
  12.581  }
  12.582  
  12.583  /* Type 4 -- Processor Information */
  12.584  static void *
  12.585  smbios_type_4_init(void *start, unsigned int cpu_number, char *cpu_manufacturer)
  12.586  {
  12.587 -	char buf[80]; 
  12.588 -	struct smbios_type_4 *p = (struct smbios_type_4 *)start;
  12.589 -	uint32_t eax, ebx, ecx, edx;
  12.590 +    char buf[80]; 
  12.591 +    struct smbios_type_4 *p = (struct smbios_type_4 *)start;
  12.592 +    uint32_t eax, ebx, ecx, edx;
  12.593  
  12.594 -	p->header.type = 4;
  12.595 -	p->header.length = sizeof(struct smbios_type_4);
  12.596 -	p->header.handle = 0x400 + cpu_number;
  12.597 +    p->header.type = 4;
  12.598 +    p->header.length = sizeof(struct smbios_type_4);
  12.599 +    p->header.handle = 0x400 + cpu_number;
  12.600  
  12.601 -	p->socket_designation_str = 1;
  12.602 -	p->processor_type = 0x03; /* CPU */
  12.603 -	p->processor_family = 0x01; /* other */
  12.604 -	p->manufacturer_str = 2;
  12.605 +    p->socket_designation_str = 1;
  12.606 +    p->processor_type = 0x03; /* CPU */
  12.607 +    p->processor_family = 0x01; /* other */
  12.608 +    p->manufacturer_str = 2;
  12.609  
  12.610 -	cpuid(1, &eax, &ebx, &ecx, &edx);
  12.611 +    cpuid(1, &eax, &ebx, &ecx, &edx);
  12.612  
  12.613 -	p->cpuid[0] = eax;
  12.614 -	p->cpuid[1] = edx;
  12.615 +    p->cpuid[0] = eax;
  12.616 +    p->cpuid[1] = edx;
  12.617  
  12.618 -	p->version_str = 0;
  12.619 -	p->voltage = 0;
  12.620 -	p->external_clock = 0;
  12.621 +    p->version_str = 0;
  12.622 +    p->voltage = 0;
  12.623 +    p->external_clock = 0;
  12.624  
  12.625 -	p->max_speed = 0; /* unknown */
  12.626 -	p->current_speed = 0; /* unknown */
  12.627 +    p->max_speed = 0; /* unknown */
  12.628 +    p->current_speed = 0; /* unknown */
  12.629  
  12.630 -	p->status = 0x41; /* socket populated, CPU enabled */
  12.631 -	p->upgrade = 0x01; /* other */
  12.632 +    p->status = 0x41; /* socket populated, CPU enabled */
  12.633 +    p->upgrade = 0x01; /* other */
  12.634  
  12.635 -	start += sizeof(struct smbios_type_4);
  12.636 +    start += sizeof(struct smbios_type_4);
  12.637  
  12.638 -	strncpy(buf, "CPU ", sizeof(buf));
  12.639 -	if ((sizeof(buf) - strlen("CPU ")) >= 3)
  12.640 -		itoa(buf + strlen("CPU "), cpu_number);
  12.641 +    strncpy(buf, "CPU ", sizeof(buf));
  12.642 +    if ( (sizeof(buf) - strlen("CPU ")) >= 3 )
  12.643 +        itoa(buf + strlen("CPU "), cpu_number);
  12.644  
  12.645 -	strcpy((char *)start, buf);
  12.646 -	start += strlen(buf) + 1;
  12.647 +    strcpy((char *)start, buf);
  12.648 +    start += strlen(buf) + 1;
  12.649  
  12.650 -	strcpy((char *)start, cpu_manufacturer);
  12.651 -	start += strlen(cpu_manufacturer) + 1;
  12.652 +    strcpy((char *)start, cpu_manufacturer);
  12.653 +    start += strlen(cpu_manufacturer) + 1;
  12.654  
  12.655 -	*((uint8_t *)start) = 0;
  12.656 -	return start+1;
  12.657 +    *((uint8_t *)start) = 0;
  12.658 +    return start+1;
  12.659  }
  12.660  
  12.661  /* Type 16 -- Physical Memory Array */
  12.662  static void *
  12.663  smbios_type_16_init(void *start, uint32_t memsize)
  12.664  {
  12.665 -	struct smbios_type_16 *p = (struct smbios_type_16*)start;
  12.666 +    struct smbios_type_16 *p = (struct smbios_type_16*)start;
  12.667  
  12.668 -	p->header.type = 16;
  12.669 -	p->header.handle = 0x1000;
  12.670 -	p->header.length = sizeof(struct smbios_type_16);
  12.671 +    p->header.type = 16;
  12.672 +    p->header.handle = 0x1000;
  12.673 +    p->header.length = sizeof(struct smbios_type_16);
  12.674      
  12.675 -	p->location = 0x01; /* other */
  12.676 -	p->use = 0x03; /* system memory */
  12.677 -	p->error_correction = 0x01; /* other */
  12.678 -	p->maximum_capacity = memsize * 1024;
  12.679 -	p->memory_error_information_handle = 0xfffe; /* none provided */
  12.680 -	p->number_of_memory_devices = 1;
  12.681 +    p->location = 0x01; /* other */
  12.682 +    p->use = 0x03; /* system memory */
  12.683 +    p->error_correction = 0x01; /* other */
  12.684 +    p->maximum_capacity = memsize * 1024;
  12.685 +    p->memory_error_information_handle = 0xfffe; /* none provided */
  12.686 +    p->number_of_memory_devices = 1;
  12.687  
  12.688 -	start += sizeof(struct smbios_type_16);
  12.689 -	*((uint16_t *)start) = 0;
  12.690 -	return start + 2;
  12.691 +    start += sizeof(struct smbios_type_16);
  12.692 +    *((uint16_t *)start) = 0;
  12.693 +    return start + 2;
  12.694  }
  12.695  
  12.696  /* Type 17 -- Memory Device */
  12.697  static void *
  12.698  smbios_type_17_init(void *start, uint32_t memory_size_mb)
  12.699  {
  12.700 -	struct smbios_type_17 *p = (struct smbios_type_17 *)start;
  12.701 +    struct smbios_type_17 *p = (struct smbios_type_17 *)start;
  12.702      
  12.703 -	p->header.type = 17;
  12.704 -	p->header.length = sizeof(struct smbios_type_17);
  12.705 -	p->header.handle = 0x1100;
  12.706 +    p->header.type = 17;
  12.707 +    p->header.length = sizeof(struct smbios_type_17);
  12.708 +    p->header.handle = 0x1100;
  12.709  
  12.710 -	p->physical_memory_array_handle = 0x1000;
  12.711 -	p->total_width = 64;
  12.712 -	p->data_width = 64;
  12.713 -	/* truncate memory_size_mb to 16 bits and clear most significant
  12.714 -	   bit [indicates size in MB] */
  12.715 -	p->size = (uint16_t) memory_size_mb & 0x7fff;
  12.716 -	p->form_factor = 0x09; /* DIMM */
  12.717 -	p->device_set = 0;
  12.718 -	p->device_locator_str = 1;
  12.719 -	p->bank_locator_str = 0;
  12.720 -	p->memory_type = 0x07; /* RAM */
  12.721 -	p->type_detail = 0;
  12.722 +    p->physical_memory_array_handle = 0x1000;
  12.723 +    p->total_width = 64;
  12.724 +    p->data_width = 64;
  12.725 +    /* truncate memory_size_mb to 16 bits and clear most significant
  12.726 +       bit [indicates size in MB] */
  12.727 +    p->size = (uint16_t) memory_size_mb & 0x7fff;
  12.728 +    p->form_factor = 0x09; /* DIMM */
  12.729 +    p->device_set = 0;
  12.730 +    p->device_locator_str = 1;
  12.731 +    p->bank_locator_str = 0;
  12.732 +    p->memory_type = 0x07; /* RAM */
  12.733 +    p->type_detail = 0;
  12.734  
  12.735 -	start += sizeof(struct smbios_type_17);
  12.736 -	strcpy((char *)start, "DIMM 1");
  12.737 -	start += strlen("DIMM 1") + 1;
  12.738 -	*((uint8_t *)start) = 0;
  12.739 +    start += sizeof(struct smbios_type_17);
  12.740 +    strcpy((char *)start, "DIMM 1");
  12.741 +    start += strlen("DIMM 1") + 1;
  12.742 +    *((uint8_t *)start) = 0;
  12.743  
  12.744 -	return start+1;
  12.745 +    return start+1;
  12.746  }
  12.747  
  12.748  /* Type 19 -- Memory Array Mapped Address */
  12.749  static void *
  12.750  smbios_type_19_init(void *start, uint32_t memory_size_mb)
  12.751  {
  12.752 -	struct smbios_type_19 *p = (struct smbios_type_19 *)start;
  12.753 +    struct smbios_type_19 *p = (struct smbios_type_19 *)start;
  12.754      
  12.755 -	p->header.type = 19;
  12.756 -	p->header.length = sizeof(struct smbios_type_19);
  12.757 -	p->header.handle = 0x1300;
  12.758 +    p->header.type = 19;
  12.759 +    p->header.length = sizeof(struct smbios_type_19);
  12.760 +    p->header.handle = 0x1300;
  12.761  
  12.762 -	p->starting_address = 0;
  12.763 -	p->ending_address = (memory_size_mb-1) * 1024;
  12.764 -	p->memory_array_handle = 0x1000;
  12.765 -	p->partition_width = 1;
  12.766 +    p->starting_address = 0;
  12.767 +    p->ending_address = (memory_size_mb-1) * 1024;
  12.768 +    p->memory_array_handle = 0x1000;
  12.769 +    p->partition_width = 1;
  12.770  
  12.771 -	start += sizeof(struct smbios_type_19);
  12.772 -	*((uint16_t *)start) = 0;
  12.773 -	return start + 2;
  12.774 +    start += sizeof(struct smbios_type_19);
  12.775 +    *((uint16_t *)start) = 0;
  12.776 +    return start + 2;
  12.777  }
  12.778  
  12.779  /* Type 20 -- Memory Device Mapped Address */
  12.780  static void *
  12.781  smbios_type_20_init(void *start, uint32_t memory_size_mb)
  12.782  {
  12.783 -	struct smbios_type_20 *p = (struct smbios_type_20 *)start;
  12.784 +    struct smbios_type_20 *p = (struct smbios_type_20 *)start;
  12.785  
  12.786 -	p->header.type = 20;
  12.787 -	p->header.length = sizeof(struct smbios_type_20);
  12.788 -	p->header.handle = 0x1400;
  12.789 +    p->header.type = 20;
  12.790 +    p->header.length = sizeof(struct smbios_type_20);
  12.791 +    p->header.handle = 0x1400;
  12.792  
  12.793 -	p->starting_address = 0;
  12.794 -	p->ending_address = (memory_size_mb-1)*1024;
  12.795 -	p->memory_device_handle = 0x1100;
  12.796 -	p->memory_array_mapped_address_handle = 0x1300;
  12.797 -	p->partition_row_position = 1;
  12.798 -	p->interleave_position = 0;
  12.799 -	p->interleaved_data_depth = 0;
  12.800 +    p->starting_address = 0;
  12.801 +    p->ending_address = (memory_size_mb-1)*1024;
  12.802 +    p->memory_device_handle = 0x1100;
  12.803 +    p->memory_array_mapped_address_handle = 0x1300;
  12.804 +    p->partition_row_position = 1;
  12.805 +    p->interleave_position = 0;
  12.806 +    p->interleaved_data_depth = 0;
  12.807  
  12.808 -	start += sizeof(struct smbios_type_20);
  12.809 +    start += sizeof(struct smbios_type_20);
  12.810  
  12.811 -	*((uint16_t *)start) = 0;
  12.812 -	return start+2;
  12.813 +    *((uint16_t *)start) = 0;
  12.814 +    return start+2;
  12.815  }
  12.816  
  12.817  /* Type 32 -- System Boot Information */
  12.818  static void *
  12.819  smbios_type_32_init(void *start)
  12.820  {
  12.821 -	struct smbios_type_32 *p = (struct smbios_type_32 *)start;
  12.822 +    struct smbios_type_32 *p = (struct smbios_type_32 *)start;
  12.823  
  12.824 -	p->header.type = 32;
  12.825 -	p->header.length = sizeof(struct smbios_type_32);
  12.826 -	p->header.handle = 0x2000;
  12.827 -	memset(p->reserved, 0, 6);
  12.828 -	p->boot_status = 0; /* no errors detected */
  12.829 +    p->header.type = 32;
  12.830 +    p->header.length = sizeof(struct smbios_type_32);
  12.831 +    p->header.handle = 0x2000;
  12.832 +    memset(p->reserved, 0, 6);
  12.833 +    p->boot_status = 0; /* no errors detected */
  12.834      
  12.835 -	start += sizeof(struct smbios_type_32);
  12.836 -	*((uint16_t *)start) = 0;
  12.837 -	return start+2;
  12.838 +    start += sizeof(struct smbios_type_32);
  12.839 +    *((uint16_t *)start) = 0;
  12.840 +    return start+2;
  12.841  }
  12.842  
  12.843  /* Type 127 -- End of Table */
  12.844  static void *
  12.845  smbios_type_127_init(void *start)
  12.846  {
  12.847 -	struct smbios_type_127 *p = (struct smbios_type_127 *)start;
  12.848 +    struct smbios_type_127 *p = (struct smbios_type_127 *)start;
  12.849 +
  12.850 +    p->header.type = 127;
  12.851 +    p->header.length = sizeof(struct smbios_type_127);
  12.852 +    p->header.handle = 0x7f00;
  12.853  
  12.854 -	p->header.type = 127;
  12.855 -	p->header.length = sizeof(struct smbios_type_127);
  12.856 -	p->header.handle = 0x7f00;
  12.857 +    start += sizeof(struct smbios_type_127);
  12.858 +    *((uint16_t *)start) = 0;
  12.859 +    return start + 2;
  12.860 +}
  12.861  
  12.862 -	start += sizeof(struct smbios_type_127);
  12.863 -	*((uint16_t *)start) = 0;
  12.864 -	return start + 2;
  12.865 -}
  12.866 +/*
  12.867 + * Local variables:
  12.868 + * mode: C
  12.869 + * c-set-style: "BSD"
  12.870 + * c-basic-offset: 4
  12.871 + * tab-width: 4
  12.872 + * indent-tabs-mode: nil
  12.873 + * End:
  12.874 + */
    13.1 --- a/tools/firmware/hvmloader/util.c	Thu Nov 23 17:46:52 2006 +0000
    13.2 +++ b/tools/firmware/hvmloader/util.c	Thu Nov 23 17:54:06 2006 +0000
    13.3 @@ -20,175 +20,193 @@
    13.4  
    13.5  #include "acpi/acpi2_0.h"  /* for ACPI_PHYSICAL_ADDRESS */
    13.6  #include "util.h"
    13.7 +#include "config.h"
    13.8  #include <stdint.h>
    13.9 +#include <xenctrl.h>
   13.10 +
   13.11 +void outb(uint16_t addr, uint8_t val)
   13.12 +{
   13.13 +    __asm__ __volatile__ ( "outb %%al, %%dx" :: "d"(addr), "a"(val) );
   13.14 +}
   13.15  
   13.16  void outw(uint16_t addr, uint16_t val)
   13.17  {
   13.18 -	__asm__ __volatile__ ("outw %%ax, %%dx" :: "d"(addr), "a"(val));
   13.19 +    __asm__ __volatile__ ( "outw %%ax, %%dx" :: "d"(addr), "a"(val) );
   13.20  }
   13.21  
   13.22 -void outb(uint16_t addr, uint8_t val)
   13.23 +void outl(uint16_t addr, uint32_t val)
   13.24  {
   13.25 -	__asm__ __volatile__ ("outb %%al, %%dx" :: "d"(addr), "a"(val));
   13.26 +    __asm__ __volatile__ ( "outl %%eax, %%dx" :: "d"(addr), "a"(val) );
   13.27  }
   13.28  
   13.29  uint8_t inb(uint16_t addr)
   13.30  {
   13.31 -	uint8_t val;
   13.32 -	__asm__ __volatile__ ("inb %w1,%0" : "=a" (val) : "Nd" (addr));
   13.33 -	return val;
   13.34 +    uint8_t val;
   13.35 +    __asm__ __volatile__ ( "inb %%dx,%%al" : "=a" (val) : "d" (addr) );
   13.36 +    return val;
   13.37 +}
   13.38 +
   13.39 +uint16_t inw(uint16_t addr)
   13.40 +{
   13.41 +    uint16_t val;
   13.42 +    __asm__ __volatile__ ( "inw %%dx,%%ax" : "=a" (val) : "d" (addr) );
   13.43 +    return val;
   13.44 +}
   13.45 +
   13.46 +uint32_t inl(uint16_t addr)
   13.47 +{
   13.48 +    uint32_t val;
   13.49 +    __asm__ __volatile__ ( "inl %%dx,%%eax" : "=a" (val) : "d" (addr) );
   13.50 +    return val;
   13.51  }
   13.52  
   13.53  char *itoa(char *a, unsigned int i)
   13.54  {
   13.55 -	unsigned int _i = i, x = 0;
   13.56 +    unsigned int _i = i, x = 0;
   13.57  
   13.58 -	do {
   13.59 -		x++;
   13.60 -		_i /= 10;
   13.61 -	} while (_i != 0);
   13.62 +    do {
   13.63 +        x++;
   13.64 +        _i /= 10;
   13.65 +    } while ( _i != 0 );
   13.66  
   13.67 -	a += x;
   13.68 -	*a-- = '\0';
   13.69 +    a += x;
   13.70 +    *a-- = '\0';
   13.71  
   13.72 -	do {
   13.73 -		*a-- = (i % 10) + '0';
   13.74 -		i /= 10;
   13.75 -	} while (i != 0);
   13.76 +    do {
   13.77 +        *a-- = (i % 10) + '0';
   13.78 +        i /= 10;
   13.79 +    } while ( i != 0 );
   13.80  
   13.81 -	return a + 1;
   13.82 +    return a + 1;
   13.83  }
   13.84  
   13.85  int strcmp(const char *cs, const char *ct)
   13.86  {
   13.87 -	signed char res;
   13.88 +    signed char res;
   13.89  
   13.90 -	while (((res = *cs - *ct++) == 0) && (*cs++ != '\0'))
   13.91 -		continue;
   13.92 +    while ( ((res = *cs - *ct++) == 0) && (*cs++ != '\0') )
   13.93 +        continue;
   13.94  
   13.95 -	return res;
   13.96 +    return res;
   13.97  }
   13.98  
   13.99  void *memcpy(void *dest, const void *src, unsigned n)
  13.100  {
  13.101 -	int t0, t1, t2;
  13.102 +    int t0, t1, t2;
  13.103  
  13.104 -	__asm__ __volatile__(
  13.105 -		"cld\n"
  13.106 -		"rep; movsl\n"
  13.107 -		"testb $2,%b4\n"
  13.108 -		"je 1f\n"
  13.109 -		"movsw\n"
  13.110 -		"1: testb $1,%b4\n"
  13.111 -		"je 2f\n"
  13.112 -		"movsb\n"
  13.113 -		"2:"
  13.114 -		: "=&c" (t0), "=&D" (t1), "=&S" (t2)
  13.115 -		: "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
  13.116 -		: "memory"
  13.117 -	);
  13.118 -	return dest;
  13.119 +    __asm__ __volatile__ (
  13.120 +        "cld\n"
  13.121 +        "rep; movsl\n"
  13.122 +        "testb $2,%b4\n"
  13.123 +        "je 1f\n"
  13.124 +        "movsw\n"
  13.125 +        "1: testb $1,%b4\n"
  13.126 +        "je 2f\n"
  13.127 +        "movsb\n"
  13.128 +        "2:"
  13.129 +        : "=&c" (t0), "=&D" (t1), "=&S" (t2)
  13.130 +        : "0" (n/4), "q" (n), "1" ((long) dest), "2" ((long) src)
  13.131 +        : "memory" );
  13.132 +    return dest;
  13.133  }
  13.134  
  13.135  void *memmove(void *dest, const void *src, unsigned n)
  13.136  {
  13.137 -	if ((long)dest > (long)src) {
  13.138 -		n--;
  13.139 -		while (n > 0) {
  13.140 -			((char *)dest)[n] = ((char *)src)[n];
  13.141 -			n--;
  13.142 -		}
  13.143 -	} else {
  13.144 -		memcpy(dest, src, n);
  13.145 -	}
  13.146 -	return dest;
  13.147 -}
  13.148 -
  13.149 -
  13.150 -
  13.151 -
  13.152 -void puts(const char *s)
  13.153 -{
  13.154 -	while (*s)
  13.155 -		outb(0xE9, *s++);
  13.156 +    if ( (long)dest > (long)src )
  13.157 +    {
  13.158 +        n--;
  13.159 +        while ( n > 0 )
  13.160 +        {
  13.161 +            ((char *)dest)[n] = ((char *)src)[n];
  13.162 +            n--;
  13.163 +        }
  13.164 +    }
  13.165 +    else
  13.166 +    {
  13.167 +        memcpy(dest, src, n);
  13.168 +    }
  13.169 +    return dest;
  13.170  }
  13.171  
  13.172  char *
  13.173  strcpy(char *dest, const char *src)
  13.174  {
  13.175 -	char *p = dest;
  13.176 -	while (*src)
  13.177 -		*p++ = *src++;
  13.178 -	*p = 0;
  13.179 -	return dest;
  13.180 +    char *p = dest;
  13.181 +    while ( *src )
  13.182 +        *p++ = *src++;
  13.183 +    *p = 0;
  13.184 +    return dest;
  13.185  }
  13.186  
  13.187  char *
  13.188  strncpy(char *dest, const char *src, unsigned n)
  13.189  {
  13.190 -	int i = 0;
  13.191 -	char *p = dest;
  13.192 +    int i = 0;
  13.193 +    char *p = dest;
  13.194  
  13.195 -	/* write non-NUL characters from src into dest until we run
  13.196 -	   out of room in dest or encounter a NUL in src */
  13.197 -	while (i < n && *src) {
  13.198 -		*p++ = *src++;
  13.199 -		++i;
  13.200 -	}
  13.201 +    /* write non-NUL characters from src into dest until we run
  13.202 +       out of room in dest or encounter a NUL in src */
  13.203 +    while ( (i < n) && *src )
  13.204 +    {
  13.205 +        *p++ = *src++;
  13.206 +        i++;
  13.207 +    }
  13.208  
  13.209 -	/* pad remaining bytes of dest with NUL bytes */
  13.210 -	while (i < n) {
  13.211 -		*p++ = 0;
  13.212 -		++i;
  13.213 -	}
  13.214 +    /* pad remaining bytes of dest with NUL bytes */
  13.215 +    while ( i < n )
  13.216 +    {
  13.217 +        *p++ = 0;
  13.218 +        i++;
  13.219 +    }
  13.220  
  13.221 -	return dest;
  13.222 +    return dest;
  13.223  }
  13.224  
  13.225  unsigned
  13.226  strlen(const char *s)
  13.227  {
  13.228 -	int i = 0;
  13.229 -	while (*s++)
  13.230 -		++i;
  13.231 -	return i;
  13.232 +    int i = 0;
  13.233 +    while ( *s++ )
  13.234 +        i++;
  13.235 +    return i;
  13.236  }
  13.237  
  13.238  void *
  13.239  memset(void *s, int c, unsigned n)
  13.240  {
  13.241 -	uint8_t b = (uint8_t) c;
  13.242 -	uint8_t *p = (uint8_t *)s;
  13.243 -	int i;
  13.244 -	for (i = 0; i < n; ++i)
  13.245 -		*p++ = b;
  13.246 -	return s;
  13.247 +    uint8_t b = (uint8_t) c;
  13.248 +    uint8_t *p = (uint8_t *)s;
  13.249 +    int i;
  13.250 +    for ( i = 0; i < n; i++ )
  13.251 +        *p++ = b;
  13.252 +    return s;
  13.253  }
  13.254  
  13.255  int
  13.256  memcmp(const void *s1, const void *s2, unsigned n)
  13.257  {
  13.258 -	unsigned i;
  13.259 -	uint8_t *p1 = (uint8_t *) s1;
  13.260 -	uint8_t *p2 = (uint8_t *) s2;
  13.261 +    unsigned i;
  13.262 +    uint8_t *p1 = (uint8_t *) s1;
  13.263 +    uint8_t *p2 = (uint8_t *) s2;
  13.264  
  13.265 -	for (i = 0; i < n; ++i) {
  13.266 -		if (p1[i] < p2[i])
  13.267 -			return -1;
  13.268 -		else if (p1[i] > p2[i])
  13.269 -			return 1;
  13.270 -	}
  13.271 +    for ( i = 0; i < n; i++ )
  13.272 +    {
  13.273 +        if ( p1[i] < p2[i] )
  13.274 +            return -1;
  13.275 +        else if ( p1[i] > p2[i] )
  13.276 +            return 1;
  13.277 +    }
  13.278  
  13.279 -	return 0;
  13.280 +    return 0;
  13.281  }
  13.282  
  13.283  void
  13.284  cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx, uint32_t *ecx, uint32_t *edx)
  13.285  {
  13.286 -	__asm__ __volatile__(
  13.287 -		"cpuid"
  13.288 -		: "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
  13.289 -		: "0" (idx) );
  13.290 +    __asm__ __volatile__ (
  13.291 +        "cpuid"
  13.292 +        : "=a" (*eax), "=b" (*ebx), "=c" (*ecx), "=d" (*edx)
  13.293 +        : "0" (idx) );
  13.294  }
  13.295  
  13.296  /* Write a two-character hex representation of 'byte' to digits[].
  13.297 @@ -196,18 +214,18 @@ cpuid(uint32_t idx, uint32_t *eax, uint3
  13.298  void
  13.299  byte_to_hex(char *digits, uint8_t byte)
  13.300  {
  13.301 -	uint8_t nybbel = byte >> 4;
  13.302 +    uint8_t nybbel = byte >> 4;
  13.303  
  13.304 -	if (nybbel > 9)
  13.305 -		digits[0] = 'a' + nybbel-10;
  13.306 -	else
  13.307 -		digits[0] = '0' + nybbel;
  13.308 +    if ( nybbel > 9 )
  13.309 +        digits[0] = 'a' + nybbel-10;
  13.310 +    else
  13.311 +        digits[0] = '0' + nybbel;
  13.312  
  13.313 -	nybbel = byte & 0x0f;
  13.314 -	if (nybbel > 9)
  13.315 -		digits[1] = 'a' + nybbel-10;
  13.316 -	else
  13.317 -		digits[1] = '0' + nybbel;
  13.318 +    nybbel = byte & 0x0f;
  13.319 +    if ( nybbel > 9 )
  13.320 +        digits[1] = 'a' + nybbel-10;
  13.321 +    else
  13.322 +        digits[1] = '0' + nybbel;
  13.323  }
  13.324  
  13.325  /* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
  13.326 @@ -217,34 +235,39 @@ byte_to_hex(char *digits, uint8_t byte)
  13.327  void
  13.328  uuid_to_string(char *dest, uint8_t *uuid)
  13.329  {
  13.330 -	int i = 0;
  13.331 -	char *p = dest;
  13.332 +    int i = 0;
  13.333 +    char *p = dest;
  13.334  
  13.335 -	for (i = 0; i < 4; ++i) {
  13.336 -		byte_to_hex(p, uuid[i]);
  13.337 -		p += 2;
  13.338 -	}
  13.339 -	*p++ = '-';
  13.340 -	for (i = 4; i < 6; ++i) {
  13.341 -		byte_to_hex(p, uuid[i]);
  13.342 -		p += 2;
  13.343 -	}
  13.344 -	*p++ = '-';
  13.345 -	for (i = 6; i < 8; ++i) {
  13.346 -		byte_to_hex(p, uuid[i]);
  13.347 -		p += 2;
  13.348 -	}
  13.349 -	*p++ = '-';
  13.350 -	for (i = 8; i < 10; ++i) {
  13.351 -		byte_to_hex(p, uuid[i]);
  13.352 -		p += 2;
  13.353 -	}
  13.354 -	*p++ = '-';
  13.355 -	for (i = 10; i < 16; ++i) {
  13.356 -		byte_to_hex(p, uuid[i]);
  13.357 -		p += 2;
  13.358 -	}
  13.359 -	*p = 0;
  13.360 +    for ( i = 0; i < 4; i++ )
  13.361 +    {
  13.362 +        byte_to_hex(p, uuid[i]);
  13.363 +        p += 2;
  13.364 +    }
  13.365 +    *p++ = '-';
  13.366 +    for ( i = 4; i < 6; i++ )
  13.367 +    {
  13.368 +        byte_to_hex(p, uuid[i]);
  13.369 +        p += 2;
  13.370 +    }
  13.371 +    *p++ = '-';
  13.372 +    for ( i = 6; i < 8; i++ )
  13.373 +    {
  13.374 +        byte_to_hex(p, uuid[i]);
  13.375 +        p += 2;
  13.376 +    }
  13.377 +    *p++ = '-';
  13.378 +    for ( i = 8; i < 10; i++ )
  13.379 +    {
  13.380 +        byte_to_hex(p, uuid[i]);
  13.381 +        p += 2;
  13.382 +    }
  13.383 +    *p++ = '-';
  13.384 +    for ( i = 10; i < 16; i++ )
  13.385 +    {
  13.386 +        byte_to_hex(p, uuid[i]);
  13.387 +        p += 2;
  13.388 +    }
  13.389 +    *p = '\0';
  13.390  }
  13.391  
  13.392  #include <xen/hvm/e820.h>
  13.393 @@ -252,31 +275,222 @@ uuid_to_string(char *dest, uint8_t *uuid
  13.394  #define E820_MAP    ((struct e820entry *)(E820_MAP_PAGE + E820_MAP_OFFSET))
  13.395  uint64_t e820_malloc(uint64_t size, uint32_t type, uint64_t mask)
  13.396  {
  13.397 -	uint64_t addr = 0;
  13.398 -	int c = *E820_MAP_NR - 1;
  13.399 -	struct e820entry *e820entry = (struct e820entry *)E820_MAP;
  13.400 +    uint64_t addr = 0;
  13.401 +    int c = *E820_MAP_NR - 1;
  13.402 +    struct e820entry *e820entry = (struct e820entry *)E820_MAP;
  13.403 +
  13.404 +    while ( c >= 0 )
  13.405 +    {
  13.406 +        if ( (e820entry[c].type  == E820_RAM) &&
  13.407 +             ((e820entry[c].addr & (~mask)) == 0) &&
  13.408 +             (e820entry[c].size >= size) )
  13.409 +        {
  13.410 +            addr = e820entry[c].addr;
  13.411 +            if ( e820entry[c].size != size )
  13.412 +            {
  13.413 +                (*E820_MAP_NR)++;
  13.414 +                memmove(&e820entry[c+1],
  13.415 +                        &e820entry[c],
  13.416 +                        (*E820_MAP_NR - c) *
  13.417 +                        sizeof(struct e820entry));
  13.418 +                e820entry[c].size -= size;
  13.419 +                addr += e820entry[c].size;
  13.420 +                c++;
  13.421 +            }
  13.422 +            e820entry[c].addr = addr;
  13.423 +            e820entry[c].size = size;
  13.424 +            e820entry[c].type = type;
  13.425 +            break;
  13.426 +        }
  13.427 +        c--;
  13.428 +    }
  13.429 +    return addr;
  13.430 +}
  13.431 +
  13.432 +uint32_t ioapic_read(uint32_t reg)
  13.433 +{
  13.434 +    uint32_t *ioregsel = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00);
  13.435 +    uint32_t *iowin    = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x10);
  13.436 +
  13.437 +    *ioregsel = reg;
  13.438 +    mb();
  13.439 +    return *iowin;
  13.440 +}
  13.441 +
  13.442 +void ioapic_write(uint32_t reg, uint32_t val)
  13.443 +{
  13.444 +    uint32_t *ioregsel = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x00);
  13.445 +    uint32_t *iowin    = (uint32_t *)(IOAPIC_BASE_ADDRESS + 0x10);
  13.446 +
  13.447 +    *ioregsel = reg;
  13.448 +    wmb();
  13.449 +    *iowin = val;
  13.450 +}
  13.451 +
  13.452 +#define PCI_CONF1_ADDRESS(bus, devfn, reg) \
  13.453 +    (0x80000000 | (bus << 16) | (devfn << 8) | (reg & ~3))
  13.454 +
  13.455 +uint32_t pci_read(uint32_t devfn, uint32_t reg, uint32_t len)
  13.456 +{
  13.457 +    outl(0xcf8, PCI_CONF1_ADDRESS(0, devfn, reg));
  13.458 +
  13.459 +    switch ( len )
  13.460 +    {
  13.461 +    case 1: return inb(0xcfc + (reg & 3));
  13.462 +    case 2: return inw(0xcfc + (reg & 2));
  13.463 +    }
  13.464 +
  13.465 +    return inl(0xcfc);
  13.466 +}
  13.467 +
  13.468 +void pci_write(uint32_t devfn, uint32_t reg, uint32_t len, uint32_t val)
  13.469 +{
  13.470 +    outl(0xcf8, PCI_CONF1_ADDRESS(0, devfn, reg));
  13.471 +
  13.472 +    switch ( len )
  13.473 +    {
  13.474 +    case 1: outb(0xcfc + (reg & 3), val); break;
  13.475 +    case 2: outw(0xcfc + (reg & 2), val); break;
  13.476 +    case 4: outl(0xcfc,             val); break;
  13.477 +    }
  13.478 +}
  13.479 +
  13.480 +static char *printnum(char *p, unsigned long num, int base)
  13.481 +{
  13.482 +    unsigned long n;
  13.483 +
  13.484 +    if ( (n = num/base) > 0 )
  13.485 +        p = printnum(p, n, base);
  13.486 +    *p++ = "0123456789abcdef"[(int)(num % base)];
  13.487 +    *p = '\0';
  13.488 +    return p;
  13.489 +}
  13.490 +
  13.491 +static void _doprint(void (*put)(char), char const *fmt, va_list ap)
  13.492 +{
  13.493 +    register char *str, c;
  13.494 +    int lflag, zflag, nflag;
  13.495 +    char buffer[17];
  13.496 +    unsigned value;
  13.497 +    int i, slen, pad;
  13.498 +
  13.499 +    for ( ; *fmt != '\0'; fmt++ )
  13.500 +    {
  13.501 +        if ( *fmt != '%' )
  13.502 +        {
  13.503 +            put(*fmt);
  13.504 +            continue;
  13.505 +        }
  13.506  
  13.507 -	while (c >= 0) {
  13.508 -		if (e820entry[c].type  == E820_RAM     &&
  13.509 -		    (e820entry[c].addr & (~mask)) == 0 &&
  13.510 -		    e820entry[c].size >= size) {
  13.511 -			addr = e820entry[c].addr;
  13.512 -			if (e820entry[c].size != size) {
  13.513 -				(*E820_MAP_NR)++;
  13.514 -				memmove(&e820entry[c+1],
  13.515 -				        &e820entry[c],
  13.516 -				        (*E820_MAP_NR - c) *
  13.517 -				            sizeof(struct e820entry));
  13.518 -				e820entry[c].size -= size;
  13.519 -				addr += e820entry[c].size;
  13.520 -				c++;
  13.521 -			}
  13.522 -			e820entry[c].addr = addr;
  13.523 -			e820entry[c].size = size;
  13.524 -			e820entry[c].type = type;
  13.525 -			break;
  13.526 -		}
  13.527 -		c--;
  13.528 -	}
  13.529 -        return addr;
  13.530 +        pad = zflag = nflag = lflag = 0;
  13.531 +        c = *++fmt;
  13.532 +        if ( (c == '-') || isdigit(c) )
  13.533 +        {
  13.534 +            if ( c == '-' )
  13.535 +            {
  13.536 +                nflag = 1;
  13.537 +                c = *++fmt;
  13.538 +            }
  13.539 +            zflag = c == '0';
  13.540 +            for ( pad = 0; isdigit(c); c = *++fmt )
  13.541 +                pad = (pad * 10) + c - '0';
  13.542 +        }
  13.543 +        if ( c == 'l' ) /* long extension */
  13.544 +        {
  13.545 +            lflag = 1;
  13.546 +            c = *++fmt;
  13.547 +        }
  13.548 +        if ( (c == 'd') || (c == 'u') || (c == 'o') || (c == 'x') )
  13.549 +        {
  13.550 +            if ( lflag )
  13.551 +                value = va_arg(ap, unsigned);
  13.552 +            else
  13.553 +                value = (unsigned) va_arg(ap, unsigned int);
  13.554 +            str = buffer;
  13.555 +            printnum(str, value,
  13.556 +                     c == 'o' ? 8 : (c == 'x' ? 16 : 10));
  13.557 +            goto printn;
  13.558 +        }
  13.559 +        else if ( (c == 'O') || (c == 'D') || (c == 'X') )
  13.560 +        {
  13.561 +            value = va_arg(ap, unsigned);
  13.562 +            str = buffer;
  13.563 +            printnum(str, value,
  13.564 +                     c == 'O' ? 8 : (c == 'X' ? 16 : 10));
  13.565 +        printn:
  13.566 +            slen = strlen(str);
  13.567 +            for ( i = pad - slen; i > 0; i-- )
  13.568 +                put(zflag ? '0' : ' ');
  13.569 +            while ( *str )
  13.570 +                put(*str++);
  13.571 +        }
  13.572 +        else if ( c == 's' )
  13.573 +        {
  13.574 +            str = va_arg(ap, char *);
  13.575 +            slen = strlen(str);
  13.576 +            if ( nflag == 0 )
  13.577 +                for ( i = pad - slen; i > 0; i-- )
  13.578 +                    put(' ');
  13.579 +            while ( *str )
  13.580 +                put(*str++);
  13.581 +            if ( nflag )
  13.582 +                for ( i = pad - slen; i > 0; i-- )
  13.583 +                    put(' ');
  13.584 +        }
  13.585 +        else if ( c == 'c' )
  13.586 +        {
  13.587 +            put(va_arg(ap, int));
  13.588 +        }
  13.589 +        else
  13.590 +        {
  13.591 +            put(*fmt);
  13.592 +        }
  13.593 +    }
  13.594  }
  13.595 +
  13.596 +static void putchar(char c)
  13.597 +{
  13.598 +    outb(0xe9, c);
  13.599 +}
  13.600 +
  13.601 +int printf(const char *fmt, ...)
  13.602 +{
  13.603 +    va_list ap;
  13.604 +
  13.605 +    va_start(ap, fmt);
  13.606 +    _doprint(putchar, fmt, ap);
  13.607 +    va_end(ap);
  13.608 +
  13.609 +    return 0;
  13.610 +}
  13.611 +
  13.612 +int vprintf(const char *fmt, va_list ap)
  13.613 +{
  13.614 +    _doprint(putchar, fmt, ap);
  13.615 +    return 0;
  13.616 +}
  13.617 +
  13.618 +void __assert_failed(char *assertion, char *file, int line)
  13.619 +{
  13.620 +    printf("HVMLoader assertion '%s' failed at %s:%d\n",
  13.621 +           assertion, file, line);
  13.622 +    for ( ; ; )
  13.623 +        __asm__ __volatile__ ( "ud2" );
  13.624 +}
  13.625 +
  13.626 +void __bug(char *file, int line)
  13.627 +{
  13.628 +    printf("HVMLoader bug at %s:%d\n", file, line);
  13.629 +    for ( ; ; )
  13.630 +        __asm__ __volatile__ ( "ud2" );
  13.631 +}
  13.632 +
  13.633 +/*
  13.634 + * Local variables:
  13.635 + * mode: C
  13.636 + * c-set-style: "BSD"
  13.637 + * c-basic-offset: 4
  13.638 + * tab-width: 4
  13.639 + * indent-tabs-mode: nil
  13.640 + * End:
  13.641 + */
    14.1 --- a/tools/firmware/hvmloader/util.h	Thu Nov 23 17:46:52 2006 +0000
    14.2 +++ b/tools/firmware/hvmloader/util.h	Thu Nov 23 17:54:06 2006 +0000
    14.3 @@ -1,12 +1,34 @@
    14.4  #ifndef __HVMLOADER_UTIL_H__
    14.5  #define __HVMLOADER_UTIL_H__
    14.6  
    14.7 +#include <stdarg.h>
    14.8 +
    14.9 +extern void __assert_failed(char *assertion, char *file, int line)
   14.10 +    __attribute__((noreturn));
   14.11 +#define ASSERT(p) \
   14.12 +    do { if (!(p)) __assert_failed(#p, __FILE__, __LINE__); } while (0)
   14.13 +extern void __bug(char *file, int line) __attribute__((noreturn));
   14.14 +#define BUG() __bug()
   14.15 +
   14.16  /* I/O output */
   14.17 +void outb(uint16_t addr, uint8_t  val);
   14.18  void outw(uint16_t addr, uint16_t val);
   14.19 -void outb(uint16_t addr, uint8_t val);
   14.20 +void outl(uint16_t addr, uint32_t val);
   14.21  
   14.22  /* I/O input */
   14.23 -uint8_t inb(uint16_t addr);
   14.24 +uint8_t  inb(uint16_t addr);
   14.25 +uint16_t inw(uint16_t addr);
   14.26 +uint32_t inl(uint16_t addr);
   14.27 +
   14.28 +/* PCI access */
   14.29 +uint32_t pci_read(uint32_t devfn, uint32_t reg, uint32_t len);
   14.30 +#define pci_readb(devfn, reg) ((uint8_t) pci_read(devfn, reg, 1))
   14.31 +#define pci_readw(devfn, reg) ((uint16_t)pci_read(devfn, reg, 2))
   14.32 +#define pci_readl(devfn, reg) ((uint32_t)pci_read(devfn, reg, 4))
   14.33 +void pci_write(uint32_t devfn, uint32_t reg, uint32_t len, uint32_t val);
   14.34 +#define pci_writeb(devfn, reg, val) (pci_write(devfn, reg, 1, (uint8_t) val))
   14.35 +#define pci_writew(devfn, reg, val) (pci_write(devfn, reg, 2, (uint16_t)val))
   14.36 +#define pci_writel(devfn, reg, val) (pci_write(devfn, reg, 4, (uint32_t)val))
   14.37  
   14.38  /* Do cpuid instruction, with operation 'idx' */
   14.39  void cpuid(uint32_t idx, uint32_t *eax, uint32_t *ebx,
   14.40 @@ -31,15 +53,16 @@ char *itoa(char *a, unsigned int i);
   14.41  void byte_to_hex(char *digits, uint8_t byte);
   14.42  
   14.43  /* Convert an array of 16 unsigned bytes to a DCE/OSF formatted UUID
   14.44 -   string.
   14.45 -
   14.46 -   Pre-condition: sizeof(dest) >= 37 */
   14.47 +   string. Pre-condition: sizeof(dest) >= 37 */
   14.48  void uuid_to_string(char *dest, uint8_t *uuid);
   14.49  
   14.50  /* Debug output */
   14.51 -void puts(const char *s);
   14.52 +int printf(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
   14.53 +int vprintf(const char *fmt, va_list ap);
   14.54  
   14.55  /* Allocate region of specified type in the e820 table. */
   14.56  uint64_t e820_malloc(uint64_t size, uint32_t type, uint64_t mask);
   14.57  
   14.58 +#define isdigit(c) ((c) >= '0' && (c) <= '9')
   14.59 +
   14.60  #endif /* __HVMLOADER_UTIL_H__ */
    15.1 --- a/tools/firmware/rombios/rombios.c	Thu Nov 23 17:46:52 2006 +0000
    15.2 +++ b/tools/firmware/rombios/rombios.c	Thu Nov 23 17:54:06 2006 +0000
    15.3 @@ -9104,78 +9104,78 @@ pci_routing_table_structure:
    15.4    db 0 ;; pci bus number
    15.5    db 0x08 ;; pci device number (bit 7-3)
    15.6    db 0x61 ;; link value INTA#: pointer into PCI2ISA config space
    15.7 -  dw 0xdef8 ;; IRQ bitmap INTA# 
    15.8 +  dw 0x0c60 ;; IRQ bitmap INTA# 
    15.9    db 0x62 ;; link value INTB#
   15.10 -  dw 0xdef8 ;; IRQ bitmap INTB# 
   15.11 +  dw 0x0c60 ;; IRQ bitmap INTB# 
   15.12    db 0x63 ;; link value INTC#
   15.13 -  dw 0xdef8 ;; IRQ bitmap INTC# 
   15.14 +  dw 0x0c60 ;; IRQ bitmap INTC# 
   15.15    db 0x60 ;; link value INTD#
   15.16 -  dw 0xdef8 ;; IRQ bitmap INTD#
   15.17 +  dw 0x0c60 ;; IRQ bitmap INTD#
   15.18    db 0 ;; physical slot (0 = embedded)
   15.19    db 0 ;; reserved
   15.20    ;; second slot entry: 1st PCI slot
   15.21    db 0 ;; pci bus number
   15.22    db 0x10 ;; pci device number (bit 7-3)
   15.23    db 0x62 ;; link value INTA#
   15.24 -  dw 0xdef8 ;; IRQ bitmap INTA# 
   15.25 +  dw 0x0c60 ;; IRQ bitmap INTA# 
   15.26    db 0x63 ;; link value INTB#
   15.27 -  dw 0xdef8 ;; IRQ bitmap INTB# 
   15.28 +  dw 0x0c60 ;; IRQ bitmap INTB# 
   15.29    db 0x60 ;; link value INTC#
   15.30 -  dw 0xdef8 ;; IRQ bitmap INTC# 
   15.31 +  dw 0x0c60 ;; IRQ bitmap INTC# 
   15.32    db 0x61 ;; link value INTD#
   15.33 -  dw 0xdef8 ;; IRQ bitmap INTD#
   15.34 +  dw 0x0c60 ;; IRQ bitmap INTD#
   15.35    db 1 ;; physical slot (0 = embedded)
   15.36    db 0 ;; reserved
   15.37    ;; third slot entry: 2nd PCI slot
   15.38    db 0 ;; pci bus number
   15.39    db 0x18 ;; pci device number (bit 7-3)
   15.40    db 0x63 ;; link value INTA#
   15.41 -  dw 0xdef8 ;; IRQ bitmap INTA# 
   15.42 +  dw 0x0c60 ;; IRQ bitmap INTA# 
   15.43    db 0x60 ;; link value INTB#
   15.44 -  dw 0xdef8 ;; IRQ bitmap INTB# 
   15.45 +  dw 0x0c60 ;; IRQ bitmap INTB# 
   15.46    db 0x61 ;; link value INTC#
   15.47 -  dw 0xdef8 ;; IRQ bitmap INTC# 
   15.48 +  dw 0x0c60 ;; IRQ bitmap INTC# 
   15.49    db 0x62 ;; link value INTD#
   15.50 -  dw 0xdef8 ;; IRQ bitmap INTD#
   15.51 +  dw 0x0c60 ;; IRQ bitmap INTD#
   15.52    db 2 ;; physical slot (0 = embedded)
   15.53    db 0 ;; reserved
   15.54    ;; 4th slot entry: 3rd PCI slot
   15.55    db 0 ;; pci bus number
   15.56    db 0x20 ;; pci device number (bit 7-3)
   15.57    db 0x60 ;; link value INTA#
   15.58 -  dw 0xdef8 ;; IRQ bitmap INTA# 
   15.59 +  dw 0x0c60 ;; IRQ bitmap INTA# 
   15.60    db 0x61 ;; link value INTB#
   15.61 -  dw 0xdef8 ;; IRQ bitmap INTB# 
   15.62 +  dw 0x0c60 ;; IRQ bitmap INTB# 
   15.63    db 0x62 ;; link value INTC#
   15.64 -  dw 0xdef8 ;; IRQ bitmap INTC# 
   15.65 +  dw 0x0c60 ;; IRQ bitmap INTC# 
   15.66    db 0x63 ;; link value INTD#
   15.67 -  dw 0xdef8 ;; IRQ bitmap INTD#
   15.68 +  dw 0x0c60 ;; IRQ bitmap INTD#
   15.69    db 3 ;; physical slot (0 = embedded)
   15.70    db 0 ;; reserved
   15.71    ;; 5th slot entry: 4rd PCI slot
   15.72    db 0 ;; pci bus number
   15.73    db 0x28 ;; pci device number (bit 7-3)
   15.74    db 0x61 ;; link value INTA#
   15.75 -  dw 0xdef8 ;; IRQ bitmap INTA# 
   15.76 +  dw 0x0c60 ;; IRQ bitmap INTA# 
   15.77    db 0x62 ;; link value INTB#
   15.78 -  dw 0xdef8 ;; IRQ bitmap INTB# 
   15.79 +  dw 0x0c60 ;; IRQ bitmap INTB# 
   15.80    db 0x63 ;; link value INTC#
   15.81 -  dw 0xdef8 ;; IRQ bitmap INTC# 
   15.82 +  dw 0x0c60 ;; IRQ bitmap INTC# 
   15.83    db 0x60 ;; link value INTD#
   15.84 -  dw 0xdef8 ;; IRQ bitmap INTD#
   15.85 +  dw 0x0c60 ;; IRQ bitmap INTD#
   15.86    db 4 ;; physical slot (0 = embedded)
   15.87    db 0 ;; reserved
   15.88    ;; 6th slot entry: 5rd PCI slot
   15.89    db 0 ;; pci bus number
   15.90    db 0x30 ;; pci device number (bit 7-3)
   15.91    db 0x62 ;; link value INTA#
   15.92 -  dw 0xdef8 ;; IRQ bitmap INTA# 
   15.93 +  dw 0x0c60 ;; IRQ bitmap INTA# 
   15.94    db 0x63 ;; link value INTB#
   15.95 -  dw 0xdef8 ;; IRQ bitmap INTB# 
   15.96 +  dw 0x0c60 ;; IRQ bitmap INTB# 
   15.97    db 0x60 ;; link value INTC#
   15.98 -  dw 0xdef8 ;; IRQ bitmap INTC# 
   15.99 +  dw 0x0c60 ;; IRQ bitmap INTC# 
  15.100    db 0x61 ;; link value INTD#
  15.101 -  dw 0xdef8 ;; IRQ bitmap INTD#
  15.102 +  dw 0x0c60 ;; IRQ bitmap INTD#
  15.103    db 5 ;; physical slot (0 = embedded)
  15.104    db 0 ;; reserved
  15.105  
    16.1 --- a/tools/ioemu/target-i386-dm/piix_pci-dm.c	Thu Nov 23 17:46:52 2006 +0000
    16.2 +++ b/tools/ioemu/target-i386-dm/piix_pci-dm.c	Thu Nov 23 17:54:06 2006 +0000
    16.3 @@ -84,12 +84,6 @@ PCIBus *i440fx_init(void)
    16.4  
    16.5  static PCIDevice *piix3_dev;
    16.6  
    16.7 -static int pci_slot_get_pirq(PCIDevice *pci_dev, int irq_num)
    16.8 -{
    16.9 -    /* This is the barber's pole mapping used by Xen. */
   16.10 -    return (irq_num + (pci_dev->devfn >> 3)) & 3;
   16.11 -}
   16.12 -
   16.13  static void piix3_write_config(PCIDevice *d, 
   16.14                                 uint32_t address, uint32_t val, int len)
   16.15  {
   16.16 @@ -114,12 +108,9 @@ static void piix3_reset(PCIDevice *d)
   16.17      uint8_t *pci_conf = d->config;
   16.18  
   16.19      pci_conf[0x04] = 0x07; // master, memory and I/O
   16.20 -    pci_conf[0x05] = 0x00;
   16.21 -    pci_conf[0x06] = 0x00;
   16.22      pci_conf[0x07] = 0x02; // PCI_status_devsel_medium
   16.23      pci_conf[0x4c] = 0x4d;
   16.24      pci_conf[0x4e] = 0x03;
   16.25 -    pci_conf[0x4f] = 0x00;
   16.26      pci_conf[0x60] = 0x80;
   16.27      pci_conf[0x61] = 0x80;
   16.28      pci_conf[0x62] = 0x80;
   16.29 @@ -129,22 +120,9 @@ static void piix3_reset(PCIDevice *d)
   16.30      pci_conf[0x76] = 0x0c;
   16.31      pci_conf[0x77] = 0x0c;
   16.32      pci_conf[0x78] = 0x02;
   16.33 -    pci_conf[0x79] = 0x00;
   16.34 -    pci_conf[0x80] = 0x00;
   16.35 -    pci_conf[0x82] = 0x00;
   16.36      pci_conf[0xa0] = 0x08;
   16.37      pci_conf[0xa0] = 0x08;
   16.38 -    pci_conf[0xa2] = 0x00;
   16.39 -    pci_conf[0xa3] = 0x00;
   16.40 -    pci_conf[0xa4] = 0x00;
   16.41 -    pci_conf[0xa5] = 0x00;
   16.42 -    pci_conf[0xa6] = 0x00;
   16.43 -    pci_conf[0xa7] = 0x00;
   16.44      pci_conf[0xa8] = 0x0f;
   16.45 -    pci_conf[0xaa] = 0x00;
   16.46 -    pci_conf[0xab] = 0x00;
   16.47 -    pci_conf[0xac] = 0x00;
   16.48 -    pci_conf[0xae] = 0x00;
   16.49  }
   16.50  
   16.51  int piix3_init(PCIBus *bus)
   16.52 @@ -171,227 +149,4 @@ int piix3_init(PCIBus *bus)
   16.53      return d->devfn;
   16.54  }
   16.55  
   16.56 -/***********************************************************/
   16.57 -/* XXX: the following should be moved to the PC BIOS */
   16.58 -
   16.59 -static __attribute__((unused)) uint32_t isa_inb(uint32_t addr)
   16.60 -{
   16.61 -    return cpu_inb(NULL, addr);
   16.62 -}
   16.63 -
   16.64 -static void isa_outb(uint32_t val, uint32_t addr)
   16.65 -{
   16.66 -    cpu_outb(NULL, addr, val);
   16.67 -}
   16.68 -
   16.69 -static __attribute__((unused)) uint32_t isa_inw(uint32_t addr)
   16.70 -{
   16.71 -    return cpu_inw(NULL, addr);
   16.72 -}
   16.73 -
   16.74 -static __attribute__((unused)) void isa_outw(uint32_t val, uint32_t addr)
   16.75 -{
   16.76 -    cpu_outw(NULL, addr, val);
   16.77 -}
   16.78 -
   16.79 -static __attribute__((unused)) uint32_t isa_inl(uint32_t addr)
   16.80 -{
   16.81 -    return cpu_inl(NULL, addr);
   16.82 -}
   16.83 -
   16.84 -static __attribute__((unused)) void isa_outl(uint32_t val, uint32_t addr)
   16.85 -{
   16.86 -    cpu_outl(NULL, addr, val);
   16.87 -}
   16.88 -
   16.89 -static uint32_t pci_bios_io_addr;
   16.90 -static uint32_t pci_bios_mem_addr;
   16.91 -/* host irqs corresponding to PCI irqs A-D */
   16.92 -static uint8_t pci_irqs[4] = { 10, 11, 10, 11 };
   16.93 -
   16.94 -static void pci_config_writel(PCIDevice *d, uint32_t addr, uint32_t val)
   16.95 -{
   16.96 -    PCIBus *s = d->bus;
   16.97 -    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
   16.98 -    pci_data_write(s, addr, val, 4);
   16.99 -}
  16.100 -
  16.101 -static void pci_config_writew(PCIDevice *d, uint32_t addr, uint32_t val)
  16.102 -{
  16.103 -    PCIBus *s = d->bus;
  16.104 -    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
  16.105 -    pci_data_write(s, addr, val, 2);
  16.106 -}
  16.107 -
  16.108 -static void pci_config_writeb(PCIDevice *d, uint32_t addr, uint32_t val)
  16.109 -{
  16.110 -    PCIBus *s = d->bus;
  16.111 -    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
  16.112 -    pci_data_write(s, addr, val, 1);
  16.113 -}
  16.114 -
  16.115 -static __attribute__((unused)) uint32_t pci_config_readl(PCIDevice *d, uint32_t addr)
  16.116 -{
  16.117 -    PCIBus *s = d->bus;
  16.118 -    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
  16.119 -    return pci_data_read(s, addr, 4);
  16.120 -}
  16.121 -
  16.122 -static uint32_t pci_config_readw(PCIDevice *d, uint32_t addr)
  16.123 -{
  16.124 -    PCIBus *s = d->bus;
  16.125 -    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
  16.126 -    return pci_data_read(s, addr, 2);
  16.127 -}
  16.128 -
  16.129 -static uint32_t pci_config_readb(PCIDevice *d, uint32_t addr)
  16.130 -{
  16.131 -    PCIBus *s = d->bus;
  16.132 -    addr |= (pci_bus_num(s) << 16) | (d->devfn << 8);
  16.133 -    return pci_data_read(s, addr, 1);
  16.134 -}
  16.135 -
  16.136 -static void pci_set_io_region_addr(PCIDevice *d, int region_num, uint32_t addr)
  16.137 -{
  16.138 -    PCIIORegion *r;
  16.139 -    uint16_t cmd;
  16.140 -    uint32_t ofs;
  16.141 -
  16.142 -    if ( region_num == PCI_ROM_SLOT ) {
  16.143 -        ofs = 0x30;
  16.144 -    }else{
  16.145 -        ofs = 0x10 + region_num * 4;
  16.146 -    }
  16.147 -
  16.148 -    pci_config_writel(d, ofs, addr);
  16.149 -    r = &d->io_regions[region_num];
  16.150 -
  16.151 -    /* enable memory mappings */
  16.152 -    cmd = pci_config_readw(d, PCI_COMMAND);
  16.153 -    if ( region_num == PCI_ROM_SLOT )
  16.154 -        cmd |= 2;
  16.155 -    else if (r->type & PCI_ADDRESS_SPACE_IO)
  16.156 -        cmd |= 1;
  16.157 -    else
  16.158 -        cmd |= 2;
  16.159 -    pci_config_writew(d, PCI_COMMAND, cmd);
  16.160 -}
  16.161 -
  16.162 -static void pci_bios_init_device(PCIDevice *d)
  16.163 -{
  16.164 -    int class;
  16.165 -    PCIIORegion *r;
  16.166 -    uint32_t *paddr;
  16.167 -    int i, pin, pic_irq, vendor_id, device_id;
  16.168 -
  16.169 -    class = pci_config_readw(d, PCI_CLASS_DEVICE);
  16.170 -    vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
  16.171 -    device_id = pci_config_readw(d, PCI_DEVICE_ID);
  16.172 -    switch(class) {
  16.173 -    case 0x0101:
  16.174 -        if (vendor_id == 0x8086 && device_id == 0x7010) {
  16.175 -            /* PIIX3 IDE */
  16.176 -            pci_config_writew(d, 0x40, 0x8000); // enable IDE0
  16.177 -            pci_config_writew(d, 0x42, 0x8000); // enable IDE1
  16.178 -            goto default_map;
  16.179 -        } else {
  16.180 -            /* IDE: we map it as in ISA mode */
  16.181 -            pci_set_io_region_addr(d, 0, 0x1f0);
  16.182 -            pci_set_io_region_addr(d, 1, 0x3f4);
  16.183 -            pci_set_io_region_addr(d, 2, 0x170);
  16.184 -            pci_set_io_region_addr(d, 3, 0x374);
  16.185 -        }
  16.186 -        break;
  16.187 -    case 0x0680:
  16.188 -        if (vendor_id == 0x8086 && device_id == 0x7113) {
  16.189 -            /*
  16.190 -             * PIIX4 ACPI PM.
  16.191 -             * Special device with special PCI config space. No ordinary BARs.
  16.192 -             */
  16.193 -            pci_config_writew(d, 0x20, 0x0000); // No smb bus IO enable
  16.194 -            pci_config_writew(d, 0x22, 0x0000);
  16.195 -            pci_config_writew(d, 0x3c, 0x0009); // Hardcoded IRQ9
  16.196 -            pci_config_writew(d, 0x3d, 0x0001);
  16.197 -        }
  16.198 -        break;
  16.199 -    case 0x0300:
  16.200 -        if (vendor_id != 0x1234)
  16.201 -            goto default_map;
  16.202 -        /* VGA: map frame buffer to default Bochs VBE address */
  16.203 -        pci_set_io_region_addr(d, 0, 0xE0000000);
  16.204 -        break;
  16.205 -    case 0x0800:
  16.206 -        /* PIC */
  16.207 -        vendor_id = pci_config_readw(d, PCI_VENDOR_ID);
  16.208 -        device_id = pci_config_readw(d, PCI_DEVICE_ID);
  16.209 -        if (vendor_id == 0x1014) {
  16.210 -            /* IBM */
  16.211 -            if (device_id == 0x0046 || device_id == 0xFFFF) {
  16.212 -                /* MPIC & MPIC2 */
  16.213 -                pci_set_io_region_addr(d, 0, 0x80800000 + 0x00040000);
  16.214 -            }
  16.215 -        }
  16.216 -        break;
  16.217 -    case 0xff00:
  16.218 -        if (vendor_id == 0x0106b &&
  16.219 -            (device_id == 0x0017 || device_id == 0x0022)) {
  16.220 -            /* macio bridge */
  16.221 -            pci_set_io_region_addr(d, 0, 0x80800000);
  16.222 -        }
  16.223 -        break;
  16.224 -    default:
  16.225 -    default_map:
  16.226 -        /* default memory mappings */
  16.227 -        for(i = 0; i < PCI_NUM_REGIONS; i++) {
  16.228 -            r = &d->io_regions[i];
  16.229 -            if (r->size) {
  16.230 -                if (r->type & PCI_ADDRESS_SPACE_IO)
  16.231 -                    paddr = &pci_bios_io_addr;
  16.232 -                else
  16.233 -                    paddr = &pci_bios_mem_addr;
  16.234 -                *paddr = (*paddr + r->size - 1) & ~(r->size - 1);
  16.235 -                pci_set_io_region_addr(d, i, *paddr);
  16.236 -                *paddr += r->size;
  16.237 -            }
  16.238 -        }
  16.239 -        break;
  16.240 -    }
  16.241 -
  16.242 -    /* map the interrupt */
  16.243 -    pin = pci_config_readb(d, PCI_INTERRUPT_PIN);
  16.244 -    if (pin != 0) {
  16.245 -        pin = pci_slot_get_pirq(d, pin - 1);
  16.246 -        pic_irq = pci_irqs[pin];
  16.247 -        pci_config_writeb(d, PCI_INTERRUPT_LINE, pic_irq);
  16.248 -    }
  16.249 -}
  16.250 -
  16.251 -/*
  16.252 - * This function initializes the PCI devices as a normal PCI BIOS
  16.253 - * would do. It is provided just in case the BIOS has no support for
  16.254 - * PCI.
  16.255 - */
  16.256 -void pci_bios_init(void)
  16.257 -{
  16.258 -    int i, irq;
  16.259 -    uint8_t elcr[2];
  16.260 -
  16.261 -    pci_bios_io_addr = 0xc000;
  16.262 -    pci_bios_mem_addr = HVM_BELOW_4G_MMIO_START;
  16.263 -
  16.264 -    /* activate IRQ mappings */
  16.265 -    elcr[0] = 0x00;
  16.266 -    elcr[1] = 0x00;
  16.267 -    for(i = 0; i < 4; i++) {
  16.268 -        irq = pci_irqs[i];
  16.269 -        /* set to trigger level */
  16.270 -        elcr[irq >> 3] |= (1 << (irq & 7));
  16.271 -        /* activate irq remapping in PIIX */
  16.272 -        pci_config_writeb(piix3_dev, 0x60 + i, irq);
  16.273 -    }
  16.274 -    isa_outb(elcr[0], 0x4d0);
  16.275 -    isa_outb(elcr[1], 0x4d1);
  16.276 -
  16.277 -    pci_for_each_device(pci_bios_init_device);
  16.278 -}
  16.279 -
  16.280 +void pci_bios_init(void) {}
    17.1 --- a/tools/ioemu/vl.c	Thu Nov 23 17:46:52 2006 +0000
    17.2 +++ b/tools/ioemu/vl.c	Thu Nov 23 17:54:06 2006 +0000
    17.3 @@ -2530,6 +2530,7 @@ static CharDriverState *qemu_chr_open_tc
    17.4      int is_waitconnect = 1;
    17.5      const char *ptr;
    17.6      struct sockaddr_in saddr;
    17.7 +    int opt;
    17.8  
    17.9      if (parse_host_port(&saddr, host_str) < 0)
   17.10          goto fail;
   17.11 @@ -2598,6 +2599,8 @@ static CharDriverState *qemu_chr_open_tc
   17.12              }
   17.13          }
   17.14          s->fd = fd;
   17.15 +	opt = 1;
   17.16 +	setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (char *)&opt, sizeof(opt));
   17.17          if (s->connected)
   17.18              tcp_chr_connect(chr);
   17.19          else
    18.1 --- a/xen/arch/x86/hvm/svm/svm.c	Thu Nov 23 17:46:52 2006 +0000
    18.2 +++ b/xen/arch/x86/hvm/svm/svm.c	Thu Nov 23 17:54:06 2006 +0000
    18.3 @@ -1441,7 +1441,7 @@ static int svm_set_cr0(unsigned long val
    18.4      /* We don't want to lose PG.  ET is reserved and should be always be 1*/
    18.5      paging_enabled = svm_paging_enabled(v);
    18.6      value |= X86_CR0_ET;
    18.7 -    vmcb->cr0 = value | X86_CR0_PG;
    18.8 +    vmcb->cr0 = value | X86_CR0_PG | X86_CR0_WP;
    18.9      v->arch.hvm_svm.cpu_shadow_cr0 = value;
   18.10  
   18.11      /* TS cleared? Then initialise FPU now. */
   18.12 @@ -2094,7 +2094,7 @@ static int svm_do_vmmcall_reset_to_realm
   18.13      vmcb->tsc_offset = 0;
   18.14  
   18.15      /* VMCB State */
   18.16 -    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG;
   18.17 +    vmcb->cr0 = X86_CR0_ET | X86_CR0_PG | X86_CR0_WP;
   18.18      v->arch.hvm_svm.cpu_shadow_cr0 = X86_CR0_ET;
   18.19  
   18.20      vmcb->cr2 = 0;
    19.1 --- a/xen/arch/x86/hvm/svm/vmcb.c	Thu Nov 23 17:46:52 2006 +0000
    19.2 +++ b/xen/arch/x86/hvm/svm/vmcb.c	Thu Nov 23 17:54:06 2006 +0000
    19.3 @@ -197,6 +197,7 @@ static int construct_vmcb(struct vcpu *v
    19.4      /* Guest CR0. */
    19.5      vmcb->cr0 = read_cr0();
    19.6      arch_svm->cpu_shadow_cr0 = vmcb->cr0 & ~(X86_CR0_PG | X86_CR0_TS);
    19.7 +    vmcb->cr0 |= X86_CR0_WP;
    19.8  
    19.9      /* Guest CR4. */
   19.10      arch_svm->cpu_shadow_cr4 =
    20.1 --- a/xen/arch/x86/traps.c	Thu Nov 23 17:46:52 2006 +0000
    20.2 +++ b/xen/arch/x86/traps.c	Thu Nov 23 17:54:06 2006 +0000
    20.3 @@ -1026,8 +1026,6 @@ void host_to_guest_gpr_switch(struct cpu
    20.4      __attribute__((__regparm__(1)));
    20.5  unsigned long guest_to_host_gpr_switch(unsigned long)
    20.6      __attribute__((__regparm__(1)));
    20.7 -typedef unsigned long (*io_emul_stub_t)(struct cpu_user_regs *)
    20.8 -    __attribute__((__regparm__(1)));
    20.9  
   20.10  /* Instruction fetch with error handling. */
   20.11  #define insn_fetch(_type, _size, cs, eip)                                   \
   20.12 @@ -1048,6 +1046,7 @@ static int emulate_privileged_op(struct 
   20.13      u8 opcode, modrm_reg = 0, modrm_rm = 0, rep_prefix = 0;
   20.14      unsigned int port, i, op_bytes = 4, data, rc;
   20.15      char io_emul_stub[16];
   20.16 +    void (*io_emul)(struct cpu_user_regs *) __attribute__((__regparm__(1)));
   20.17      u32 l, h;
   20.18  
   20.19      /* Legacy prefixes. */
   20.20 @@ -1190,6 +1189,9 @@ static int emulate_privileged_op(struct 
   20.21      *(s32 *)&io_emul_stub[9] =
   20.22          (char *)guest_to_host_gpr_switch - &io_emul_stub[13];
   20.23  
   20.24 +    /* Handy function-typed pointer to the stub. */
   20.25 +    io_emul = (void *)io_emul_stub;
   20.26 +
   20.27      /* I/O Port and Interrupt Flag instructions. */
   20.28      switch ( opcode )
   20.29      {
   20.30 @@ -1204,22 +1206,20 @@ static int emulate_privileged_op(struct 
   20.31          switch ( op_bytes )
   20.32          {
   20.33          case 1:
   20.34 -            res = regs->eax & ~0xffUL;
   20.35              if ( guest_inb_okay(port, v, regs) )
   20.36 -                regs->eax = res | (u8)((io_emul_stub_t)io_emul_stub)(regs);
   20.37 +                io_emul(regs);
   20.38              else
   20.39 -                regs->eax = res | (u8)~0;
   20.40 +                regs->eax |= (u8)~0;
   20.41              break;
   20.42          case 2:
   20.43 -            res = regs->eax & ~0xffffUL;
   20.44              if ( guest_inw_okay(port, v, regs) )
   20.45 -                regs->eax = res | (u16)((io_emul_stub_t)io_emul_stub)(regs);
   20.46 +                io_emul(regs);
   20.47              else
   20.48 -                regs->eax = res | (u16)~0;
   20.49 +                regs->eax |= (u16)~0;
   20.50              break;
   20.51          case 4:
   20.52              if ( guest_inl_okay(port, v, regs) )
   20.53 -                regs->eax = (u32)((io_emul_stub_t)io_emul_stub)(regs);
   20.54 +                io_emul(regs);
   20.55              else
   20.56                  regs->eax = (u32)~0;
   20.57              break;
   20.58 @@ -1244,15 +1244,15 @@ static int emulate_privileged_op(struct 
   20.59          {
   20.60          case 1:
   20.61              if ( guest_outb_okay(port, v, regs) )
   20.62 -                ((io_emul_stub_t)io_emul_stub)(regs);
   20.63 +                io_emul(regs);
   20.64              break;
   20.65          case 2:
   20.66              if ( guest_outw_okay(port, v, regs) )
   20.67 -                ((io_emul_stub_t)io_emul_stub)(regs);
   20.68 +                io_emul(regs);
   20.69              break;
   20.70          case 4:
   20.71              if ( guest_outl_okay(port, v, regs) )
   20.72 -                ((io_emul_stub_t)io_emul_stub)(regs);
   20.73 +                io_emul(regs);
   20.74              break;
   20.75          }
   20.76          goto done;
    21.1 --- a/xen/arch/x86/x86_emulate.c	Thu Nov 23 17:46:52 2006 +0000
    21.2 +++ b/xen/arch/x86/x86_emulate.c	Thu Nov 23 17:54:06 2006 +0000
    21.3 @@ -113,12 +113,10 @@ static uint8_t opcode_table[256] = {
    21.4      /* 0xA0 - 0xA7 */
    21.5      ByteOp|DstReg|SrcMem|Mov, DstReg|SrcMem|Mov,
    21.6      ByteOp|DstMem|SrcReg|Mov, DstMem|SrcReg|Mov,
    21.7 -    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov,
    21.8 -    ByteOp|ImplicitOps, ImplicitOps,
    21.9 +    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov, 0, 0,
   21.10      /* 0xA8 - 0xAF */
   21.11      0, 0, ByteOp|ImplicitOps|Mov, ImplicitOps|Mov,
   21.12 -    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov,
   21.13 -    ByteOp|ImplicitOps, ImplicitOps,
   21.14 +    ByteOp|ImplicitOps|Mov, ImplicitOps|Mov, 0, 0,
   21.15      /* 0xB0 - 0xBF */
   21.16      0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   21.17      /* 0xC0 - 0xC7 */
   21.18 @@ -368,15 +366,16 @@ do{ __asm__ __volatile__ (              
   21.19  #endif /* __i386__ */
   21.20  
   21.21  /* Fetch next part of the instruction being emulated. */
   21.22 -#define insn_fetch(_type, _size)                                        \
   21.23 +#define _insn_fetch(_size)                                              \
   21.24  ({ unsigned long _x, _ptr = _regs.eip;                                  \
   21.25     if ( mode == X86EMUL_MODE_REAL ) _ptr += _regs.cs << 4;              \
   21.26     rc = ops->read_std(_ptr, &_x, (_size), ctxt);                        \
   21.27     if ( rc != 0 )                                                       \
   21.28         goto done;                                                       \
   21.29     _regs.eip += (_size);                                                \
   21.30 -   (_type)_x;                                                           \
   21.31 +   _x;                                                                  \
   21.32  })
   21.33 +#define insn_fetch(_type) ((_type)_insn_fetch(sizeof(_type)))
   21.34  
   21.35  /* Access/update address held in a register, based on addressing mode. */
   21.36  #define register_address(sel, reg)                                      \
   21.37 @@ -393,6 +392,17 @@ do {                                    
   21.38                  (((reg) + _inc) & ((1UL << (ad_bytes << 3)) - 1));      \
   21.39  } while (0)
   21.40  
   21.41 +/*
   21.42 + * We cannot handle a page fault on a data access that straddles two pages
   21.43 + * and faults on the second page. This is because CR2 is not equal to the
   21.44 + * memory operand's effective address in this case. Rather than fix up the
   21.45 + * effective address it is okay for us to fail the emulation.
   21.46 + */
   21.47 +#define page_boundary_test() do {                               \
   21.48 +    if ( ((cr2 & (PAGE_SIZE-1)) == 0) && ((ea & 3) != 0) )      \
   21.49 +        goto bad_ea;                                            \
   21.50 +} while ( 0 )
   21.51 +
   21.52  void *
   21.53  decode_register(
   21.54      uint8_t modrm_reg, struct cpu_user_regs *regs, int highbyte_regs)
   21.55 @@ -438,13 +448,13 @@ x86_emulate_memop(
   21.56      struct x86_emulate_ctxt *ctxt,
   21.57      struct x86_emulate_ops  *ops)
   21.58  {
   21.59 -    uint8_t b, d, sib, twobyte = 0, rex_prefix = 0;
   21.60 +    uint8_t b, d, sib, sib_index, sib_base, twobyte = 0, rex_prefix = 0;
   21.61      uint8_t modrm, modrm_mod = 0, modrm_reg = 0, modrm_rm = 0;
   21.62      uint16_t *seg = NULL; /* override segment */
   21.63      unsigned int op_bytes, ad_bytes, lock_prefix = 0, rep_prefix = 0, i;
   21.64      int rc = 0;
   21.65      struct operand src, dst;
   21.66 -    unsigned long cr2 = ctxt->cr2;
   21.67 +    unsigned long ea = 0, cr2 = ctxt->cr2;
   21.68      int mode = ctxt->mode;
   21.69  
   21.70      /* Shadow copy of register state. Committed on successful emulation. */
   21.71 @@ -479,7 +489,7 @@ x86_emulate_memop(
   21.72      /* Legacy prefixes. */
   21.73      for ( i = 0; i < 8; i++ )
   21.74      {
   21.75 -        switch ( b = insn_fetch(uint8_t, 1) )
   21.76 +        switch ( b = insn_fetch(uint8_t) )
   21.77          {
   21.78          case 0x66: /* operand-size override */
   21.79              op_bytes ^= 6;      /* switch between 2/4 bytes */
   21.80 @@ -526,11 +536,9 @@ x86_emulate_memop(
   21.81      if ( (mode == X86EMUL_MODE_PROT64) && ((b & 0xf0) == 0x40) )
   21.82      {
   21.83          rex_prefix = b;
   21.84 -        if ( b & 8 )
   21.85 -            op_bytes = 8;          /* REX.W */
   21.86 -        modrm_reg = (b & 4) << 1;  /* REX.R */
   21.87 -        /* REX.B and REX.X do not need to be decoded. */
   21.88 -        b = insn_fetch(uint8_t, 1);
   21.89 +        if ( b & 8 ) /* REX.W */
   21.90 +            op_bytes = 8;
   21.91 +        b = insn_fetch(uint8_t);
   21.92      }
   21.93  
   21.94      /* Opcode byte(s). */
   21.95 @@ -541,7 +549,7 @@ x86_emulate_memop(
   21.96          if ( b == 0x0f )
   21.97          {
   21.98              twobyte = 1;
   21.99 -            b = insn_fetch(uint8_t, 1);
  21.100 +            b = insn_fetch(uint8_t);
  21.101              d = twobyte_table[b];
  21.102          }
  21.103  
  21.104 @@ -553,10 +561,10 @@ x86_emulate_memop(
  21.105      /* ModRM and SIB bytes. */
  21.106      if ( d & ModRM )
  21.107      {
  21.108 -        modrm = insn_fetch(uint8_t, 1);
  21.109 -        modrm_mod |= (modrm & 0xc0) >> 6;
  21.110 -        modrm_reg |= (modrm & 0x38) >> 3;
  21.111 -        modrm_rm  |= (modrm & 0x07);
  21.112 +        modrm = insn_fetch(uint8_t);
  21.113 +        modrm_mod = (modrm & 0xc0) >> 6;
  21.114 +        modrm_reg = ((rex_prefix & 4) << 1) | ((modrm & 0x38) >> 3);
  21.115 +        modrm_rm  = modrm & 0x07;
  21.116  
  21.117          if ( modrm_mod == 3 )
  21.118          {
  21.119 @@ -567,44 +575,74 @@ x86_emulate_memop(
  21.120          if ( ad_bytes == 2 )
  21.121          {
  21.122              /* 16-bit ModR/M decode. */
  21.123 +            switch ( modrm_rm )
  21.124 +            {
  21.125 +            case 0: ea = _regs.ebx + _regs.esi; break;
  21.126 +            case 1: ea = _regs.ebx + _regs.edi; break;
  21.127 +            case 2: ea = _regs.ebp + _regs.esi; break;
  21.128 +            case 3: ea = _regs.ebp + _regs.edi; break;
  21.129 +            case 4: ea = _regs.esi; break;
  21.130 +            case 5: ea = _regs.edi; break;
  21.131 +            case 6: ea = _regs.ebp; break;
  21.132 +            case 7: ea = _regs.ebx; break;
  21.133 +            }
  21.134              switch ( modrm_mod )
  21.135              {
  21.136 -            case 0:
  21.137 -                if ( modrm_rm == 6 )
  21.138 -                    _regs.eip += 2; /* skip disp16 */
  21.139 -                break;
  21.140 -            case 1:
  21.141 -                _regs.eip += 1; /* skip disp8 */
  21.142 -                break;
  21.143 -            case 2:
  21.144 -                _regs.eip += 2; /* skip disp16 */
  21.145 -                break;
  21.146 +            case 0: if ( modrm_rm == 6 ) ea = insn_fetch(uint16_t); break;
  21.147 +            case 1: ea += insn_fetch(uint8_t);  break;
  21.148 +            case 2: ea += insn_fetch(uint16_t); break;
  21.149              }
  21.150 +            ea = (uint16_t)ea;
  21.151          }
  21.152          else
  21.153          {
  21.154              /* 32/64-bit ModR/M decode. */
  21.155 +            if ( modrm_rm == 4 )
  21.156 +            {
  21.157 +                sib = insn_fetch(uint8_t);
  21.158 +                sib_index = ((sib >> 3) & 7) | ((modrm << 2) & 8);
  21.159 +                sib_base  = (sib & 7) | ((modrm << 3) & 8);
  21.160 +                if ( sib_index != 4 )
  21.161 +                    ea = *(long *)decode_register(sib_index, &_regs, 0);
  21.162 +                ea <<= (sib >> 6) & 3;
  21.163 +                if ( (modrm_mod == 0) && ((sib_base & 7) == 5) )
  21.164 +                    ea += insn_fetch(uint32_t);
  21.165 +                else
  21.166 +                    ea += *(long *)decode_register(sib_base, &_regs, 0);
  21.167 +            }
  21.168 +            else
  21.169 +            {
  21.170 +                modrm_rm |= (rex_prefix & 1) << 3;
  21.171 +                ea = *(long *)decode_register(modrm_rm, &_regs, 0);
  21.172 +            }
  21.173              switch ( modrm_mod )
  21.174              {
  21.175              case 0:
  21.176 -                if ( (modrm_rm == 4) && 
  21.177 -                     (((sib = insn_fetch(uint8_t, 1)) & 7) == 5) )
  21.178 -                    _regs.eip += 4; /* skip disp32 specified by SIB.base */
  21.179 -                else if ( modrm_rm == 5 )
  21.180 -                    _regs.eip += 4; /* skip disp32 */
  21.181 +                if ( (modrm_rm & 7) != 5 )
  21.182 +                    break;
  21.183 +                ea = insn_fetch(uint32_t);
  21.184 +                if ( mode != X86EMUL_MODE_PROT64 )
  21.185 +                    break;
  21.186 +                /* Relative to RIP of next instruction. Argh! */
  21.187 +                ea += _regs.eip;
  21.188 +                if ( (d & SrcMask) == SrcImm )
  21.189 +                    ea += (d & ByteOp) ? 1 : op_bytes;
  21.190 +                else if ( (d & SrcMask) == SrcImmByte )
  21.191 +                    ea += 1;
  21.192 +                else if ( ((b == 0xf6) || (b == 0xf7)) &&
  21.193 +                          ((modrm_reg & 7) <= 1) )
  21.194 +                    /* Special case in Grp3: test has immediate operand. */
  21.195 +                    ea += (d & ByteOp) ? 1
  21.196 +                        : ((op_bytes == 8) ? 4 : op_bytes);
  21.197                  break;
  21.198 -            case 1:
  21.199 -                if ( modrm_rm == 4 )
  21.200 -                    sib = insn_fetch(uint8_t, 1);
  21.201 -                _regs.eip += 1; /* skip disp8 */
  21.202 -                break;
  21.203 -            case 2:
  21.204 -                if ( modrm_rm == 4 )
  21.205 -                    sib = insn_fetch(uint8_t, 1);
  21.206 -                _regs.eip += 4; /* skip disp32 */
  21.207 -                break;
  21.208 +            case 1: ea += insn_fetch(uint8_t);  break;
  21.209 +            case 2: ea += insn_fetch(uint32_t); break;
  21.210              }
  21.211 +            if ( ad_bytes == 4 )
  21.212 +                ea = (uint32_t)ea;
  21.213          }
  21.214 +
  21.215 +        page_boundary_test();
  21.216      }
  21.217  
  21.218      /* Decode and fetch the destination operand: register or memory. */
  21.219 @@ -692,16 +730,16 @@ x86_emulate_memop(
  21.220          /* NB. Immediates are sign-extended as necessary. */
  21.221          switch ( src.bytes )
  21.222          {
  21.223 -        case 1: src.val = insn_fetch(int8_t,  1); break;
  21.224 -        case 2: src.val = insn_fetch(int16_t, 2); break;
  21.225 -        case 4: src.val = insn_fetch(int32_t, 4); break;
  21.226 +        case 1: src.val = insn_fetch(int8_t);  break;
  21.227 +        case 2: src.val = insn_fetch(int16_t); break;
  21.228 +        case 4: src.val = insn_fetch(int32_t); break;
  21.229          }
  21.230          break;
  21.231      case SrcImmByte:
  21.232          src.type  = OP_IMM;
  21.233          src.ptr   = (unsigned long *)_regs.eip;
  21.234          src.bytes = 1;
  21.235 -        src.val   = insn_fetch(int8_t,  1);
  21.236 +        src.val   = insn_fetch(int8_t);
  21.237          break;
  21.238      }
  21.239  
  21.240 @@ -740,7 +778,7 @@ x86_emulate_memop(
  21.241          dst.val = (int32_t)src.val;
  21.242          break;
  21.243      case 0x80 ... 0x83: /* Grp1 */
  21.244 -        switch ( modrm_reg )
  21.245 +        switch ( modrm_reg & 7 )
  21.246          {
  21.247          case 0: goto add;
  21.248          case 1: goto or;
  21.249 @@ -771,11 +809,13 @@ x86_emulate_memop(
  21.250      case 0xa0 ... 0xa1: /* mov */
  21.251          dst.ptr = (unsigned long *)&_regs.eax;
  21.252          dst.val = src.val;
  21.253 -        _regs.eip += ad_bytes; /* skip src displacement */
  21.254 +        ea = _insn_fetch(ad_bytes); /* src effective address */
  21.255 +        page_boundary_test();
  21.256          break;
  21.257      case 0xa2 ... 0xa3: /* mov */
  21.258          dst.val = (unsigned long)_regs.eax;
  21.259 -        _regs.eip += ad_bytes; /* skip dst displacement */
  21.260 +        ea = _insn_fetch(ad_bytes); /* dst effective address */
  21.261 +        page_boundary_test();
  21.262          break;
  21.263      case 0x88 ... 0x8b: /* mov */
  21.264      case 0xc6 ... 0xc7: /* mov (sole member of Grp11) */
  21.265 @@ -798,7 +838,7 @@ x86_emulate_memop(
  21.266          register_address_increment(_regs.esp, dst.bytes);
  21.267          break;
  21.268      case 0xc0 ... 0xc1: grp2: /* Grp2 */
  21.269 -        switch ( modrm_reg )
  21.270 +        switch ( modrm_reg & 7 )
  21.271          {
  21.272          case 0: /* rol */
  21.273              emulate_2op_SrcB("rol", src, dst, _regs.eflags);
  21.274 @@ -831,7 +871,7 @@ x86_emulate_memop(
  21.275          src.val = _regs.ecx;
  21.276          goto grp2;
  21.277      case 0xf6 ... 0xf7: /* Grp3 */
  21.278 -        switch ( modrm_reg )
  21.279 +        switch ( modrm_reg & 7 )
  21.280          {
  21.281          case 0 ... 1: /* test */
  21.282              /* Special case in Grp3: test has an immediate source operand. */
  21.283 @@ -841,9 +881,9 @@ x86_emulate_memop(
  21.284              if ( src.bytes == 8 ) src.bytes = 4;
  21.285              switch ( src.bytes )
  21.286              {
  21.287 -            case 1: src.val = insn_fetch(int8_t,  1); break;
  21.288 -            case 2: src.val = insn_fetch(int16_t, 2); break;
  21.289 -            case 4: src.val = insn_fetch(int32_t, 4); break;
  21.290 +            case 1: src.val = insn_fetch(int8_t);  break;
  21.291 +            case 2: src.val = insn_fetch(int16_t); break;
  21.292 +            case 4: src.val = insn_fetch(int32_t); break;
  21.293              }
  21.294              goto test;
  21.295          case 2: /* not */
  21.296 @@ -857,7 +897,7 @@ x86_emulate_memop(
  21.297          }
  21.298          break;
  21.299      case 0xfe ... 0xff: /* Grp4/Grp5 */
  21.300 -        switch ( modrm_reg )
  21.301 +        switch ( modrm_reg & 7 )
  21.302          {
  21.303          case 0: /* inc */
  21.304              emulate_1op("inc", dst, _regs.eflags);
  21.305 @@ -955,6 +995,7 @@ x86_emulate_memop(
  21.306                                                        _regs.esi),
  21.307                                       &dst.val, dst.bytes, ctxt)) != 0 )
  21.308                  goto done;
  21.309 +            ea = _regs.edi & ((1UL << (ad_bytes*8)) - 1UL);
  21.310          }
  21.311          else
  21.312          {
  21.313 @@ -963,15 +1004,14 @@ x86_emulate_memop(
  21.314              if ( (rc = ops->read_emulated(cr2, &dst.val,
  21.315                                            dst.bytes, ctxt)) != 0 )
  21.316                  goto done;
  21.317 +            ea = _regs.esi & ((1UL << (ad_bytes*8)) - 1UL);
  21.318          }
  21.319          register_address_increment(
  21.320              _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
  21.321          register_address_increment(
  21.322              _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
  21.323 +        page_boundary_test();
  21.324          break;
  21.325 -    case 0xa6 ... 0xa7: /* cmps */
  21.326 -        dprintf("Urk! I don't handle CMPS.\n");
  21.327 -        goto cannot_emulate;
  21.328      case 0xaa ... 0xab: /* stos */
  21.329          dst.type  = OP_MEM;
  21.330          dst.bytes = (d & ByteOp) ? 1 : op_bytes;
  21.331 @@ -979,6 +1019,8 @@ x86_emulate_memop(
  21.332          dst.val   = _regs.eax;
  21.333          register_address_increment(
  21.334              _regs.edi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
  21.335 +        ea = _regs.edi & ((1UL << (ad_bytes*8)) - 1UL);
  21.336 +        page_boundary_test();
  21.337          break;
  21.338      case 0xac ... 0xad: /* lods */
  21.339          dst.type  = OP_REG;
  21.340 @@ -988,10 +1030,9 @@ x86_emulate_memop(
  21.341              goto done;
  21.342          register_address_increment(
  21.343              _regs.esi, (_regs.eflags & EFLG_DF) ? -dst.bytes : dst.bytes);
  21.344 +        ea = _regs.esi & ((1UL << (ad_bytes*8)) - 1UL);
  21.345 +        page_boundary_test();
  21.346          break;
  21.347 -    case 0xae ... 0xaf: /* scas */
  21.348 -        dprintf("Urk! I don't handle SCAS.\n");
  21.349 -        goto cannot_emulate;
  21.350      }
  21.351      goto writeback;
  21.352  
  21.353 @@ -1151,6 +1192,10 @@ x86_emulate_memop(
  21.354   cannot_emulate:
  21.355      dprintf("Cannot emulate %02x\n", b);
  21.356      return -1;
  21.357 +
  21.358 + bad_ea:
  21.359 +    dprintf("Access faulted on page boundary (cr2=%lx,ea=%lx).\n", cr2, ea);
  21.360 +    return -1;
  21.361  }
  21.362  
  21.363  #ifdef __XEN__