internal system_node(rootfs device, string name, List <lib.File.Property> props) : base(device, name) { Props = props; }
static void SetupThread() { /* Build a list of available modules */ Formatter.Write("Building module list... ", arch.DebugOutput); List <tysos.lib.File.Property> mods = new List <tysos.lib.File.Property>(); foreach (Multiboot.Module mod in mboot_header.modules) { if (mod.length != 0) { ulong vaddr = map_in(mod); mods.Add(new tysos.lib.File.Property { Name = mod.name, Value = new VirtualMemoryResource64(vaddr, mod.length) }); Formatter.Write(mod.name, arch.DebugOutput); Formatter.Write(", ", arch.DebugOutput); } } List <tysos.lib.File.Property> modfs_props = new List <lib.File.Property>(); modfs_props.Add(new lib.File.Property { Name = "driver", Value = "modfs" }); modfs_props.Add(new lib.File.Property { Name = "mods", Value = mods }); Formatter.WriteLine("done", arch.DebugOutput); /* Load and mount the root fs */ List <lib.File.Property> system_props = arch.SystemProperties; List <Resources.InterruptLine> interrupts = new List <Resources.InterruptLine>(); // TODO: add interrupts for all cpus interrupts.AddRange(arch.CurrentCpu.Interrupts); system_props.Add(new lib.File.Property { Name = "interrupts", Value = interrupts }); List <rootfs.rootfs_item> rootfs_items = new List <rootfs.rootfs_item> { new rootfs.rootfs_item { Name = "system", Props = system_props }, new rootfs.rootfs_item { Name = "modules", Props = modfs_props } }; /* Add a basic framebuffer device if set up by bootloader */ if (mboot_header.fb_base != 0) { List <lib.File.Property> fb_props = new List <lib.File.Property>(); fb_props.Add(new lib.File.Property { Name = "driver", Value = "framebuffer" }); ulong fb_length = mboot_header.fb_stride * mboot_header.fb_h * mboot_header.fb_bpp / 8; if ((fb_length & 0xfffUL) != 0) { fb_length += 0x1000UL; fb_length &= ~0xfffUL; } fb_props.Add(new lib.File.Property { Name = "pmem", Value = new PhysicalMemoryResource64(mboot_header.fb_base, fb_length) }); fb_props.Add(new lib.File.Property { Name = "height", Value = mboot_header.fb_h }); fb_props.Add(new lib.File.Property { Name = "width", Value = mboot_header.fb_w }); fb_props.Add(new lib.File.Property { Name = "stride", Value = mboot_header.fb_stride }); fb_props.Add(new lib.File.Property { Name = "bpp", Value = mboot_header.fb_bpp }); fb_props.Add(new lib.File.Property { Name = "pformat", Value = (int)mboot_header.fb_pixelformat }); fb_props.Add(new lib.File.Property { Name = "vmem", Value = new VirtualMemoryResource64(arch.VirtualRegions.Alloc(fb_length, 0x1000, "framebuffer"), fb_length) }); rootfs_items.Add(new rootfs.rootfs_item { Name = "framebuffer", Props = fb_props }); } rootfs rootfs = new rootfs(rootfs_items); Process rootfs_p = Process.CreateProcess("rootfs", new System.Threading.ThreadStart(rootfs.MessageLoop), new object[] { rootfs }); rootfs_p.Start(); //ServerObject.InvokeRemoteAsync(vfs, "Mount", new object[] { "/", rootfs }, // new Type[] { typeof(string), typeof(ServerObject) }); while (Vfs == null) { ; } Vfs.Mount("/", rootfs); Vfs.Mount("/modules"); Vfs.Mount("/system"); Vfs.Mount("/system/pci_hostbridge_0"); Vfs.Mount("/system/pci_hostbridge_0/pcnet32_0"); /* Load the modfs driver */ Process modfs = LoadELFModule("modfs", mboot_header, stab, running_processes, 0x8000, new object[] { }); modfs.Start(); }