Example #1
0
        /// <summary>
        /// Processes the multiboot header
        /// </summary>
        /// <param name="header">The header</param>
        /// <param name="magic">The magic multiboot number</param>
        private static unsafe void processMultiboot(Multiboot.Header *header, uint magic)
        {
            // We require to be booted by a multiboot compliant bootloader
            if (magic != Multiboot.Magic)
            {
                Panic.DoPanic("Not booted by a multiboot bootloader");
            }

            // Bring the header to a safe location
            fixed(Multiboot.Header *destination = &m_mbootHeader)
            {
                Memory.Memcpy(destination, header, sizeof(Multiboot.Header));
            }

            // Memory size
            m_memSize = m_mbootHeader.MemHi;

            // Check if any modules are loaded
            if ((m_mbootHeader.Flags & Multiboot.FlagMods) > 0)
            {
                uint modsCount = m_mbootHeader.ModsCount;

                Console.Write("[Multiboot] Modules: ");
                Console.WriteNum((int)modsCount);
                Console.Write('\n');

                Multiboot.Module **mods = (Multiboot.Module * *)m_mbootHeader.ModsAddr;
                for (int i = 0; i < modsCount; i++)
                {
                    Multiboot.Module *module = mods[i];

                    // Move the heap end
                    if ((uint)module->End > (uint)heapStart)
                    {
                        heapStart = module->End;
                    }
                }
            }
            else
            {
                Console.WriteLine("[Multiboot] No modules");
            }
        }
Example #2
0
        private static void mountBootPartition()
        {
            string bootDevice = BootParams.GetParam("--bootdev");
            string bootFS     = BootParams.GetParam("--boottype");

            if (bootDevice == null)
            {
                Panic.DoPanic("No bootdevice specified.");
            }

            if (bootFS == null)
            {
                Panic.DoPanic("No boot filesystem specified.");
            }

            Console.Write("[Init] Mounting bootdevice ");
            Console.Write(bootDevice);
            Console.Write(":");
            Console.Write(bootFS);
            Console.WriteLine("");

            Node hddNode = VFS.GetByAbsolutePath(bootDevice, 0);

            if (hddNode == null)
            {
                Panic.DoPanic("Bootdevice not found.");
            }

            DiskMountResult res = Disk.Mount(hddNode, "C", bootFS);

            if (res != DiskMountResult.SUCCESS)
            {
                Panic.DoPanic("Failed to mount bootdevice.");
            }


            Tasking.CurrentTask.CurrentDirectory = "C://";
        }