-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* BareMetal changes * Remove Mosa.Kernel.x64 NuSpec --------- Co-authored-by: AnErrupTion <anerruption@disroot.org>
- Loading branch information
1 parent
5dcd3f8
commit 72fb7f2
Showing
30 changed files
with
414 additions
and
828 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#!/bin/bash | ||
cd ../bin | ||
./Mosa.Tool.Launcher.Console -autostart -oMax -output-asm -output-debug -output-hash Mosa.BareMetal.HelloWorld.x86.dll | ||
./Mosa.Tool.Launcher.Console -autostart -oMax -output-asm -output-debug -output-hash Mosa.BareMetal.HelloWorld.x86.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,16 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using Mosa.UnitTests.Optimization; | ||
using Mosa.Kernel.BareMetal; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.ARMv8A32; | ||
|
||
/// <summary> | ||
/// Boot | ||
/// </summary> | ||
public static class Boot | ||
{ | ||
/// <summary> | ||
/// Main | ||
/// </summary> | ||
public static void Main() | ||
{ | ||
while (true) | ||
{ } | ||
} | ||
Debug.WriteLine("Boot::Main()"); | ||
Debug.WriteLine("MOSA ARMv8A32 Kernel"); | ||
|
||
public static bool IncludeUnitTestAssembly() | ||
{ | ||
return CommonTests.OptimizationTest1(); | ||
Program.EntryPoint(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,16 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using Mosa.Kernel.BareMetal.x64; | ||
using Mosa.Kernel.BareMetal; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.x64; | ||
|
||
/// <summary> | ||
/// Boot | ||
/// </summary> | ||
public static class Boot | ||
{ | ||
/// <summary> | ||
/// Main | ||
/// </summary> | ||
public static void Main() | ||
{ | ||
VGAText.Clear(); | ||
Debug.WriteLine("Boot::Main()"); | ||
Debug.WriteLine("MOSA x64 Kernel"); | ||
|
||
while (true) | ||
{ } | ||
Program.EntryPoint(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,193 +1,21 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
using Mosa.DeviceDriver.ISA; | ||
using Mosa.DeviceSystem; | ||
using Mosa.DeviceSystem.PCI; | ||
using Mosa.DeviceSystem.Service; | ||
using Mosa.FileSystem.FAT; | ||
using Mosa.Kernel.BareMetal; | ||
using Mosa.Kernel.BareMetal.x86; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.x86; | ||
|
||
/// <summary> | ||
/// Boot | ||
/// </summary> | ||
public static class Boot | ||
{ | ||
public static void Main() | ||
{ | ||
Debug.WriteLine("Boot::Main()"); | ||
Debug.WriteLine("MOSA x86 Kernel"); | ||
|
||
var deviceService = Mosa.Kernel.BareMetal.Kernel.ServiceManger.GetFirstService<DeviceService>(); | ||
|
||
Console.BackgroundColor = ConsoleColor.Black; | ||
Console.ForegroundColor = ConsoleColor.White; | ||
Console.Clear(); | ||
Console.Write("> Probing for ISA devices..."); | ||
|
||
var isaDevices = deviceService.GetChildrenOf(deviceService.GetFirstDevice<ISABus>()); | ||
Console.WriteLine("[Completed: " + isaDevices.Count + " found]"); | ||
|
||
foreach (var device in isaDevices) | ||
{ | ||
Console.Write(" "); | ||
Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
InBrackets(device.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.WriteLine(); | ||
} | ||
|
||
Console.Write("> Probing for PCI devices..."); | ||
var devices = deviceService.GetDevices<PCIDevice>(); | ||
Console.WriteLine("[Completed: " + devices.Count + " found]"); | ||
|
||
foreach (var device in devices) | ||
{ | ||
Console.Write(" "); | ||
Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
|
||
var pciDevice = device.DeviceDriver as PCIDevice; | ||
InBrackets(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubSystemVendorID.ToString("x") + " (" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")", ConsoleColor.White, ConsoleColor.Green); | ||
|
||
var children = deviceService.GetChildrenOf(device); | ||
|
||
if (children.Count != 0) | ||
{ | ||
var child = children[0]; | ||
|
||
Console.WriteLine(); | ||
Console.Write(" "); | ||
|
||
var pciDevice2 = child.DeviceDriver as PCIDevice; | ||
InBrackets(child.Name, ConsoleColor.White, ConsoleColor.Green); | ||
} | ||
|
||
Console.WriteLine(); | ||
} | ||
|
||
Console.Write("> Probing for disk controllers..."); | ||
var diskcontrollers = deviceService.GetDevices<IDiskControllerDevice>(); | ||
Console.WriteLine("[Completed: " + diskcontrollers.Count + " found]"); | ||
|
||
foreach (var device in diskcontrollers) | ||
{ | ||
Console.Write(" "); | ||
Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
InBrackets(device.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.WriteLine(); | ||
} | ||
|
||
Console.Write("> Probing for disks..."); | ||
var disks = deviceService.GetDevices<IDiskDevice>(); | ||
Console.WriteLine("[Completed: " + disks.Count + " found]"); | ||
|
||
foreach (var disk in disks) | ||
{ | ||
Console.Write(" "); | ||
Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
InBrackets(disk.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks + " blocks"); | ||
Console.WriteLine(); | ||
} | ||
|
||
var partitionService = Mosa.Kernel.BareMetal.Kernel.ServiceManger.GetFirstService<PartitionService>(); | ||
|
||
partitionService.CreatePartitionDevices(); | ||
|
||
Console.Write("> Finding partitions..."); | ||
var partitions = deviceService.GetDevices<IPartitionDevice>(); | ||
Console.WriteLine("[Completed: " + partitions.Count + " found]"); | ||
|
||
foreach (var partition in partitions) | ||
{ | ||
Console.Write(" "); | ||
Bullet(ConsoleColor.Yellow); | ||
Console.Write(" "); | ||
InBrackets(partition.Name, ConsoleColor.White, ConsoleColor.Green); | ||
Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount.ToString() + " blocks"); | ||
Console.WriteLine(); | ||
} | ||
|
||
//Console.Write("> Finding file systems..."); | ||
|
||
//foreach (var partition in partitions) | ||
//{ | ||
// var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice); | ||
|
||
// if (fat.IsValid) | ||
// { | ||
// Console.WriteLine("Found a FAT file system!"); | ||
|
||
// const string filename = "TEST.TXT"; | ||
|
||
// var location = fat.FindEntry(filename); | ||
|
||
// if (location.IsValid) | ||
// { | ||
// Console.Write("Found: " + filename); | ||
|
||
// var fatFileStream = new FatFileStream(fat, location); | ||
|
||
// var len = (uint)fatFileStream.Length; | ||
|
||
// Console.WriteLine(" - Length: " + len + " bytes"); | ||
|
||
// Console.Write("Reading File: "); | ||
|
||
// for (; ; ) | ||
// { | ||
// int i = fatFileStream.ReadByte(); | ||
|
||
// if (i < 0) | ||
// break; | ||
|
||
// Console.Write((char)i); | ||
// } | ||
|
||
// Console.WriteLine(); | ||
// } | ||
// } | ||
//} | ||
|
||
while (true) | ||
{ } | ||
} | ||
|
||
//[Plug("Mosa.Runtime.StartUp::BootOptions")] | ||
public static void SetBootOptions() | ||
{ | ||
BootOptions.EnableDebugOutput = true; | ||
//BootOptions.EnableVirtualMemory = true; | ||
//BootOptions.EnableMinimalBoot = true; | ||
} | ||
|
||
public static void InBrackets(string message, ConsoleColor outerColor, ConsoleColor innerColor) | ||
{ | ||
var restore = Console.ForegroundColor; | ||
Console.ForegroundColor = outerColor; | ||
Console.Write("["); | ||
Console.ForegroundColor = innerColor; | ||
Console.Write(message); | ||
Console.ForegroundColor = outerColor; | ||
Console.Write("]"); | ||
Console.ForegroundColor = restore; | ||
} | ||
|
||
public static void Bullet(ConsoleColor color) | ||
{ | ||
var restore = Console.ForegroundColor; | ||
Console.ForegroundColor = color; | ||
Console.Write("*"); | ||
Console.ForegroundColor = restore; | ||
Program.EntryPoint(); | ||
} | ||
|
||
public static void Include() | ||
{ | ||
Mosa.Kernel.BareMetal.x86.Scheduler.SwitchToThread(null); | ||
Kernel.BareMetal.x86.Scheduler.SwitchToThread(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
namespace Mosa.BareMetal.HelloWorld; | ||
|
||
public static class AppManager | ||
{ | ||
private static readonly IApp[] Applications = | ||
{ | ||
new Shell() | ||
}; | ||
|
||
public static bool Execute(string name) | ||
{ | ||
foreach (var app in Applications) | ||
if (app.Name.ToLower() == name.ToLower()) | ||
{ | ||
app.Execute(); | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
using System; | ||
|
||
namespace Mosa.BareMetal.HelloWorld.Apps; | ||
|
||
public class Shell : IApp | ||
{ | ||
public string Name => "Shell"; | ||
|
||
public void Execute() | ||
{ | ||
Console.WriteLine(); | ||
Console.WriteLine("MOSA Shell v2.4"); | ||
|
||
while (true) | ||
{ | ||
Console.Write("> "); | ||
|
||
var cmd = Console.ReadLine().ToLower(); | ||
|
||
if (!AppManager.Execute(cmd)) | ||
Console.WriteLine("Unknown command: " + cmd); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Copyright (c) MOSA Project. Licensed under the New BSD License. | ||
|
||
namespace Mosa.BareMetal.HelloWorld; | ||
|
||
public interface IApp | ||
{ | ||
string Name { get; } | ||
|
||
void Execute(); | ||
} |
Oops, something went wrong.