diff --git a/Users/Sentinel209/SentinelKernel/Kernel.cs b/Users/Sentinel209/SentinelKernel/Kernel.cs index cae472e54..067188279 100644 --- a/Users/Sentinel209/SentinelKernel/Kernel.cs +++ b/Users/Sentinel209/SentinelKernel/Kernel.cs @@ -12,7 +12,7 @@ namespace SentinelKernel protected override void BeforeRun() { Console.WriteLine("Cosmos booted successfully."); - VFSManager.RegisterVFS(new System.FileSystem.VFS.SentinelVFS()); + VFSManager.RegisterVFS(new System.FileSystem.VFS.SentinelVFS()); } protected override void Run() diff --git a/Users/Sentinel209/SentinelKernel/SentinelKernelBoot.Cosmos b/Users/Sentinel209/SentinelKernel/SentinelKernelBoot.Cosmos index 7813de32a..7bbb60be0 100644 --- a/Users/Sentinel209/SentinelKernel/SentinelKernelBoot.Cosmos +++ b/Users/Sentinel209/SentinelKernel/SentinelKernelBoot.Cosmos @@ -18,8 +18,8 @@ - True - Source + False + IL User False False @@ -35,9 +35,9 @@ Use VMware Player or Workstation to deploy and debug. ISO VMware - True + False True - Source + IL Pipe: Cosmos\Serial Workstation bin\Debug\ diff --git a/Users/Sentinel209/SentinelSystemLib/System/IO/PathImpl.cs b/Users/Sentinel209/SentinelSystemLib/System/IO/PathImpl.cs index c8f11e2d3..0b664ef43 100644 --- a/Users/Sentinel209/SentinelSystemLib/System/IO/PathImpl.cs +++ b/Users/Sentinel209/SentinelSystemLib/System/IO/PathImpl.cs @@ -19,9 +19,6 @@ namespace SentinelKernel.System.Plugs.System.IO /// public static string GetDirectoryName(string aPath) { - return ""; - - /* if (aPath == null || aPath.Length <= 1) { return "/"; @@ -32,7 +29,6 @@ namespace SentinelKernel.System.Plugs.System.IO return aPath; } return aPath.Substring(0, xIndex); - */ } public static void Cctor( diff --git a/source/Cosmos.HAL/Global.cs b/source/Cosmos.HAL/Global.cs index 415420722..17e867d5b 100644 --- a/source/Cosmos.HAL/Global.cs +++ b/source/Cosmos.HAL/Global.cs @@ -72,11 +72,11 @@ namespace Cosmos.HAL { // Find hardcoded ATA controllers Global.Dbg.Send("ATA Master"); - InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Slave); - - Global.Dbg.Send("ATA Slave"); InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Master); + //Global.Dbg.Send("ATA Slave"); + //InitAta(BlockDevice.Ata.ControllerIdEnum.Primary, BlockDevice.Ata.BusPositionEnum.Slave); + //TODO Need to change code to detect if ATA controllers are present or not. How to do this? via PCI enum? // They do show up in PCI space as well as the fixed space. // Or is it always here, and was our compiler stack corruption issue? diff --git a/source/Cosmos.IL2CPU/VTablesImpl.cs b/source/Cosmos.IL2CPU/VTablesImpl.cs index 575a4fc8f..8ff195eff 100644 --- a/source/Cosmos.IL2CPU/VTablesImpl.cs +++ b/source/Cosmos.IL2CPU/VTablesImpl.cs @@ -6,32 +6,32 @@ using System.Runtime.InteropServices; namespace Cosmos.IL2CPU { // todo: optimize this, probably using assembler - public static class VTablesImpl { - // this field seems to be always empty, but the VTablesImpl class is embedded in the final exe. - public static VTable[] mTypes; - public static bool IsInstance(int aObjectType, int aDesiredObjectType) { - int xCurrentType = aObjectType; - if (aObjectType == 0) { - return true; - } - do { - if (xCurrentType == aDesiredObjectType) { - return true; - } - if (xCurrentType == mTypes[xCurrentType].BaseTypeIdentifier) { - return false; - } - xCurrentType = mTypes[xCurrentType].BaseTypeIdentifier; - } while (xCurrentType != 0); - return false; - } + public static class VTablesImpl { + // this field seems to be always empty, but the VTablesImpl class is embedded in the final exe. + public static VTable[] mTypes; + public static bool IsInstance(int aObjectType, int aDesiredObjectType) { + int xCurrentType = aObjectType; + if (aObjectType == 0) { + return true; + } + do { + if (xCurrentType == aDesiredObjectType) { + return true; + } + if (xCurrentType == mTypes[xCurrentType].BaseTypeIdentifier) { + return false; + } + xCurrentType = mTypes[xCurrentType].BaseTypeIdentifier; + } while (xCurrentType != 0); + return false; + } - public static void LoadTypeTable(int aTypeCount) { - mTypes = new VTable[aTypeCount]; + public static void LoadTypeTable(int aTypeCount) { + mTypes = new VTable[aTypeCount]; if (mTypes == null) { Console.WriteLine("No array exists!"); } - } + } public static void SetTypeInfo(int aType, int aBaseType, int[] aMethodIndexes, int[] aMethodAddresses, int aMethodCount) { //mTypes[aType] = new VTable(); @@ -41,113 +41,117 @@ namespace Cosmos.IL2CPU { mTypes[aType].MethodCount = aMethodCount; } - public static void SetMethodInfo(int aType, int aMethodIndex, int aMethodIdentifier, int aMethodAddress, char[] aName) { - mTypes[aType].MethodIndexes[aMethodIndex] = aMethodIdentifier; - mTypes[aType].MethodAddresses[aMethodIndex] = aMethodAddress; + public static void SetMethodInfo(int aType, int aMethodIndex, int aMethodIdentifier, int aMethodAddress, char[] aName) { + mTypes[aType].MethodIndexes[aMethodIndex] = aMethodIdentifier; + mTypes[aType].MethodAddresses[aMethodIndex] = aMethodAddress; mTypes[aType].MethodCount = aMethodIndex + 1; - } + } - private static void WriteNumber(uint aValue, byte aBitCount) { - uint xValue = aValue; - byte xCurrentBits = aBitCount; - Console.Write("0x"); - while (xCurrentBits >= 4) { - xCurrentBits -= 4; - byte xCurrentDigit = (byte)((xValue >> xCurrentBits) & 0xF); - string xDigitString = null; - switch (xCurrentDigit) { - case 0: - xDigitString = "0"; - goto default; - case 1: - xDigitString = "1"; - goto default; - case 2: - xDigitString = "2"; - goto default; - case 3: - xDigitString = "3"; - goto default; - case 4: - xDigitString = "4"; - goto default; - case 5: - xDigitString = "5"; - goto default; - case 6: - xDigitString = "6"; - goto default; - case 7: - xDigitString = "7"; - goto default; - case 8: - xDigitString = "8"; - goto default; - case 9: - xDigitString = "9"; - goto default; - case 10: - xDigitString = "A"; - goto default; - case 11: - xDigitString = "B"; - goto default; - case 12: - xDigitString = "C"; - goto default; - case 13: - xDigitString = "D"; - goto default; - case 14: - xDigitString = "E"; - goto default; - case 15: - xDigitString = "F"; - goto default; - default: - Console.Write(xDigitString); - break; - } - } - } + private static void WriteNumber(uint aValue, byte aBitCount) { + uint xValue = aValue; + byte xCurrentBits = aBitCount; + Console.Write("0x"); + while (xCurrentBits >= 4) { + xCurrentBits -= 4; + byte xCurrentDigit = (byte)((xValue >> xCurrentBits) & 0xF); + string xDigitString = null; + switch (xCurrentDigit) { + case 0: + xDigitString = "0"; + goto default; + case 1: + xDigitString = "1"; + goto default; + case 2: + xDigitString = "2"; + goto default; + case 3: + xDigitString = "3"; + goto default; + case 4: + xDigitString = "4"; + goto default; + case 5: + xDigitString = "5"; + goto default; + case 6: + xDigitString = "6"; + goto default; + case 7: + xDigitString = "7"; + goto default; + case 8: + xDigitString = "8"; + goto default; + case 9: + xDigitString = "9"; + goto default; + case 10: + xDigitString = "A"; + goto default; + case 11: + xDigitString = "B"; + goto default; + case 12: + xDigitString = "C"; + goto default; + case 13: + xDigitString = "D"; + goto default; + case 14: + xDigitString = "E"; + goto default; + case 15: + xDigitString = "F"; + goto default; + default: + Console.Write(xDigitString); + break; + } + } + } - public static int GetMethodAddressForType(int aType, int aMethodIndex) { - do { - if (mTypes[aType].MethodIndexes == null) { - Console.Write("Type "); - WriteNumber((uint)aType, 32); - Console.WriteLine(", MethodIndexes is null!"); - while(true) ; - } - for (int i = 0; i < mTypes[aType].MethodIndexes.Length; i++) { - if (mTypes[aType].MethodAddresses == null) { - Console.Write("Type "); - WriteNumber((uint)aType, 32); - Console.WriteLine(", MethodAddresses is null!"); - while(true) ; - } - if (mTypes[aType].MethodIndexes[i] == aMethodIndex) { - var xResult = mTypes[aType].MethodAddresses[i]; - if (xResult < 1048576) // if pointer is under 1MB, some issue exists! - { - Console.Write("Type "); - WriteNumber((uint)aType, 32); - Console.Write(", MethodIndex = "); - WriteNumber((uint)aMethodIndex, 32); - Console.WriteLine(""); - Console.WriteLine("Method found, but address invalid!"); - while(true) ; - } - return xResult; - } - } + public static int GetMethodAddressForType(int aType, int aMethodIndex) { + do { + if (mTypes[aType].MethodIndexes == null) { + Console.Write("Type "); + WriteNumber((uint)aType, 32); + Console.WriteLine(", MethodIndexes is null!"); + while(true) ; + } + for (int i = 0; i < mTypes[aType].MethodIndexes.Length; i++) { + if (mTypes[aType].MethodAddresses == null) { + Console.Write("Type "); + WriteNumber((uint)aType, 32); + Console.WriteLine(", MethodAddresses is null!"); + while(true) ; + } + if (mTypes[aType].MethodIndexes[i] == aMethodIndex) { + var xResult = mTypes[aType].MethodAddresses[i]; + if (xResult < 1048576) // if pointer is under 1MB, some issue exists! + { + Console.Write("Type "); + WriteNumber((uint)aType, 32); + Console.Write(", MethodIndex = "); + WriteNumber((uint)aMethodIndex, 32); + Console.Write(", Result "); + WriteNumber((uint)xResult, 32); + Console.Write(", i "); + WriteNumber((uint)i, 32); + Console.WriteLine(""); + Console.WriteLine("Method found, but address invalid!"); + while(true) ; + } + return xResult; + } + } if (aType == mTypes[aType].BaseTypeIdentifier) { break; } - aType = mTypes[aType].BaseTypeIdentifier; - } while (true); - //} + aType = mTypes[aType].BaseTypeIdentifier; + } while (true); + //} Console.Write("Type "); WriteNumber((uint)aType, 32); Console.Write(", MethodIndex = "); @@ -156,18 +160,18 @@ namespace Cosmos.IL2CPU { Console.WriteLine("Not FOUND!"); while (true) ; - throw new Exception("Cannot find virtual method!"); - } - } - [StructLayout(LayoutKind.Explicit, Size = 16)] - public struct VTable { - [FieldOffset(0)] - public int BaseTypeIdentifier; - [FieldOffset(4)] - public int MethodCount; - [FieldOffset(8)] - public int[] MethodIndexes; - [FieldOffset(12)] - public int[] MethodAddresses; - } + throw new Exception("Cannot find virtual method!"); + } + } + [StructLayout(LayoutKind.Explicit, Size = 16)] + public struct VTable { + [FieldOffset(0)] + public int BaseTypeIdentifier; + [FieldOffset(4)] + public int MethodCount; + [FieldOffset(8)] + public int[] MethodIndexes; + [FieldOffset(12)] + public int[] MethodAddresses; + } }