Skip to content

Commit 97417d4

Browse files
committed
Remove AML Parser for now
1 parent 78d9068 commit 97417d4

File tree

21 files changed

+44
-2857
lines changed

21 files changed

+44
-2857
lines changed

Tests/Cosmos.TestRunner.Full/DefaultEngineConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public virtual IEnumerable<RunTargetEnum> RunTargets
1414
{
1515
get
1616
{
17-
yield return RunTargetEnum.Bochs;
17+
yield return RunTargetEnum.VMware;
1818
//yield return RunTargetEnum.VMware;
1919
//yield return RunTargetEnum.HyperV;
2020
//yield return RunTargetEnum.Qemu;

Tests/Cosmos.TestRunner.Full/TestKernelSets.cs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,6 @@ public static IEnumerable<Type> GetKernelTypesToRun()
1616
public static IEnumerable<Type> GetStableKernelTypes()
1717
{
1818
yield return typeof(BoxingTests.Kernel);
19-
yield return typeof(Compiler.Tests.TypeSystem.Kernel);
20-
yield return typeof(Compiler.Tests.Bcl.Kernel);
21-
yield return typeof(Compiler.Tests.Bcl.System.Kernel);
22-
//yield return typeof(Cosmos.Compiler.Tests.Encryption.Kernel);
23-
yield return typeof(Compiler.Tests.Exceptions.Kernel);
24-
yield return typeof(Compiler.Tests.MethodTests.Kernel);
25-
yield return typeof(Compiler.Tests.SingleEchoTest.Kernel);
26-
yield return typeof(Kernel.Tests.Fat.Kernel);
27-
yield return typeof(Kernel.Tests.IO.Kernel);
28-
yield return typeof(SimpleStructsAndArraysTest.Kernel);
29-
yield return typeof(Kernel.Tests.DiskManager.Kernel);
30-
31-
//yield return typeof(KernelGen3.Boot);
32-
33-
yield return typeof(GraphicTest.Kernel);
34-
yield return typeof(NetworkTest.Kernel);
35-
// Please see the notes on the kernel itself before enabling it
36-
//yield return typeof(ConsoleTest.Kernel);
37-
// This is a bit slow and works only because ring check is disabled to decide if leave it enabled
38-
yield return typeof(MemoryOperationsTest.Kernel);
39-
yield return typeof(ProcessorTests.Kernel);
4019
}
4120
}
4221
}

Tests/Cosmos.TestRunner.UnitTest/EngineConfiguration.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public override IEnumerable<RunTargetEnum> RunTargets
2222
{
2323
get
2424
{
25-
yield return RunTargetEnum.Bochs;
25+
yield return RunTargetEnum.VMware;
2626
}
2727
}
2828

Tests/Kernels/BoxingTests/Kernel.cs

Lines changed: 30 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using System.Drawing;
33
using System.Text;
44
using Cosmos.Debug.Kernel;
5+
using Cosmos.System.Network.IPv4.UDP.DHCP;
56
using Cosmos.TestRunner;
67
using Sys = Cosmos.System;
78

@@ -12,82 +13,39 @@ public class Kernel : Sys.Kernel
1213
protected override void BeforeRun()
1314
{
1415
Console.WriteLine("Cosmos booted successfully.");
15-
}
16-
17-
protected override void Run()
18-
{
19-
TestBoxingChar();
20-
TestBoxingInt32();
21-
TestBoxingColorToString();
22-
TestBoxingStruct();
23-
24-
TestController.Completed();
25-
}
26-
27-
private void TestBoxingChar()
28-
{
29-
object xChar = 'c';
3016

31-
Assert.AreEqual("c", xChar.ToString(), "Char.ToString on boxed Char doesn't work!");
32-
// 'c' == 0x63, and the hash code is ('c' | ('c' << 16));
33-
Assert.AreEqual(0x00630063, xChar.GetHashCode(), "Char.GetHashCode on boxed Char doesn't work!");
17+
Console.WriteLine("Asking DHCP...s");
18+
using (var xClient = new DHCPClient())
19+
{
20+
/** Send a DHCP Discover packet **/
21+
//This will automatically set the IP config after DHCP response
22+
xClient.SendDiscoverPacket();
23+
}
24+
Console.WriteLine("DHCP Asked");
3425
}
3526

36-
private void TestBoxingInt32()
37-
{
38-
object xNumber = 42;
39-
40-
Assert.AreEqual("42", xNumber.ToString(), "Int32.ToString on boxed Int32 doesn't work!");
41-
Assert.AreEqual(42, xNumber.GetHashCode(), "Int32.GetHashCode on boxed Int32 doesn't work!");
42-
43-
Assert.IsTrue(xNumber.Equals(42), "Int32.Equals on boxed int doesn't work!");
44-
Assert.IsFalse(xNumber.Equals(5), "Int32.Equals on boxed int doesn't work!");
45-
46-
object xAnotherNumber = 42;
47-
48-
Assert.IsTrue(Object.Equals(xNumber, xAnotherNumber), "Object.Equals doesn't work!");
49-
}
50-
51-
/* TODO add other tests:
52-
* - a simple stucture with fixed layout (for example with the integers and a ToString() method implemented)
53-
* - the structure of above but without layout set (that is sequential should be automatically taken by compiler)
54-
* - a structure with auto layout
55-
* - a strucuture with the packing attribute set with not a default value used
56-
*/
57-
58-
/*
59-
* The struct Color of System.Drawging has really a weird layout that make so that the runtime should create
60-
* padding between the fields to align the size of the structure to 4 bytes.
61-
* Cosmos ignores this and put no padding / writes the struct wrongly in memory and then when it should be
62-
* boxed garbage is copied instead of the structure itself!
63-
*/
64-
private void TestBoxingColorToString()
65-
{
66-
object xColor = Color.Blue;
67-
Assert.IsTrue(xColor.ToString() == "Color [Blue]", "Color.ToString doesn't work on boxed Color!");
68-
}
69-
70-
71-
// Taken from https://github.com/CosmosOS/Cosmos/issues/1082
72-
private void TestBoxingStruct()
73-
{
74-
UTF8Encoding encoding = new UTF8Encoding();
75-
mDebugger.Send("Testing boxing on structs!");
76-
object xValBoxed = new Values("UTF-8", encoding);
77-
bool condition = xValBoxed.Equals(xValBoxed);
78-
Assert.IsTrue(condition, "Equality works for boxed structs");
79-
}
80-
}
81-
82-
struct Values
83-
{
84-
public string desc;
85-
public Encoding encoding;
86-
87-
public Values(string desc, Encoding encoding)
27+
protected override void Run()
8828
{
89-
this.desc = desc;
90-
this.encoding = encoding;
29+
Console.Write("> ");
30+
string line = Console.ReadLine();
31+
32+
switch (line)
33+
{
34+
case "sleep":
35+
Console.WriteLine("Sleeping...");
36+
Cosmos.HAL.Global.PIT.Wait(2000);
37+
Console.WriteLine("WOKE UP!");
38+
break;
39+
case "sd":
40+
Sys.Power.Shutdown();
41+
break;
42+
case "rb":
43+
Sys.Power.Reboot();
44+
break;
45+
default:
46+
Console.WriteLine("You said: " + line);
47+
break;
48+
}
9149
}
9250
}
9351
}

source/Cosmos.Core/ACPI/ACPI.cs

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -658,35 +658,25 @@ private static void ParseS5()
658658

659659
private static void ParsePRT()
660660
{
661-
byte* S5Addr = (byte*)FADT->Dsdt;
662-
663-
while (0 < DSDTLenght--)
664-
{
665-
if (Compare("_PRT", S5Addr) == 0)
666-
{
667-
break;
668-
}
669-
S5Addr++;
670-
}
671-
661+
/*
672662
if (DSDTLenght > 0)
673663
{
674-
var dsdtBlock = new MemoryBlock08((uint)S5Addr, SdtLength);
664+
var dsdtBlock = new MemoryBlock08(FADT->Dsdt + (uint)sizeof(AcpiHeader), SdtLength - (uint)sizeof(AcpiHeader));
675665
676666
Stream stream = new MemoryStream(dsdtBlock.ToArray());
677667
678668
Global.mDebugger.Send("Create parser...");
679669
680670
var root = new Parser(stream);
681671
682-
Global.mDebugger.Send("Parsing ACPI DST _PRT Method...");
672+
Global.mDebugger.Send("Parse first node...");
683673
684674
var node = root.Parse();
685-
686-
Global.mDebugger.Send("Parsed! Trying to list IRQ Routing Table...");
687-
688-
PopulateNode(node);
689-
}
675+
foreach (var item in node.Nodes)
676+
{
677+
Global.mDebugger.Send("Node: " + item.Name);
678+
}
679+
}*/
690680
}
691681

692682
private static void ParseDT(AcpiHeader* hdr)
@@ -779,6 +769,7 @@ private static void ParseDT(AcpiHeader* hdr)
779769
}
780770
}
781771

772+
/*
782773
private static void PopulateNode(ParseNode op)
783774
{
784775
//Recursive function does a null reference exception trick the matrice with a Stack and iterative function
@@ -805,6 +796,7 @@ private static void PopulateNode(ParseNode op)
805796
}
806797
}
807798
799+
808800
private static void SearchPackage(ParseNode op)
809801
{
810802
for (int x = 0; x < op.Op.ParseArgs.Length; x++)
@@ -833,10 +825,10 @@ private static void SearchPackage(ParseNode op)
833825
834826
IrqRoutingTable.Add(irqRouting);
835827
}
836-
*/
828+
837829
}
838830
}
839-
}
831+
}*/
840832

841833
/// <summary>
842834
/// Enable ACPI.

source/Cosmos.Core/ACPI/AML/Definitions.cs

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)