Esempio 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);
        }
Esempio 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);
            }
        }