示例#1
0
        private KernelResult GetSystemInfo(uint id, int handle, long subId, out long value)
        {
            value = 0;

            if (id > 2)
            {
                return(KernelResult.InvalidEnumValue);
            }

            if (handle != 0)
            {
                return(KernelResult.InvalidHandle);
            }

            if (id < 2)
            {
                if ((ulong)subId > 3)
                {
                    return(KernelResult.InvalidCombination);
                }

                KMemoryRegionManager region = _system.MemoryRegions[subId];

                switch (id)
                {
                //Memory region capacity.
                case 0: value = (long)region.Size; break;

                //Memory region free space.
                case 1:
                {
                    ulong freePagesCount = region.GetFreePages();

                    value = (long)(freePagesCount * KMemoryManager.PageSize);

                    break;
                }
                }
            }
            else /* if (Id == 2) */
            {
                if ((ulong)subId > 1)
                {
                    return(KernelResult.InvalidCombination);
                }

                switch (subId)
                {
                case 0: value = _system.PrivilegedProcessLowestId;  break;

                case 1: value = _system.PrivilegedProcessHighestId; break;
                }
            }

            return(KernelResult.Success);
        }
示例#2
0
        private KernelResult GetSystemInfo(uint Id, int Handle, long SubId, out long Value)
        {
            Value = 0;

            if (Id > 2)
            {
                return(KernelResult.InvalidEnumValue);
            }

            if (Handle != 0)
            {
                return(KernelResult.InvalidHandle);
            }

            if (Id < 2)
            {
                if ((ulong)SubId > 3)
                {
                    return(KernelResult.InvalidCombination);
                }

                KMemoryRegionManager Region = System.MemoryRegions[SubId];

                switch (Id)
                {
                //Memory region capacity.
                case 0: Value = (long)Region.Size; break;

                //Memory region free space.
                case 1:
                {
                    ulong FreePagesCount = Region.GetFreePages();

                    Value = (long)(FreePagesCount * KMemoryManager.PageSize);

                    break;
                }
                }
            }
            else /* if (Id == 2) */
            {
                if ((ulong)SubId > 1)
                {
                    return(KernelResult.InvalidCombination);
                }

                switch (SubId)
                {
                case 0: Value = System.PrivilegedProcessLowestId;  break;

                case 1: Value = System.PrivilegedProcessHighestId; break;
                }
            }

            return(KernelResult.Success);
        }