diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index a3090e8386..40fc849aa0 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -12,7 +12,7 @@ permissions: contents: write env: - BUILD_VERSION: 2.5.1.${{ github.run_number }} + BUILD_VERSION: 2.6.0.${{ github.run_number }} jobs: diff --git a/Source/Docs/introduction.rst b/Source/Docs/introduction.rst index 8cece3187a..38b7311b90 100644 --- a/Source/Docs/introduction.rst +++ b/Source/Docs/introduction.rst @@ -22,7 +22,8 @@ The target platforms are: - 32-bit x86 (stable) - 64-bit x86 (x64) (in development) -- A32 ARMv8 (in early development) +- 32-bit ARMv8+ (in early development) +- 64-bit ARMv8+ (in early development) The MOSA compiler supports most object and non-object oriented code, including: diff --git a/Source/Mosa.Compiler.Framework/CompilerVersion.cs b/Source/Mosa.Compiler.Framework/CompilerVersion.cs index ba4cb6e645..c6491dd607 100644 --- a/Source/Mosa.Compiler.Framework/CompilerVersion.cs +++ b/Source/Mosa.Compiler.Framework/CompilerVersion.cs @@ -18,7 +18,7 @@ public static Version GetVersion() if (version.Build == 0) { // Revision and build number are reversed by design - version = new Version(2, 5, 1, 1); + version = new Version(2, 6, 0, 0); } return version; diff --git a/Source/Mosa.Compiler.x64/Intrinsic/IRQs.cs b/Source/Mosa.Compiler.x64/Intrinsic/IRQs.cs index af466c1e23..6224e85670 100644 --- a/Source/Mosa.Compiler.x64/Intrinsic/IRQs.cs +++ b/Source/Mosa.Compiler.x64/Intrinsic/IRQs.cs @@ -9,7 +9,7 @@ namespace Mosa.Compiler.x64.Intrinsic; /// internal static partial class IntrinsicMethods { - private static readonly string DefaultInterruptMethodName = "Mosa.Kernel.X64.IDT::ProcessInterrupt"; + private static readonly string DefaultInterruptMethodName = "Mosa.Kernel.BareMetal.X64.IDT::ProcessInterrupt"; private static void InsertIRQ(int irq, Context context, Transform transform) { diff --git a/Source/Mosa.Compiler.x86/Intrinsic/IRQs.cs b/Source/Mosa.Compiler.x86/Intrinsic/IRQs.cs index 4d36666d9e..5b4588d322 100644 --- a/Source/Mosa.Compiler.x86/Intrinsic/IRQs.cs +++ b/Source/Mosa.Compiler.x86/Intrinsic/IRQs.cs @@ -9,8 +9,7 @@ namespace Mosa.Compiler.x86.Intrinsic; /// internal static partial class IntrinsicMethods { - //private static readonly string DefaultInterruptMethodName = "Mosa.Kernel.x86.IDT::ProcessInterrupt"; - private static readonly string DefaultInterruptMethodName = "Mosa.Runtime.Interrupt::Process"; + private static readonly string DefaultInterruptMethodName = "Mosa.Kernel.BareMetal.x86.IDT::ProcessInterrupt"; private static readonly string[] seperator = new string[] { "::" }; @@ -23,7 +22,7 @@ private static void InsertIRQ(int irq, Context context, Transform transform) interruptMethodName = DefaultInterruptMethodName; } - var ar = interruptMethodName.Split(seperator, System.StringSplitOptions.None); + var ar = interruptMethodName.Split(seperator, StringSplitOptions.None); if (ar.Length != 2) return; diff --git a/Source/Mosa.DeviceSystem/HAL.cs b/Source/Mosa.DeviceSystem/HAL.cs index 747c1b16fa..d7ef9cf45c 100644 --- a/Source/Mosa.DeviceSystem/HAL.cs +++ b/Source/Mosa.DeviceSystem/HAL.cs @@ -107,7 +107,7 @@ public static void Assert(bool condition, string message) } /// - /// Pause + /// Yield /// public static void Yield() => hardwareAbstraction.Yield(); diff --git a/Source/Mosa.Kernel.BareMetal.x86/IDT.cs b/Source/Mosa.Kernel.BareMetal.x86/IDT.cs index 33f364aadb..ba93ed8d41 100644 --- a/Source/Mosa.Kernel.BareMetal.x86/IDT.cs +++ b/Source/Mosa.Kernel.BareMetal.x86/IDT.cs @@ -6,7 +6,6 @@ using Mosa.Kernel.BareMetal.BootMemory; using Mosa.Kernel.BareMetal.Intel; using Mosa.Runtime; -using Mosa.Runtime.Plug; using Mosa.Runtime.x86; namespace Mosa.Kernel.BareMetal.x86; @@ -2170,7 +2169,6 @@ private static void IRQ255() /// Interrupts the handler. /// /// The stack state pointer. - [Plug("Mosa.Runtime.Interrupt::Process")] private static unsafe void ProcessInterrupt(Pointer stackStatePointer) { var stack = new IDTStackEntry(stackStatePointer); @@ -2270,6 +2268,7 @@ private static unsafe void ProcessInterrupt(Pointer stackStatePointer) default: Interrupt?.Invoke(stack.Interrupt, stack.ErrorCode); + BareMetal.InterruptManager.ProcessInterrupt(stack.Interrupt, stack.ErrorCode); break; } diff --git a/Source/Mosa.Kernel.BareMetal/InterruptManager.cs b/Source/Mosa.Kernel.BareMetal/InterruptManager.cs index 9ffb4f1c50..8de49651ea 100644 --- a/Source/Mosa.Kernel.BareMetal/InterruptManager.cs +++ b/Source/Mosa.Kernel.BareMetal/InterruptManager.cs @@ -10,6 +10,7 @@ public static void Setup() { Debug.WriteLine("InterreuptManager:Setup()"); + InterruptQueue.Setup(); Platform.Interrupt.Setup(); Debug.WriteLine("InterreuptManager:Setup() [Exit]"); @@ -19,4 +20,9 @@ public static void SetHandler(InterruptHandler handler) { Platform.Interrupt.SetHandler(handler); } + + public static void ProcessInterrupt(uint interrupt, uint errorCode) + { + InterruptQueue.Enqueue(interrupt); + } } diff --git a/Source/Mosa.Kernel.BareMetal/InterruptQueue.cs b/Source/Mosa.Kernel.BareMetal/InterruptQueue.cs new file mode 100644 index 0000000000..1922a0d79b --- /dev/null +++ b/Source/Mosa.Kernel.BareMetal/InterruptQueue.cs @@ -0,0 +1,79 @@ +// Copyright (c) MOSA Project. Licensed under the New BSD License. + +namespace Mosa.Kernel.BareMetal; + +public static class InterruptQueue +{ + private const int MaxIRQs = 8196; + + private static int[] slots; + private static int first; + private static int last; + private static int length; + + public static void Setup() + { + Debug.WriteLine("InterruptQueue:Setup()"); + + slots = new int[8196]; + first = -1; + last = -1; + length = 0; + + for (var i = 0; i < MaxIRQs; i++) + { + slots[i] = -1; + } + + Debug.WriteLine("InterruptQueue:Setup() [Exit]"); + } + + public static int GetLength() => length; + + public static void Enqueue(uint irq) + { + if (last == -1) + { + first = (int)irq; + last = (int)irq; + length = 1; + } + else + { + if (last == irq) + return; + + if (slots[irq] != -1) + return; + + slots[last] = (int)irq; + + last = (int)irq; + + length++; + } + } + + public static int Dequeue() + { + if (first == -1) + { + return -1; + } + else + { + var ret = first; + + first = slots[first]; + + if (first == -1) + { + last = -1; + } + + length--; + + return ret; + } + } +} diff --git a/Source/Mosa.Kernel.BareMetal/Startup.cs b/Source/Mosa.Kernel.BareMetal/Startup.cs index 05bda15065..02eff802a9 100644 --- a/Source/Mosa.Kernel.BareMetal/Startup.cs +++ b/Source/Mosa.Kernel.BareMetal/Startup.cs @@ -252,7 +252,9 @@ private static Pointer AllocateMemory(uint size) private static void ProcessInterrupt(uint interrupt, uint errorCode) { - if (interrupt is >= 0x20 and < 0x30) + if (interrupt is >= 0x20 and < 0x30) // FIXME: X86 specific + { HAL.ProcessInterrupt((byte)(interrupt - 0x20)); + } } } diff --git a/Source/Mosa.Runtime/Interrupt.cs b/Source/Mosa.Runtime/Interrupt.cs deleted file mode 100644 index e507dbaa40..0000000000 --- a/Source/Mosa.Runtime/Interrupt.cs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright (c) MOSA Project. Licensed under the New BSD License. - -namespace Mosa.Runtime; - -internal static class Interrupt -{ - private static void Process(Pointer stackStatePointer) - { - // Will be plugged - } -}