From 10f917cf347e5cf5514ecd3d69ca2efc751a6b4f Mon Sep 17 00:00:00 2001 From: kudzu_cp <6d05c8c8ef5431987001abfdb2eadc9593ac9498> Date: Wed, 7 May 2008 01:01:06 +0000 Subject: [PATCH] --- .../Cosmos.Hardware/Cosmos.Hardware.csproj | 8 +- source/Cosmos/Cosmos.Hardware/Old/Hardware.cs | 11 - source/Cosmos/Cosmos.Hardware/PC/Global.cs | 2 +- .../TextScreen-Old.cs | 0 source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs | 14 +- source/Cosmos/Cosmos.Kernel.Plugs/Hardware.cs | 43 ++-- .../Old => Cosmos.Kernel}/CPU.cs | 18 +- .../Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj | 6 +- source/Cosmos/Cosmos.Kernel/Debug.cs | 240 +++++++++--------- source/Cosmos/Cosmos.Kernel/Heap.cs | 7 +- .../Commands/VersionCommand.cs | 21 -- 11 files changed, 176 insertions(+), 194 deletions(-) rename source/Cosmos/{Cosmos.Kernel => Cosmos.Hardware}/TextScreen-Old.cs (100%) rename source/Cosmos/{Cosmos.Hardware/Old => Cosmos.Kernel}/CPU.cs (53%) diff --git a/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj b/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj index a96863dc1..3efadc3e1 100644 --- a/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj +++ b/source/Cosmos/Cosmos.Hardware/Cosmos.Hardware.csproj @@ -92,7 +92,6 @@ - @@ -108,10 +107,17 @@ + + + + {A1F83D9F-2D44-4264-A08B-416797123018} + Cosmos.Kernel + + diff --git a/source/Cosmos/Cosmos.Hardware/Old/Hardware.cs b/source/Cosmos/Cosmos.Hardware/Old/Hardware.cs index de9ba8ee0..6f976f3d3 100644 --- a/source/Cosmos/Cosmos.Hardware/Old/Hardware.cs +++ b/source/Cosmos/Cosmos.Hardware/Old/Hardware.cs @@ -10,16 +10,5 @@ namespace Cosmos.Hardware { protected static byte IOReadByte(ushort aPort) { return 0; } protected static void IOWriteWord(ushort aPort, ushort aData) { } protected static ushort IOReadWord(ushort aPort) { return 0; } - /// - /// Gets the amount of RAM in MB's. - /// - /// - protected static uint GetAmountOfRAM() { - return 0; - } - - protected static uint GetEndOfKernel() { - return 0; - } } } diff --git a/source/Cosmos/Cosmos.Hardware/PC/Global.cs b/source/Cosmos/Cosmos.Hardware/PC/Global.cs index 79b79260c..e405b68e5 100644 --- a/source/Cosmos/Cosmos.Hardware/PC/Global.cs +++ b/source/Cosmos/Cosmos.Hardware/PC/Global.cs @@ -30,7 +30,7 @@ namespace Cosmos.Hardware.PC { HW.Storage.ATAOld.Initialize(Sleep); } - HW.CPU.CreateIDT(); + Cosmos.Kernel.CPU.CreateIDT(); // end old ----------------- // MTW new diff --git a/source/Cosmos/Cosmos.Kernel/TextScreen-Old.cs b/source/Cosmos/Cosmos.Hardware/TextScreen-Old.cs similarity index 100% rename from source/Cosmos/Cosmos.Kernel/TextScreen-Old.cs rename to source/Cosmos/Cosmos.Hardware/TextScreen-Old.cs diff --git a/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs b/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs index 5a48058fb..4aa8c051c 100644 --- a/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs +++ b/source/Cosmos/Cosmos.Kernel.Plugs/CPU.cs @@ -5,13 +5,23 @@ using Indy.IL2CPU.Plugs; using HW = Cosmos.Hardware; namespace Cosmos.Kernel.Plugs { - [Plug(Target = typeof(HW.CPU))] + [Plug(Target = typeof(Kernel.CPU))] public static class CPU { [PlugMethod(MethodAssembler = typeof(Assemblers.CreateIDT))] public static void CreateIDT() { } - [PlugMethod(MethodAssembler = typeof(Assemblers.ZeroFill))] + [PlugMethod(MethodAssembler = typeof(Assemblers.GetAmountOfRAM))] + public static uint GetAmountOfRAM() { + return 0; + } + + [PlugMethod(MethodAssembler = typeof(Assemblers.GetEndOfKernel))] + public static uint GetEndOfKernel() { + return 0; + } + + [PlugMethod(MethodAssembler = typeof(Assemblers.ZeroFill))] // TODO: implement this using REP STOSB and REPO STOSD public static unsafe void ZeroFill(uint aStartAddress, uint aLength) { Console.Write("Clearing "); diff --git a/source/Cosmos/Cosmos.Kernel.Plugs/Hardware.cs b/source/Cosmos/Cosmos.Kernel.Plugs/Hardware.cs index e9caa2421..6019adf19 100644 --- a/source/Cosmos/Cosmos.Kernel.Plugs/Hardware.cs +++ b/source/Cosmos/Cosmos.Kernel.Plugs/Hardware.cs @@ -5,31 +5,22 @@ using Indy.IL2CPU.Plugs; using HW = Cosmos.Hardware; namespace Cosmos.Kernel.Plugs.Other { - [Plug(Target = typeof(HW.Hardware))] - public static class Hardware { - [PlugMethod(MethodAssembler = typeof(Assemblers.IOWrite8))] - public static void IOWriteByte(ushort aPort, byte aData) { - } - [PlugMethod(MethodAssembler = typeof(Assemblers.IORead8))] - public static byte IOReadByte(ushort aPort) { - return 0; - } - [PlugMethod(MethodAssembler = typeof(Assemblers.IOWrite16))] - public static void IOWriteWord(ushort aPort, ushort aData) { - } - [PlugMethod(MethodAssembler = typeof(Assemblers.IORead16))] - public static ushort IOReadWord(ushort aPort) { - return 0; - } + [Plug(Target = typeof(HW.Hardware))] + public static class Hardware { + [PlugMethod(MethodAssembler = typeof(Assemblers.IOWrite8))] + public static void IOWriteByte(ushort aPort, byte aData) { + } + [PlugMethod(MethodAssembler = typeof(Assemblers.IORead8))] + public static byte IOReadByte(ushort aPort) { + return 0; + } + [PlugMethod(MethodAssembler = typeof(Assemblers.IOWrite16))] + public static void IOWriteWord(ushort aPort, ushort aData) { + } + [PlugMethod(MethodAssembler = typeof(Assemblers.IORead16))] + public static ushort IOReadWord(ushort aPort) { + return 0; + } - [PlugMethod(MethodAssembler = typeof(Assemblers.GetAmountOfRAM))] - public static uint GetAmountOfRAM() { - return 0; - } - - [PlugMethod(MethodAssembler = typeof(Assemblers.GetEndOfKernel))] - public static uint GetEndOfKernel() { - return 0; - } - } + } } diff --git a/source/Cosmos/Cosmos.Hardware/Old/CPU.cs b/source/Cosmos/Cosmos.Kernel/CPU.cs similarity index 53% rename from source/Cosmos/Cosmos.Hardware/Old/CPU.cs rename to source/Cosmos/Cosmos.Kernel/CPU.cs index a355488aa..acc30d789 100644 --- a/source/Cosmos/Cosmos.Hardware/Old/CPU.cs +++ b/source/Cosmos/Cosmos.Kernel/CPU.cs @@ -2,12 +2,24 @@ using System.Collections.Generic; using System.Text; -namespace Cosmos.Hardware { - public class CPU: Hardware { +namespace Cosmos.Kernel { + public class CPU { // Plugged public static void CreateIDT() { } - public static uint AmountOfMemory { + /// + /// Gets the amount of RAM in MB's. + /// + /// + protected static uint GetAmountOfRAM() { + return 0; + } + + protected static uint GetEndOfKernel() { + return 0; + } + + public static uint AmountOfMemory { get { return GetAmountOfRAM(); } diff --git a/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj b/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj index 77f73b44b..3b7aacb15 100644 --- a/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj +++ b/source/Cosmos/Cosmos.Kernel/Cosmos.Kernel.csproj @@ -48,19 +48,15 @@ - {E9B2E8CC-E264-42F9-9113-16B0A0431198} Indy.IL2CPU.Plugs - - {CE50FE98-9AC4-4B4D-ADC7-31F6DCD28755} - Cosmos.Hardware - + diff --git a/source/Cosmos/Cosmos.Kernel/Debug.cs b/source/Cosmos/Cosmos.Kernel/Debug.cs index 26c533a45..6f3cd6db7 100644 --- a/source/Cosmos/Cosmos.Kernel/Debug.cs +++ b/source/Cosmos/Cosmos.Kernel/Debug.cs @@ -2,150 +2,150 @@ namespace Cosmos.Kernel { public static class DebugUtil { public static void Initialize() { - Hardware.DebugUtil.Initialize(); + //Hardware.DebugUtil.Initialize(); } private static void StartLogging() { - Hardware.DebugUtil.StartLogging(); + //Hardware.DebugUtil.StartLogging(); } private static void EndLogging() { - Hardware.DebugUtil.EndLogging(); + //Hardware.DebugUtil.EndLogging(); } public static void SendNumber(string aModule, string aDescription, uint aNumber, byte aBits) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendTestCase(string testcase) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendTestAssert(bool condition, string message) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //Hardware.DebugUtil.WriteSerialString("\"/>\r\n"); + //EndLogging(); } public static void SendDoubleNumber(string aModule, string aDescription, uint aNumber, byte aBits, uint aNumber2, byte aBits2) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendMessage(string aModule, string aData) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendKeyboardEvent(uint aScanCode, bool aReleased) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendError(string aModule, string aData) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendError(string aModule, string aDescription, uint aData, byte aBits) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendWarning(string aModule, string aData) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendMM_Alloc(uint aStartAddr, uint aLength) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendMM_Init(uint aStartAddr, uint aLength) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } public static void SendMM_Free(uint aStartAddr, uint aLength) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); - EndLogging(); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); + //EndLogging(); } //internal static void SendExt2_GroupDescriptor(string aDescription, uint aBlock, int aIndex, uint aAddresss, FileSystem.Ext2.GroupDescriptor aDescriptor) { @@ -743,29 +743,29 @@ namespace Cosmos.Kernel { //} internal static void SendByteStream(string aModule, string aDescription, byte[] aContents) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); } internal static unsafe void SendBytes(string aModule, string aDescription, byte* aContents, uint aIndex, uint aCount) { - StartLogging(); - Hardware.DebugUtil.WriteSerialString("\r\n"); + //StartLogging(); + //Hardware.DebugUtil.WriteSerialString("\r\n"); } } } \ No newline at end of file diff --git a/source/Cosmos/Cosmos.Kernel/Heap.cs b/source/Cosmos/Cosmos.Kernel/Heap.cs index c0214a5b9..fe9d4e568 100644 --- a/source/Cosmos/Cosmos.Kernel/Heap.cs +++ b/source/Cosmos/Cosmos.Kernel/Heap.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text; -using Cosmos.Hardware; using Indy.IL2CPU.Plugs; namespace Cosmos.Kernel { @@ -26,7 +25,7 @@ namespace Cosmos.Kernel { private static void ClearMemory(uint aStartAddress, uint aLength) { //int xStart = (RTC.GetMinutes() * 60) + RTC.GetSeconds(); - Hardware.CPU.ZeroFill(aStartAddress, aLength); + CPU.ZeroFill(aStartAddress, aLength); //int xEnd = (RTC.GetMinutes() * 60) + RTC.GetSeconds(); //int xDiff = xEnd - xStart; //Console.Write("Time to clear "); @@ -63,7 +62,7 @@ namespace Cosmos.Kernel { public static void CheckInit() { if (!mInited) { mInited = true; - Initialize(Hardware.CPU.EndOfKernel, (Hardware.CPU.AmountOfMemory * 1024 * 1024) - 1024); + Initialize(CPU.EndOfKernel, (CPU.AmountOfMemory * 1024 * 1024) - 1024); } } @@ -73,7 +72,7 @@ namespace Cosmos.Kernel { if ((xTemp + aLength) > (mStart + mLength)) { Console.WriteLine("Too large memory block allocated!"); Console.Write(" BlockSize = "); - Hardware.Storage.ATAOld.WriteNumber(aLength, 32); + //Hardware.Storage.ATAOld.WriteNumber(aLength, 32); Console.WriteLine(""); System.Diagnostics.Debugger.Break(); } diff --git a/source/Cosmos/Cosmos.Shell.Console/Commands/VersionCommand.cs b/source/Cosmos/Cosmos.Shell.Console/Commands/VersionCommand.cs index 2c2ab8375..8344d2666 100644 --- a/source/Cosmos/Cosmos.Shell.Console/Commands/VersionCommand.cs +++ b/source/Cosmos/Cosmos.Shell.Console/Commands/VersionCommand.cs @@ -24,31 +24,10 @@ namespace Cosmos.Shell.Console.Commands { DisplayVersion(); } - else if (param.CompareTo("dev") == 0) - { - DisplayDevelopers(); - } else Help(); } - private void DisplayDevelopers() - { - Hardware.DebugUtil.SendMessage("Version", "Starting Developers list"); - Hardware.DebugUtil.SendNumber("Version.Developers", "StackPointer", Hardware.CPU.GetCurrentESP(), 32); - System.Console.ForegroundColor = ConsoleColor.Red; - System.Console.WriteLine("Cosmos Developers"); - System.Console.WriteLine("~~~~~~~~~~~~~~~~~"); - System.Console.ForegroundColor = ConsoleColor.White; - - System.Console.WriteLine("Chad Z. Hower"); - System.Console.WriteLine("Matthijs ter Woord"); - System.Console.WriteLine("Jonathan Dickinson"); - System.Console.WriteLine("Scott Balmos"); - System.Console.WriteLine(""); - Hardware.DebugUtil.SendMessage("Version", "End of Developers list"); - } - private void DisplayVersion() { System.Console.ForegroundColor = ConsoleColor.Red;