Exemplo n.º 1
0
        internal static void ParseMpTables()
        {
            UIntPtr mpFloat = GetMpFloatBase();

            if (mpFloat == UIntPtr.Zero)
            {
                DebugStub.Print("MP Floating Pointer Structure not found.\n");
                return;
            }

            mpFloatRegion =
                IoMemory.MapPhysicalMemory(mpFloat, new UIntPtr(16), true, false);

            FloatingPointer = MpFloatingPointer.Parse(mpFloatRegion);
            if (FloatingPointer == null)
            {
                DebugStub.Print("Failed to parse MP Floating Pointer " +
                                "Structure.\n");
                return;
            }

            if (FloatingPointer.MpConfTablePresent)
            {
                mpConfTableRegion = IoMemory.MapPhysicalMemory(
                    new UIntPtr(FloatingPointer.ConfTableBase),
                    new UIntPtr(0x2c), true, false);

                DebugStub.Print("Found MP Conf Table\n");

                ConfTable = MpConfTable.Parse(mpConfTableRegion);
                if (ConfTable == null)
                {
                    DebugStub.Print("Failed to parse MP Configuration table.\n");
                }

                IoMemory mpResourceRegion =
                    IoMemory.MapPhysicalMemory(
                        new UIntPtr(FloatingPointer.ConfTableBase + 0x2c),
                        new UIntPtr(ConfTable.BaseTableLength - 0x2c),
                        true, false);
                DebugStub.Print("Parsing MP Conf Table Resources\n");
                MpResources.Parse(mpResourceRegion,
                                  ConfTable.BaseTableLength - 0x2c,
                                  ConfTable.EntryCount);
            }
            else
            {
                DebugStub.Print("MP Configuration table not present.\n");
                DebugStub.Print("MP Floating Pointer features: " +
                                "{0:x8} {1:x8} {2:x8} {3:x8} {4:x8}\n",
                                __arglist(
                                    FloatingPointer.Feature[0],
                                    FloatingPointer.Feature[1],
                                    FloatingPointer.Feature[2],
                                    FloatingPointer.Feature[3],
                                    FloatingPointer.Feature[4]));
            }
        }
Exemplo n.º 2
0
        internal static MpConfTable Parse(IoMemory region)
        {
            if (region.Read32(0) != Signature)
            {
                return(null);
            }

            int length = region.Read16(4);

            DebugStub.Print("MP Conf Table length {0}\n", __arglist(length));

#if NOTYET
            byte checksum = 0;
            for (int i = 0; i < length; i++)
            {
                checksum += region.Read8(i);
            }

            if (checksum != 0)
            {
                return(null);
            }
#endif

            MpConfTable confTable = new MpConfTable();
            confTable.BaseTableLength       = region.Read16(4);
            confTable.Revision              = region.Read8(7);
            confTable.OemTableBase          = region.Read32(0x1c);
            confTable.OemTableSize          = region.Read16(0x20);
            confTable.EntryCount            = region.Read16(0x22);
            confTable.LocalApicBase         = region.Read32(0x24);
            confTable.ExtendedTableLength   = region.Read16(0x28);
            confTable.ExtendedTableChecksum = region.Read8(0x2a);
            confTable.OemId     = region.ReadAsciiZeroString(8, 8);
            confTable.ProductId = region.ReadAsciiZeroString(0x10, 0x0c);
            return(confTable);
        }