Ejemplo n.º 1
0
        public static IntPtr GetMaximumAddress()
        {
            var max   = IntPtr.Zero;
            var count = Map.Count;

            for (uint i = 0; i < count; i++)
            {
                var entry = BootMemoryMap.GetBootMemoryMapEntry(i);

                var endAddress = entry.EndAddress;

                if (endAddress.GreaterThan(max))
                {
                    max = endAddress;
                }
            }

            return(max);
        }
Ejemplo n.º 2
0
        public static void ImportMultibootV1MemoryMap()
        {
            if (!Multiboot.IsAvailable)
            {
                return;
            }

            if (Multiboot.MultibootV1.MemoryMapStart.IsNull())
            {
                return;
            }

            var memoryMapEnd = Multiboot.MultibootV1.MemoryMapStart + (int)Multiboot.MultibootV1.MemoryMapLength;

            var entry = new MultibootV1MemoryMapEntry(Multiboot.MultibootV1.MemoryMapStart);

            while (entry.IsAvailable)
            {
                BootMemoryMap.SetMemoryMap(entry.BaseAddr, entry.Length, entry.Type == 1 ? BootMemoryMapType.Available : BootMemoryMapType.Reserved);

                entry = entry.GetNext(memoryMapEnd);
            }
        }