Skip to content

Commit 78d9068

Browse files
committed
Update ACPILib with last @MishaTy changes
1 parent 0dadc0b commit 78d9068

File tree

9 files changed

+755
-524
lines changed

9 files changed

+755
-524
lines changed

source/Cosmos.Core/ACPI/ACPI.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,8 +814,11 @@ private static void SearchPackage(ParseNode op)
814814

815815
if (op.Arguments[x].ToString() == "Package")
816816
{
817-
var arg = (ParseNode)op.Arguments[x];
817+
Global.mDebugger.Send("Package found!");
818818

819+
//var arg = (ParseNode)op.Arguments[x];
820+
821+
/*
819822
for (int y = 0; y < arg.Nodes.Count; y++)
820823
{
821824
List<ParseNode> package = arg.Nodes[y].Nodes;
@@ -830,6 +833,7 @@ private static void SearchPackage(ParseNode op)
830833
831834
IrqRoutingTable.Add(irqRouting);
832835
}
836+
*/
833837
}
834838
}
835839
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace ACPILib.AML
1+
namespace ACPILibs.AML
22
{
33
public class Definitions
44
{

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -635,7 +635,7 @@ private string GetName(OpCodeEnum code)
635635
return name;
636636
}
637637

638-
public override string ToString()
638+
public override string ToString()
639639
{
640640
return Name;
641641
}

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

Lines changed: 118 additions & 118 deletions
Large diffs are not rendered by default.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Threading.Tasks;
6+
7+
namespace ACPIAML.Interupter
8+
{
9+
public class EisaId
10+
{
11+
public static string ToText(long ID)
12+
{
13+
var vendor = ID & 0xFFFF;
14+
var device = ID >> 16;
15+
var device1 = device & 0xFF;
16+
var device2 = device >> 8;
17+
var vendor_rev = ((vendor & 0xFF) << 8) | vendor >> 8;
18+
var vendor1 = ((vendor_rev >> 10)&0x1f)+64;
19+
var vendor2 = ((vendor_rev >> 5)&0x1f)+64;
20+
var vendor3= ((vendor_rev >> 0)&0x1f)+64;
21+
22+
string vendorStr = new(new char[] { (char)vendor1 , (char)vendor2 , (char)vendor3 });
23+
return vendorStr + device1.ToString("X2") + device2.ToString("X2");
24+
}
25+
}
26+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
using ACPILib.Parser2;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
8+
namespace ACPIAML.Interupter
9+
{
10+
public class StackObject
11+
{
12+
private StackObject()
13+
{
14+
15+
}
16+
17+
public object? Value;
18+
public StackObjectType Type;
19+
20+
public static StackObject Create(string s)
21+
{
22+
return new() { Type = StackObjectType.String, Value = s };
23+
}
24+
public static StackObject Create(ParseNode s)
25+
{
26+
return new() { Type = StackObjectType.ParseNode, Value = s };
27+
}
28+
public static StackObject Create(byte s)
29+
{
30+
return new() { Type = StackObjectType.Byte, Value = s };
31+
}
32+
public static StackObject Create(short s)
33+
{
34+
return new() { Type = StackObjectType.Word, Value = s };
35+
}
36+
public static StackObject Create(int s)
37+
{
38+
return new() { Type = StackObjectType.DWord, Value = s };
39+
}
40+
public static StackObject Create(long s)
41+
{
42+
return new() { Type = StackObjectType.QWord, Value = s };
43+
}
44+
public static StackObject Create(byte[] s)
45+
{
46+
return new() { Type = StackObjectType.ByteArray, Value = s };
47+
}
48+
}
49+
public enum StackObjectType
50+
{
51+
Null,
52+
ParseNode,
53+
String,
54+
Byte,
55+
ByteArray,
56+
/// <summary>
57+
/// short
58+
/// </summary>
59+
Word,
60+
/// <summary>
61+
/// int
62+
/// </summary>
63+
DWord,
64+
/// <summary>
65+
/// long
66+
/// </summary>
67+
QWord,
68+
}
69+
}

source/Cosmos.Core/ACPI/Parser/Parser.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ private void ParseOp(AMLOp op, bool isMethodBody)
463463
break;
464464

465465
default:
466-
throw new NotImplementedException();
466+
throw new NotImplementedException("Unknown opcode");
467467
}
468468
}
469469
}

source/Cosmos.Core/ACPI/Parser2/ParseNode.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using ACPILib.AML;
1+
using ACPIAML.Interupter;
2+
using ACPILib.AML;
23
using System.Collections.Generic;
34

45
namespace ACPILib.Parser2
@@ -17,8 +18,8 @@ public long End
1718
get { return Start + Length + Op.CodeByteSize; }
1819
}
1920

20-
public object ConstantValue;
21-
public List<object> Arguments = new List<object>();
21+
public StackObject? ConstantValue;
22+
public List<StackObject> Arguments = new List<StackObject>();
2223
public List<ParseNode> Nodes = new List<ParseNode>();
2324

2425
public override string ToString()

0 commit comments

Comments
 (0)