Mosa.HardwareSystem.HardwareResources.GetMemoryRegion C# (CSharp) Method

GetMemoryRegion() public method

Gets the memory region.
public GetMemoryRegion ( byte index ) : MemoryRegion
index byte The index.
return MemoryRegion
        public MemoryRegion GetMemoryRegion(byte index)
        {
            return memoryRegions[index];
        }

Usage Example

コード例 #1
0
        /// <summary>
        /// Claims the resources.
        /// </summary>
        /// <param name="hardwareResources">The hardware resources.</param>
        /// <returns></returns>
        public bool ClaimResources(HardwareResources hardwareResources)
        {
            spinLock.Enter();

            for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
            {
                var region = hardwareResources.GetMemoryRegion(r);

                foreach (var memoryRegion in memoryRegions)
                {
                    if ((memoryRegion.Contains(region.BaseAddress) || memoryRegion.Contains(region.BaseAddress + region.Size)))
                    {
                        return(false);
                    }
                }
            }

            for (byte r = 0; r < hardwareResources.MemoryRegionCount; r++)
            {
                memoryRegions.AddLast(hardwareResources.GetMemoryRegion(r));
            }

            spinLock.Exit();

            return(true);
        }
All Usage Examples Of Mosa.HardwareSystem.HardwareResources::GetMemoryRegion