Cosmos: ACPI not working

On my new OS, I’m trying to implement ACPI using the class from dewitcher (that was working on older releases) but the problem is that with this :

public static void Shutdown()
{
    Console.Clear();
    if (PM1a_CNT == null) Init();
    if (pm1aIO != null)
    {
        pm1aIO.Word = (ushort)(SLP_TYPa | SLP_EN);
        if (PM1b_CNT != null)
            pm1bIO.Word = (ushort)(SLP_TYPb | SLP_EN);
    }
    Console.WriteLine("Its now safe to turn off the computer.");
}

I get a compilation error :

Error occurred while invoking IL2CPU.
Exception: System.NotImplementedException: Or on types 'System.UInt16' and 'System.Int16' not yet implemented!
   … Cosmos.IL2CPU.ILOpCodes.OpNone.DoInterpretStackTypes(Boolean& aSituationChanged) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCodes\OpNone.cs:ligne 723
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 384
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 436
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 430
   … Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 412
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 389
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 436
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 430
   … Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 412
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 389
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 436
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 430
   … Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 412
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 389
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 436
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 430
   … Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 412
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 389
   … Cosmos.IL2CPU.AppAssembler.InterpretInstructionsToDetermineStackTypes(List`1 aCurrentGroup) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\AppAssembler.cs:ligne 698
   … Cosmos.IL2CPU.AppAssembler.EmitInstructions(MethodInfo aMethod, List`1 aCurrentGroup, Boolean& emitINT3) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\AppAssembler.cs:ligne 541
   … Cosmos.IL2CPU.AppAssembler.ProcessMethod(MethodInfo aMethod, List`1 aOpCodes) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\AppAssembler.cs:ligne 503
   … Cosmos.IL2CPU.ILScanner.Assemble() dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILScanner.cs:ligne 941
   … Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILScanner.cs:ligne 257
   … Cosmos.IL2CPU.CompilerEngine.Execute() dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\CompilerEngine.cs:ligne 238

(SLP_TYPa, SLP_TYPb and SLP_EN are of type short) So I tried to cast them to ushort like that :

public static void Shutdown()
{
    Console.Clear();
    if (PM1a_CNT == null) Init();
    if (pm1aIO != null)
    {
        pm1aIO.Word = (ushort)((ushort)SLP_TYPa | (ushort)SLP_EN);
        if (PM1b_CNT != null)
            pm1bIO.Word = (ushort)((ushort)SLP_TYPb | (ushort)SLP_EN);
    }
    Console.WriteLine("Its now safe to turn off the computer.");
}

Now I get this error :

Error occurred while invoking IL2CPU.
Exception: System.Exception: Wrong Poptype encountered! (Type = System.UIntPtr, expected = System.Byte*)
   … Cosmos.IL2CPU.ILOpCodes.OpField.DoInterpretStackTypes(Boolean& aSituationChanged) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCodes\OpField.cs:ligne 225
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 384
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 436
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 430
   … Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 412
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 389
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(ILOpCode xNextOpCode, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 436
   … Cosmos.IL2CPU.ILOpCode.InterpretInstruction(Int32 aPosition, IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 430
   … Cosmos.IL2CPU.ILOpCode.DoInterpretNextInstructionStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 412
   … Cosmos.IL2CPU.ILOpCode.InterpretStackTypes(IDictionary`2 aOpCodes, Stack`1 aStack, Boolean& aSituationChanged, Int32 aMaxRecursionDepth) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILOpCode.cs:ligne 389
   … Cosmos.IL2CPU.AppAssembler.InterpretInstructionsToDetermineStackTypes(List`1 aCurrentGroup) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\AppAssembler.cs:ligne 698
   … Cosmos.IL2CPU.AppAssembler.EmitInstructions(MethodInfo aMethod, List`1 aCurrentGroup, Boolean& emitINT3) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\AppAssembler.cs:ligne 541
   … Cosmos.IL2CPU.AppAssembler.ProcessMethod(MethodInfo aMethod, List`1 aOpCodes) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\AppAssembler.cs:ligne 511
   … Cosmos.IL2CPU.ILScanner.Assemble() dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILScanner.cs:ligne 941
   … Cosmos.IL2CPU.ILScanner.Execute(MethodBase aStartMethod) dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\ILScanner.cs:ligne 257
   … Cosmos.IL2CPU.CompilerEngine.Execute() dans d:\Documents\GitHub\Cosmos\source\Cosmos.IL2CPU\CompilerEngine.cs:ligne 238

I think it’s a bug or something like that. Thanks

Full code for ACPI.cs here

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 41 (19 by maintainers)

Commits related to this issue

Most upvoted comments

Ok. Thanks, my Wifi is very bad, will report back after it has downloaded. Thanks for all this btw 😃