Final Kernel move.

This commit is contained in:
kudzu_cp 2010-08-20 04:02:35 +00:00
parent dd280c8635
commit 4ddb8d1625
10 changed files with 44 additions and 44 deletions

View file

@ -66,6 +66,14 @@ namespace Cosmos.Core.Plugs {
[PlugMethod(Assembler = typeof(InitFloatAsm))]
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))]
// public static uint GetEndOfStack() {

View file

@ -43,8 +43,6 @@
<Reference Include="System.Core">
<RequiredTargetFramework>3.5</RequiredTargetFramework>
</Reference>
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Assemblers\CreateGDT.cs" />
@ -54,14 +52,6 @@
<Compile Include="Properties\AssemblyInfo.cs" />
</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">
<Project>{94D079E4-3C66-486A-8407-EA6EC049FF53}</Project>
<Name>Cosmos.Compiler.Assembler.X86</Name>

View file

@ -7,11 +7,30 @@ namespace Cosmos.Core {
// Non hardware class, only used by core and hardware drivers for ports etc.
public class CPU {
// Amount of RAM in MB's.
public static uint GetAmountOfRAM() { return 0; } // Plugged
public static uint GetEndOfKernel() { return 0; } // Plugged
public static void CreateGDT() { } // Plugged
public static void CreateIDT(bool aEnableInterruptsImmediately) { } // Plugged
public static void InitFloat() { } // Plugged
public static void ZeroFill(uint aStartAddress, uint aLength) { } // Plugged
public uint GetAmountOfRAM() { return 0; } // Plugged
public uint GetEndOfKernel() { return 0; } // Plugged
public void CreateGDT() { } // Plugged
public void CreateIDT(bool aEnableInterruptsImmediately) { } // Plugged
public void InitFloat() { } // 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
}
}
}

View file

@ -5,12 +5,15 @@ using System.Text;
namespace Cosmos.Core {
static public class Global {
static public CPU CPU;
static readonly public BaseIOGroups BaseIOGroups = new BaseIOGroups();
static readonly public Cosmos.Debug.Kernel.Debugger Dbg = new Cosmos.Debug.Kernel.Debugger("Core", "");
static public PIC PIC;
static public Heap Heap;
static public void Init() {
CPU = new CPU();
//Init Heap first - Hardware loads devices and they need heap
Console.WriteLine(" Init Heap");
Heap = new Heap(CPU.GetEndOfKernel(), (CPU.GetAmountOfRAM() * 1024 * 1024) - 1024);

View file

@ -25,7 +25,7 @@ namespace Cosmos.Core {
private void ClearMemory(uint aStartAddress, uint aLength) {
//TODO: Move to memory. Internal access only...
CPU.ZeroFill(aStartAddress, aLength);
Global.CPU.ZeroFill(aStartAddress, aLength);
}
private void WriteNumber(uint aNumber, byte aBits) {

View file

@ -53,10 +53,6 @@
<Compile Include="TextScreen.cs" />
</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">
<Project>{61607F1E-58F9-41CF-972F-128384F3E115}</Project>
<Name>Cosmos.Debug.Kernel</Name>

View file

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using K2 = Cosmos.Kernel;
namespace Cosmos.Hardware {
public delegate void HandleKeyboardDelegate(byte aScanCode, bool aReleased);
@ -84,7 +83,7 @@ namespace Cosmos.Hardware {
default: {
if ((mCtrlState) && (mAltState) && (xTheScancode == 0x53)) {
Console.WriteLine("Detected Ctrl-Alt-Delete! Rebooting System...");
Cosmos.Kernel.CPU.Reboot();
Core.Global.CPU.Reboot();
}
if (mShiftState) {
xTheScancode = xTheScancode << 16;
@ -348,7 +347,7 @@ namespace Cosmos.Hardware {
char xResult = '\0';
while (mBuffer.Count == 0 || !GetCharValue(mBuffer.Dequeue(), out xResult)) {
//Global.Sleep(10); //ToDo optimize value
K2.CPU.Halt();
Core.Global.CPU.Halt();
}
return xResult;
}
@ -368,7 +367,7 @@ namespace Cosmos.Hardware {
ConsoleKey xResult = ConsoleKey.NoName;
while (mBuffer.Count == 0 || !GetKeyValue(mBuffer.Dequeue(), out xResult)) {
//Global.Sleep(10); //ToDo optimize value
K2.CPU.Halt();
Core.Global.CPU.Halt();
}
return xResult;
}
@ -387,7 +386,7 @@ namespace Cosmos.Hardware {
KeyMapping xResult = null;
while (mBuffer.Count == 0 || !GetKeyMapping(mBuffer.Dequeue(), out xResult)) {
//Global.Sleep(10); //ToDo optimize value
K2.CPU.Halt();
Core.Global.CPU.Halt();
}
return xResult;
}
@ -404,7 +403,7 @@ namespace Cosmos.Hardware {
public uint ReadScancode() {
while (mBuffer.Count == 0) {
K2.CPU.Halt();
Core.Global.CPU.Halt();
}
return mBuffer.Dequeue();

View file

@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Linq;
using System.Text;
using K2 = Cosmos.Kernel;
namespace Cosmos.Hardware {
public class PIT : Device {
@ -150,7 +149,7 @@ namespace Cosmos.Hardware {
RegisterTimer(new PITTimer(SignalWait, (int)(TimeoutMS * 1000000), false));
while (!WaitSignaled) {
K2.CPU.Halt();
Core.Global.CPU.Halt();
}
}
public void WaitNS(int TimeoutNS) {
@ -159,7 +158,7 @@ namespace Cosmos.Hardware {
RegisterTimer(new PITTimer(SignalWait, TimeoutNS, false));
while (!WaitSignaled) {
K2.CPU.Halt();
Core.Global.CPU.Halt();
}
}

View file

@ -41,8 +41,6 @@
<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="System" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="BreakpointsOS.cs" />

View file

@ -3,10 +3,6 @@
<h3>
To Do</h3>
<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>use INT3 for BP? Will save 3 bytes per call.. which is a lot...</li>
<li>GDB<ul>
@ -17,14 +13,6 @@
<li>Ctrl-c support</li>
</ul>
</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>
<h3>
Matthijs - Next Release</h3>