/// <summary> /// Initialize the Machine /// </summary> public static void Setup() { Multiboot.Setup(); PIC.Setup(); IDT.Setup(); PageFrameAllocator.Setup(); PageTable.Setup(); VirtualPageAllocator.Setup(); GC.Setup(); Scheduler.Setup(); Serial.SetupPort(Serial.COM1); var _hal = new Hardware(); if (VBEDisplay.InitVBE(_hal)) { ScreenManager.Setup(); ScreenManager.Add(new BootScreen()); ScreenManager.Add(new TestScreen()); ScreenManager.ChangeScreen(ScreenIds.Boot); } Native.Hlt(); }
public static void EntryPoint() { // TODO: Get EAX and EBX Multiboot.Setup(IntPtr.Zero, 0); // TODO: SSE }
public static void Setup() { Screen.Clear(); Screen.Color = 0x0E; Screen.SetCursor(24, 0); Screen.Write('1'); Multiboot.Setup(); Screen.SetCursor(24, 1); Screen.Write('2'); PIC.Setup(); Screen.SetCursor(24, 2); Screen.Write('3'); GDT.Setup(); Screen.SetCursor(24, 3); Screen.Write('4'); IDT.Setup(); Screen.SetCursor(24, 4); Screen.Write('5'); PageFrameAllocator.Setup(); Screen.SetCursor(24, 5); Screen.Write('6'); PageTable.Setup(); Screen.SetCursor(24, 6); Screen.Write('7'); VirtualPageAllocator.Setup(); Screen.SetCursor(24, 7); Screen.Write('8'); Screen.SetCursor(24, 8); ProcessManager.Setup(); Screen.Write('9'); Screen.SetCursor(24, 9); TaskManager.Setup(); Screen.Write('A'); Screen.SetCursor(24, 10); }
public static void EntryPoint() { var eax = Native.GetMultibootEAX(); var ebx = Native.GetMultibootEBX(); Multiboot.Setup(new Pointer(eax), ebx); SSE.Setup(); }
public static unsafe void Start(uint magic, uint address) { /* Setup Multiboot */ Multiboot.Setup(magic, address); /* Placement Address */ Heap.PlacementAddress = Native.EndOfKernel(); /* Clear Interrupts */ Native.ClearInterrupt(); /* Setup PIC */ PIC.Setup(); /* Setup GDT & Enter into protected mode */ GDT.Setup(); /* Setup IDT */ IDT.Setup(); /* Enable Interrupts */ Native.SetInterrupt(); /* Setup Paging */ Paging.Setup(Multiboot.RAM); /* Setup Multitasking */ Multitasking.CreateTask(0, true); //This is System Update thread Multitasking.Init(); //Start Multitasking /* Call our kernel instance now */ try { Caller.Start(); while (true) { Caller.Update(); } } catch (Exception e) { //Kernel PANIC !! Console.WriteLine(e.Message); } while (true) //Set CPU in Infinite loop DON'T REMOVE THIS ELSE I'll KILL YOU (^ . ^) { Native.ClearInterrupt(); Native.Halt(); } ; }
public static void Start() { Screen.Color = 0x0; Screen.Clear(); Screen.GotoTop(); Screen.Color = 0x0E; Screen.Write('M'); Screen.Write('O'); Screen.Write('S'); Screen.Write('A'); Screen.Write(' '); Screen.Write('O'); Screen.Write('S'); Screen.Write("!"); Screen.Write(" "); DebugClient.Setup(Serial.COM1); Screen.Write('0'); IDT.SetInterruptHandler(null); Screen.Write('1'); Multiboot.Setup(); Screen.Write('2'); PIC.Setup(); Screen.Write('3'); GDT.Setup(); Screen.Write('4'); IDT.Setup(); Screen.Write('5'); PageFrameAllocator.Setup(); Screen.Write('6'); PageTable.Setup(); Screen.Write('7'); VirtualPageAllocator.Setup(); Screen.Write('8'); ProcessManager.Setup(); Screen.Write('9'); GC.Setup(); Screen.Write('0'); //Runtime.Setup(); Screen.Write('A'); TaskManager.Setup(); Screen.Write('B'); IDT.SetInterruptHandler(ProcessInterrupt); Screen.Write('C'); ConsoleManager.Setup(); Screen.Write('D'); Console = ConsoleManager.Controller.Boot; Screen.Write('E'); Screen.Write('F'); Console.Color = 0x0E; Console.BackgroundColor = 1; Console.WriteLine(); Console.WriteLine(); Console.Write("!MOSA is alive!"); Console.WriteLine(); KernelTest.RunTests(); Console.WriteLine(); DumpStackTrace(); //System.Threading.SpinLock splk = new System.Threading.SpinLock(); //bool lockTaken = false; //splk.Enter(ref lockTaken); //if (splk.IsHeld) // Console.Write("Entered..."); //lockTaken = false; //splk.Enter(ref lockTaken); //Console.Write("Should have looped!!!"); Console.Goto(22, 0); Process(); }
public static void Main() { Screen.Clear(); Screen.BackgroundColor = ScreenColor.Blue; Screen.Color = ScreenColor.Yellow; Screen.Write('M'); Screen.Write('O'); Screen.Write('S'); Screen.Write('A'); Screen.Write(' '); Screen.Write('O'); Screen.Write('S'); Screen.Write("!"); Screen.Write(" "); Multiboot.Setup(); Screen.Write('0'); GDT.Setup(); Screen.Write('1'); IDT.SetInterruptHandler(null); Screen.Write('2'); Debugger.Setup(Serial.COM1); Screen.Write('3'); PIC.Setup(); Screen.Write('4'); IDT.Setup(); Screen.Write('5'); PageFrameAllocator.Setup(); Screen.Write('6'); PageTable.Setup(); Screen.Write('7'); VirtualPageAllocator.Setup(); Screen.Write('8'); GC.Setup(); Screen.Write('9'); Scheduler.Setup(); Screen.Write('B'); IDT.SetInterruptHandler(ProcessInterrupt); Screen.Write('C'); ConsoleManager.Setup(); Screen.Write('D'); Screen.Write('E'); Screen.WriteLine(); Screen.WriteLine(); KernelTest.RunTests(); StackTrace(); StartThreadTest(); // should never get here Screen.Write("!BAD!"); while (true) { Native.Hlt(); } }
public static void Main() { Screen.Clear(); Screen.BackgroundColor = ScreenColor.Blue; Screen.Color = ScreenColor.Yellow; Screen.Write('M'); Screen.Write('O'); Screen.Write('S'); Screen.Write('A'); Screen.Write(' '); Screen.Write('O'); Screen.Write('S'); Screen.Write("!"); Screen.Write(" "); Multiboot.Setup(); Screen.Write('0'); GDT.Setup(); Screen.Write('1'); IDT.SetInterruptHandler(null); Screen.Write('2'); Debugger.Setup(Serial.COM1); Screen.Write('3'); PIC.Setup(); Screen.Write('4'); IDT.Setup(); Screen.Write('5'); PageFrameAllocator.Setup(); Screen.Write('6'); PageTable.Setup(); Screen.Write('7'); VirtualPageAllocator.Setup(); Screen.Write('8'); GC.Setup(); Screen.Write('9'); Scheduler.Setup(); Screen.Write('B'); IDT.SetInterruptHandler(ProcessInterrupt); Screen.Write('C'); ConsoleManager.Setup(); Screen.Write('D'); Screen.Write('E'); Screen.WriteLine(); Screen.WriteLine(); //Screen.Write("CompilerBugTests: "); //bool value1 = Test1(); //if (value1) // Screen.WriteLine("Ok"); //else // Screen.WriteLine("Failed"); //Screen.Write("FindTypeOfTest: "); //bool value3 = Test3(); //if (value3) // Screen.WriteLine("Ok"); //else // Screen.WriteLine("Failed"); //UnitTest(); KernelTest.RunTests(); StackTrace(); TestHash(); int value2 = CallReturn10(); Screen.Write("Return10 Test: "); if (value2 == 10) { Screen.WriteLine("Ok"); } else { Screen.WriteLine("Failed"); } StartThreadTest(); // should never get here Screen.Write("!BAD!"); while (true) { Native.Hlt(); } }
internal static void Start(uint magic, uint address, uint KernelDirectory, uint InitialHeap) { /* Kernel Logger init */ Debug.Init(); /* Initalize Heap */ Heap.Init(InitialHeap); /* Multiboot Info Parsing */ Multiboot.Setup(magic, address); /* Setup Paging */ Paging.Setup(KernelDirectory); /* Setup GDT */ GDT.Setup(); /* Remap PIC */ PIC.Setup(); /* Setup IDT */ IDT.Setup(); /* Enable Interrupt */ Native.Sti(); /* Setup Scheduler */ Scheduler.Init(KernelDirectory); /* Setup System Timer */ Timer.Setup(); /* Install SHM */ SHM.Install(); /* Initialise VBE 2.0 Driver */ VBE.Init(); /* Initialise Virtual File system */ VirtualFileSystem.Setup(); /* Setup Syscall */ Syscall.Setup(); /* Initialise C library */ Libc.Init(); try { Boot.Init(); } catch (Exception e) { Debug.Write("[@SystemThread] => [EXIT]: %s\n", e.Message); } while (true) { ; } }
public static void Main() { //Screen.BackgroundColor = ScreenColor.Green; //Screen.Color = ScreenColor.Red; //Screen.Clear(); //Screen.Goto(0, 0); //Screen.Write('A'); //Serial.SetupPort(Serial.COM1); //Serial.Write(Serial.COM1, "Hello"); BootMemory.Setup(); // Setup Kernel Log var kmsgHandler = new KernelMessageWriter(); KernelMessage.SetHandler(kmsgHandler); KernelMessage.WriteLine("<LOADER:CONSOLE:BEGIN>"); // Parse Boot Informations Multiboot.Setup(); // Parse Kernel ELF section SetupOriginalKernelElf(); // Print all section of Kernel ELF (for information only) DumpElfInfo(); // Copy Section to a final destination SetupKernelSection(); // Collection informations we need to pass to the kernel BootInfo_.Setup(); // Setup Global Descriptor Table var map = BootMemory.AllocateMemoryMap(0x1000, BootInfoMemoryType.GDT); BootInfo_.AddMap(map); GDT.Setup(map.Start); // Now we enable Paging. It's important that we do not cause a Page Fault Exception, // Because IDT is not setup yet, that could handle this kind of exception. map = BootMemory.AllocateMemoryMap(PageTable.InitalPageDirectorySize, BootInfoMemoryType.PageDirectory); BootInfo_.AddMap(map); var map2 = BootMemory.AllocateMemoryMap(PageTable.InitalPageTableSize, BootInfoMemoryType.PageTable); BootInfo_.AddMap(map2); PageTable.Setup(map.Start, map2.Start); // Because Kernel is compiled in virtual address space, we need to remap the pages MapKernelImage(); // Get Entry Point of Kernel uint kernelEntry = GetKernelStartAddr(); if (kernelEntry == 0) { KernelMessage.WriteLine("No kernel entry point found {0:X8}"); KernelMessage.WriteLine("Is the name of entry point correct?"); KernelMessage.WriteLine("Are symbols emitted?"); KernelMessage.WriteLine("System halt!"); while (true) { Native.Nop(); } } KernelMessage.WriteLine("Call Kernel Start at {0:X8}", kernelEntry); // Start Kernel. CallAddress(kernelEntry); // If we hit this code location, the Kernel Main method returned. // This would be a general fault. Normally, this code section will overwritten // by the kernel, so normally, it can never reach this code position. KernelMessage.WriteLine("Unexpected return from Kernel Start"); Debug.Break(); }