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); }
/// <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 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(); } ; }
private static void Setup() { IDT.SetInterruptHandler(null); Panic.Setup(); Debugger.Setup(Serial.COM1); // Initialize interrupts PIC.Setup(); IDT.Setup(); GDT.Setup(); //Runtime.Internal.Setup(); }
private static void Setup() { Logger.Log("Initialize Kernel"); IDT.SetInterruptHandler(null); Panic.Setup(); Debugger.Setup(Serial.COM2); // Initialize interrupts PIC.Setup(); IDT.Setup(); GDT.Setup(); Logger.Log("Kernel initialized"); }
/// <summary> /// Main /// </summary> public static void Main() { IDT.SetInterruptHandler(null); Panic.Setup(); Debugger.Setup(Serial.COM1); // Initialize interrupts PIC.Setup(); IDT.Setup(); GDT.Setup(); Runtime.Internal.Setup(); IDT.SetInterruptHandler(ProcessInterrupt); EnterTestReadyLoop(); }
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 unsafe void Main() { try { ManagedMemoy.InitializeGCMemory(); StartUp.InitializeAssembly(); KMath.Init(); //Mosa.Runtime.StartUp.InitializeRuntimeMetadata(); BootInfo.SetupStage1(); Memory.InitialKernelProtect(); ApiContext.Current = new ApiHost(); Assert.Setup(AssertError); // Setup some pseudo devices DeviceManager.InitStage1(); //Setup Output and Debug devices DeviceManager.InitStage2(); // Write first output KernelMessage.WriteLine("<KERNEL:CONSOLE:BEGIN>"); PerformanceCounter.Setup(BootInfo.Header->KernelBootStartCycles); KernelMessage.WriteLine("Starting Abanu Kernel..."); KernelMessage.WriteLine("KConfig.UseKernelMemoryProtection: {0}", KConfig.UseKernelMemoryProtection); KernelMessage.WriteLine("KConfig.UsePAE: {0}", KConfig.UsePAE); KernelMessage.WriteLine("Apply PageTableType: {0}", (uint)BootInfo.Header->PageTableType); KernelMessage.WriteLine("GCInitialMemory: {0:X8}-{1:X8}", Address.GCInitialMemory, Address.GCInitialMemory + Address.GCInitialMemorySize - 1); Ulongtest1(); Ulongtest2(); InlineTest(); // Detect environment (Memory Maps, Video Mode, etc.) BootInfo.SetupStage2(); KernelMemoryMapManager.Setup(); //KernelMemoryMapManager.Allocate(0x1000 * 1000, BootInfoMemoryType.PageDirectory); // Read own ELF-Headers and Sections KernelElf.Setup(); // Initialize the embedded code (actually only a little proof of concept code) NativeCalls.Setup(); //InitialKernelProtect(); PhysicalPageManager.Setup(); KernelMessage.WriteLine("Phys free: {0}", PhysicalPageManager.FreePages); PhysicalPageManager.AllocatePages(10); KernelMessage.WriteLine("Phys free: {0}", PhysicalPageManager.FreePages); VirtualPageManager.Setup(); Memory.Setup(); // Now Memory Sub System is working. At this point it's valid // to allocate memory dynamically DeviceManager.InitFrameBuffer(); // Setup Programmable Interrupt Table PIC.Setup(); // Setup Interrupt Descriptor Table // Important Note: IDT depends on GDT. Never setup IDT before GDT. IDTManager.Setup(); InitializeUserMode(); SysCallManager.Setup(); KernelMessage.WriteLine("Initialize Runtime Metadata"); StartUp.InitializeRuntimeMetadata(); KernelMessage.WriteLine("Performing some Non-Thread Tests"); Tests(); } catch (Exception ex) { Panic.Error(ex.Message); } if (KConfig.SingleThread) { StartupStage2(); } else { ProcessManager.Setup(StartupStage2); } }