mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-26 21:42:11 +00:00
Final Kernel move.
This commit is contained in:
parent
dd280c8635
commit
4ddb8d1625
10 changed files with 44 additions and 44 deletions
|
|
@ -66,6 +66,14 @@ namespace Cosmos.Core.Plugs {
|
||||||
[PlugMethod(Assembler = typeof(InitFloatAsm))]
|
[PlugMethod(Assembler = typeof(InitFloatAsm))]
|
||||||
public void InitFloat() { }
|
public void InitFloat() { }
|
||||||
|
|
||||||
|
public class HaltAsm : AssemblerMethod {
|
||||||
|
public override void AssembleNew(object aAssembler, object aMethodInfo) {
|
||||||
|
new CPUx86.Halt();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
[PlugMethod(Assembler = typeof(HaltAsm))]
|
||||||
|
public void Halt() { }
|
||||||
|
|
||||||
|
|
||||||
// [PlugMethod(Assembler = typeof(P2.Assemblers.GetEndOfStack))]
|
// [PlugMethod(Assembler = typeof(P2.Assemblers.GetEndOfStack))]
|
||||||
// public static uint GetEndOfStack() {
|
// public static uint GetEndOfStack() {
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,6 @@
|
||||||
<Reference Include="System.Core">
|
<Reference Include="System.Core">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
</Reference>
|
</Reference>
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Assemblers\CreateGDT.cs" />
|
<Compile Include="Assemblers\CreateGDT.cs" />
|
||||||
|
|
@ -54,14 +52,6 @@
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\..\..\..\source\Cosmos\Cosmos.Kernel.Plugs\Cosmos.Kernel.Plugs.csproj">
|
|
||||||
<Project>{B168BEDD-C6A6-4E7C-B9A5-0144286E9E42}</Project>
|
|
||||||
<Name>Cosmos.Kernel.Plugs</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\..\..\..\..\source\Cosmos\Cosmos.Kernel\Cosmos.Kernel.csproj">
|
|
||||||
<Project>{A1F83D9F-2D44-4264-A08B-416797123018}</Project>
|
|
||||||
<Name>Cosmos.Kernel</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\..\..\..\Compiler\Cosmos.Compiler.Assembler.X86\Cosmos.Compiler.Assembler.X86.csproj">
|
<ProjectReference Include="..\..\..\..\..\Compiler\Cosmos.Compiler.Assembler.X86\Cosmos.Compiler.Assembler.X86.csproj">
|
||||||
<Project>{94D079E4-3C66-486A-8407-EA6EC049FF53}</Project>
|
<Project>{94D079E4-3C66-486A-8407-EA6EC049FF53}</Project>
|
||||||
<Name>Cosmos.Compiler.Assembler.X86</Name>
|
<Name>Cosmos.Compiler.Assembler.X86</Name>
|
||||||
|
|
|
||||||
|
|
@ -7,11 +7,30 @@ namespace Cosmos.Core {
|
||||||
// Non hardware class, only used by core and hardware drivers for ports etc.
|
// Non hardware class, only used by core and hardware drivers for ports etc.
|
||||||
public class CPU {
|
public class CPU {
|
||||||
// Amount of RAM in MB's.
|
// Amount of RAM in MB's.
|
||||||
public static uint GetAmountOfRAM() { return 0; } // Plugged
|
public uint GetAmountOfRAM() { return 0; } // Plugged
|
||||||
public static uint GetEndOfKernel() { return 0; } // Plugged
|
public uint GetEndOfKernel() { return 0; } // Plugged
|
||||||
public static void CreateGDT() { } // Plugged
|
public void CreateGDT() { } // Plugged
|
||||||
public static void CreateIDT(bool aEnableInterruptsImmediately) { } // Plugged
|
public void CreateIDT(bool aEnableInterruptsImmediately) { } // Plugged
|
||||||
public static void InitFloat() { } // Plugged
|
public void InitFloat() { } // Plugged
|
||||||
public static void ZeroFill(uint aStartAddress, uint aLength) { } // Plugged
|
public void ZeroFill(uint aStartAddress, uint aLength) { } // Plugged
|
||||||
|
public void Halt() { } // Plugged
|
||||||
|
|
||||||
|
public void Reboot() {
|
||||||
|
// Disable all interrupts
|
||||||
|
//DisableInterrupts();
|
||||||
|
|
||||||
|
//byte temp;
|
||||||
|
|
||||||
|
//// Clear all keyboard buffers
|
||||||
|
//do {
|
||||||
|
// temp = CPUBus.Read8(0x64); // Empty user data
|
||||||
|
// if ((temp & 0x01) != 0) {
|
||||||
|
// CPUBus.Read8(0x60); // Empty keyboard data
|
||||||
|
// }
|
||||||
|
//} while ((temp & 0x02) != 0);
|
||||||
|
|
||||||
|
//CPUBus.Write8(0x64, 0xFE); // Pulse CPU Reset line
|
||||||
|
Halt(); // If it didn't work, Halt the CPU
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,12 +5,15 @@ using System.Text;
|
||||||
|
|
||||||
namespace Cosmos.Core {
|
namespace Cosmos.Core {
|
||||||
static public class Global {
|
static public class Global {
|
||||||
|
static public CPU CPU;
|
||||||
static readonly public BaseIOGroups BaseIOGroups = new BaseIOGroups();
|
static readonly public BaseIOGroups BaseIOGroups = new BaseIOGroups();
|
||||||
static readonly public Cosmos.Debug.Kernel.Debugger Dbg = new Cosmos.Debug.Kernel.Debugger("Core", "");
|
static readonly public Cosmos.Debug.Kernel.Debugger Dbg = new Cosmos.Debug.Kernel.Debugger("Core", "");
|
||||||
static public PIC PIC;
|
static public PIC PIC;
|
||||||
static public Heap Heap;
|
static public Heap Heap;
|
||||||
|
|
||||||
static public void Init() {
|
static public void Init() {
|
||||||
|
CPU = new CPU();
|
||||||
|
|
||||||
//Init Heap first - Hardware loads devices and they need heap
|
//Init Heap first - Hardware loads devices and they need heap
|
||||||
Console.WriteLine(" Init Heap");
|
Console.WriteLine(" Init Heap");
|
||||||
Heap = new Heap(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() * 1024 * 1024) - 1024);
|
Heap = new Heap(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() * 1024 * 1024) - 1024);
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ namespace Cosmos.Core {
|
||||||
|
|
||||||
private void ClearMemory(uint aStartAddress, uint aLength) {
|
private void ClearMemory(uint aStartAddress, uint aLength) {
|
||||||
//TODO: Move to memory. Internal access only...
|
//TODO: Move to memory. Internal access only...
|
||||||
CPU.ZeroFill(aStartAddress, aLength);
|
Global.CPU.ZeroFill(aStartAddress, aLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void WriteNumber(uint aNumber, byte aBits) {
|
private void WriteNumber(uint aNumber, byte aBits) {
|
||||||
|
|
|
||||||
|
|
@ -53,10 +53,6 @@
|
||||||
<Compile Include="TextScreen.cs" />
|
<Compile Include="TextScreen.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\..\..\source\Cosmos\Cosmos.Kernel\Cosmos.Kernel.csproj">
|
|
||||||
<Project>{A1F83D9F-2D44-4264-A08B-416797123018}</Project>
|
|
||||||
<Name>Cosmos.Kernel</Name>
|
|
||||||
</ProjectReference>
|
|
||||||
<ProjectReference Include="..\..\..\Debug\Cosmos.Debug.Kernel\Cosmos.Debug.Kernel.csproj">
|
<ProjectReference Include="..\..\..\Debug\Cosmos.Debug.Kernel\Cosmos.Debug.Kernel.csproj">
|
||||||
<Project>{61607F1E-58F9-41CF-972F-128384F3E115}</Project>
|
<Project>{61607F1E-58F9-41CF-972F-128384F3E115}</Project>
|
||||||
<Name>Cosmos.Debug.Kernel</Name>
|
<Name>Cosmos.Debug.Kernel</Name>
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using K2 = Cosmos.Kernel;
|
|
||||||
|
|
||||||
namespace Cosmos.Hardware {
|
namespace Cosmos.Hardware {
|
||||||
public delegate void HandleKeyboardDelegate(byte aScanCode, bool aReleased);
|
public delegate void HandleKeyboardDelegate(byte aScanCode, bool aReleased);
|
||||||
|
|
@ -84,7 +83,7 @@ namespace Cosmos.Hardware {
|
||||||
default: {
|
default: {
|
||||||
if ((mCtrlState) && (mAltState) && (xTheScancode == 0x53)) {
|
if ((mCtrlState) && (mAltState) && (xTheScancode == 0x53)) {
|
||||||
Console.WriteLine("Detected Ctrl-Alt-Delete! Rebooting System...");
|
Console.WriteLine("Detected Ctrl-Alt-Delete! Rebooting System...");
|
||||||
Cosmos.Kernel.CPU.Reboot();
|
Core.Global.CPU.Reboot();
|
||||||
}
|
}
|
||||||
if (mShiftState) {
|
if (mShiftState) {
|
||||||
xTheScancode = xTheScancode << 16;
|
xTheScancode = xTheScancode << 16;
|
||||||
|
|
@ -348,7 +347,7 @@ namespace Cosmos.Hardware {
|
||||||
char xResult = '\0';
|
char xResult = '\0';
|
||||||
while (mBuffer.Count == 0 || !GetCharValue(mBuffer.Dequeue(), out xResult)) {
|
while (mBuffer.Count == 0 || !GetCharValue(mBuffer.Dequeue(), out xResult)) {
|
||||||
//Global.Sleep(10); //ToDo optimize value
|
//Global.Sleep(10); //ToDo optimize value
|
||||||
K2.CPU.Halt();
|
Core.Global.CPU.Halt();
|
||||||
}
|
}
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
@ -368,7 +367,7 @@ namespace Cosmos.Hardware {
|
||||||
ConsoleKey xResult = ConsoleKey.NoName;
|
ConsoleKey xResult = ConsoleKey.NoName;
|
||||||
while (mBuffer.Count == 0 || !GetKeyValue(mBuffer.Dequeue(), out xResult)) {
|
while (mBuffer.Count == 0 || !GetKeyValue(mBuffer.Dequeue(), out xResult)) {
|
||||||
//Global.Sleep(10); //ToDo optimize value
|
//Global.Sleep(10); //ToDo optimize value
|
||||||
K2.CPU.Halt();
|
Core.Global.CPU.Halt();
|
||||||
}
|
}
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
@ -387,7 +386,7 @@ namespace Cosmos.Hardware {
|
||||||
KeyMapping xResult = null;
|
KeyMapping xResult = null;
|
||||||
while (mBuffer.Count == 0 || !GetKeyMapping(mBuffer.Dequeue(), out xResult)) {
|
while (mBuffer.Count == 0 || !GetKeyMapping(mBuffer.Dequeue(), out xResult)) {
|
||||||
//Global.Sleep(10); //ToDo optimize value
|
//Global.Sleep(10); //ToDo optimize value
|
||||||
K2.CPU.Halt();
|
Core.Global.CPU.Halt();
|
||||||
}
|
}
|
||||||
return xResult;
|
return xResult;
|
||||||
}
|
}
|
||||||
|
|
@ -404,7 +403,7 @@ namespace Cosmos.Hardware {
|
||||||
|
|
||||||
public uint ReadScancode() {
|
public uint ReadScancode() {
|
||||||
while (mBuffer.Count == 0) {
|
while (mBuffer.Count == 0) {
|
||||||
K2.CPU.Halt();
|
Core.Global.CPU.Halt();
|
||||||
}
|
}
|
||||||
|
|
||||||
return mBuffer.Dequeue();
|
return mBuffer.Dequeue();
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using K2 = Cosmos.Kernel;
|
|
||||||
|
|
||||||
namespace Cosmos.Hardware {
|
namespace Cosmos.Hardware {
|
||||||
public class PIT : Device {
|
public class PIT : Device {
|
||||||
|
|
@ -150,7 +149,7 @@ namespace Cosmos.Hardware {
|
||||||
RegisterTimer(new PITTimer(SignalWait, (int)(TimeoutMS * 1000000), false));
|
RegisterTimer(new PITTimer(SignalWait, (int)(TimeoutMS * 1000000), false));
|
||||||
|
|
||||||
while (!WaitSignaled) {
|
while (!WaitSignaled) {
|
||||||
K2.CPU.Halt();
|
Core.Global.CPU.Halt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void WaitNS(int TimeoutNS) {
|
public void WaitNS(int TimeoutNS) {
|
||||||
|
|
@ -159,7 +158,7 @@ namespace Cosmos.Hardware {
|
||||||
RegisterTimer(new PITTimer(SignalWait, TimeoutNS, false));
|
RegisterTimer(new PITTimer(SignalWait, TimeoutNS, false));
|
||||||
|
|
||||||
while (!WaitSignaled) {
|
while (!WaitSignaled) {
|
||||||
K2.CPU.Halt();
|
Core.Global.CPU.Halt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -41,8 +41,6 @@
|
||||||
<Reference Include="Cosmos.Kernel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86" />
|
<Reference Include="Cosmos.Kernel, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86" />
|
||||||
<Reference Include="Cosmos.Sys, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86" />
|
<Reference Include="Cosmos.Sys, Version=1.0.0.0, Culture=neutral, PublicKeyToken=5ae71220097cb983, processorArchitecture=x86" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
|
||||||
<Reference Include="System.Xml" />
|
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="BreakpointsOS.cs" />
|
<Compile Include="BreakpointsOS.cs" />
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,6 @@
|
||||||
<h3>
|
<h3>
|
||||||
To Do</h3>
|
To Do</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li>New clean kernel with no links to old one, just console..<ul>
|
|
||||||
<li>keyboard PIC GDT CPU CPUBus and plug </li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
<li>Guess Demo</li>
|
<li>Guess Demo</li>
|
||||||
<li>use INT3 for BP? Will save 3 bytes per call.. which is a lot...</li>
|
<li>use INT3 for BP? Will save 3 bytes per call.. which is a lot...</li>
|
||||||
<li>GDB<ul>
|
<li>GDB<ul>
|
||||||
|
|
@ -17,14 +13,6 @@
|
||||||
<li>Ctrl-c support</li>
|
<li>Ctrl-c support</li>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li>Plugs<ul>
|
|
||||||
<li>To add a plug<ul>
|
|
||||||
<li>Cosmos.Build.MSBuild add ref to the plug asm</li>
|
|
||||||
<li>IL2CPU.cs - DoInitTypes - do this for any type in the plug asm</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
<h3>
|
<h3>
|
||||||
Matthijs - Next Release</h3>
|
Matthijs - Next Release</h3>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue