コード例 #1
0
        /// <summary>
        /// Creates the process.
        /// </summary>
        /// <returns></returns>
        public static uint CreateProcess()
        {
            // TODO: Lock

            uint slot = FindEmptySlot();

            if (slot == 0)
            {
                Panic.Now(5);
            }

            CreateProcess(slot);

            // TODO: Unlock

            return(slot);
        }
コード例 #2
0
        /// <summary>
        /// Creates the task.
        /// </summary>
        /// <returns></returns>
        public static uint CreateTask(uint processid, uint eip)
        {
            // TODO: Lock

            uint slot = FindEmptySlot();

            if (slot == 0)
            {
                Panic.Now(5);
            }

            CreateTask(processid, slot, eip);

            // TODO: Unlock

            return(slot);
        }
コード例 #3
0
        /// <summary>
        /// Handle Page Faults
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        public static void Fault(uint errorCode)
        {
            uint virtualpage = Native.GetCR2();

            if (virtualpage == 0x0)
            {
                Panic.Now(2);                   // Can't map null! what happened?
            }

            // TODO: acquire lock

            uint physicalpage = PageFrameAllocator.Allocate();

            if (physicalpage == 0x0)
            {
                Panic.Now(1);                   // Panic! Out of memory
            }
            PageTable.MapVirtualAddressToPhysical(virtualpage, physicalpage);

            // TODO: release lock
        }
コード例 #4
0
        /// <summary>
        /// Handle Page Faults
        /// </summary>
        /// <param name="errorCode">The error code.</param>
        public static void Fault(uint errorCode)
        {
            uint virtualpage = Native.GetCR2();

            if (virtualpage == 0x0)
            {
                Panic.Now(2);                   // Can't map null! what happened?
            }

            //bool taken = false;
            //spinLock.Enter(ref taken);

            uint physicalpage = PageFrameAllocator.Allocate();

            if (physicalpage == 0x0)
            {
                Panic.Now(1);                   // Panic! Out of memory
            }
            PageTable.MapVirtualAddressToPhysical(virtualpage, physicalpage);

            //spinLock.Exit();
        }