mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
g3
This commit is contained in:
parent
a8c24dd51b
commit
aa67985e24
9 changed files with 27 additions and 27 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
// we eventually eliminate them
|
// we eventually eliminate them
|
||||||
static public PIC PIC;
|
static public PIC PIC;
|
||||||
// Has to be static for now, ZeroFill gets called before the Init.
|
// Has to be static for now, ZeroFill gets called before the Init.
|
||||||
static public readonly CPU CPU = new CPU();
|
static public readonly Processor Processor = new Processor();
|
||||||
|
|
||||||
// Bootstrap is a class designed only to get the essentials done.
|
// Bootstrap is a class designed only to get the essentials done.
|
||||||
// ie the stuff needed to "pre boot". Do only the very minimal here.
|
// ie the stuff needed to "pre boot". Do only the very minimal here.
|
||||||
|
|
@ -16,10 +16,10 @@
|
||||||
Cosmos.Core.INTs.Dummy();
|
Cosmos.Core.INTs.Dummy();
|
||||||
|
|
||||||
PIC = new PIC();
|
PIC = new PIC();
|
||||||
CPU.UpdateIDT(true);
|
Processor.UpdateIDT(true);
|
||||||
|
|
||||||
/* TODO check using CPUID that SSE2 is supported */
|
/* TODO check using CPUID that SSE2 is supported */
|
||||||
CPU.InitSSE();
|
Processor.InitSSE();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We liked to use SSE for all floating point operation and end to mix SSE / x87 in Cosmos code
|
* We liked to use SSE for all floating point operation and end to mix SSE / x87 in Cosmos code
|
||||||
|
|
@ -27,7 +27,7 @@
|
||||||
* for long to double) so - in some rare cases - x87 continue to be used. I hope passing to the x32 or x64 IA will solve
|
* for long to double) so - in some rare cases - x87 continue to be used. I hope passing to the x32 or x64 IA will solve
|
||||||
* definively this problem.
|
* definively this problem.
|
||||||
*/
|
*/
|
||||||
CPU.InitFloat();
|
Processor.InitFloat();
|
||||||
|
|
||||||
// Managed_Memory_System.ManagedMemory.Initialize();
|
// Managed_Memory_System.ManagedMemory.Initialize();
|
||||||
// Managed_Memory_System.ManagedMemory.SetUpMemoryArea();
|
// Managed_Memory_System.ManagedMemory.SetUpMemoryArea();
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using Cosmos.Debug.Kernel;
|
||||||
|
|
||||||
namespace Cosmos.CPU {
|
namespace Cosmos.CPU {
|
||||||
public static class Global {
|
public static class Global {
|
||||||
public static readonly Debugger mDebugger = new Debugger("CPU", "Global");
|
public static readonly Debugger mDebugger = new Debugger("Processor", "Global");
|
||||||
|
|
||||||
public static BaseIOGroups BaseIOGroups = new BaseIOGroups();
|
public static BaseIOGroups BaseIOGroups = new BaseIOGroups();
|
||||||
|
|
||||||
|
|
@ -16,9 +16,9 @@ namespace Cosmos.CPU {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static public CPU CPU {
|
static public Processor Processor {
|
||||||
get {
|
get {
|
||||||
return Bootstrap.CPU;
|
return Bootstrap.Processor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@ namespace Cosmos.CPU {
|
||||||
|
|
||||||
internal static unsafe void EnsureInitialized() {
|
internal static unsafe void EnsureInitialized() {
|
||||||
//if (mGlobalInformationTable == null) {
|
//if (mGlobalInformationTable == null) {
|
||||||
//var xEndOfKernel = CPU.GetEndOfKernel();
|
//var xEndOfKernel = Processor.GetEndOfKernel();
|
||||||
//xEndOfKernel = xEndOfKernel + (1024 * 1024); // for now, skip 1 MB
|
//xEndOfKernel = xEndOfKernel + (1024 * 1024); // for now, skip 1 MB
|
||||||
//CPU.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + TotalDataLookupTableSize) * 4);
|
//Processor.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + TotalDataLookupTableSize) * 4);
|
||||||
//mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
|
//mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
|
||||||
//uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
|
//uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
|
||||||
//mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)xFirstDataLookupLocation;
|
//mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)xFirstDataLookupLocation;
|
||||||
|
|
|
||||||
|
|
@ -313,7 +313,7 @@ namespace Cosmos.Core {
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region CPU Exceptions
|
#region Processor Exceptions
|
||||||
|
|
||||||
public static IRQDelegate GeneralProtectionFault;
|
public static IRQDelegate GeneralProtectionFault;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ namespace Cosmos.CPU.Memory.Old {
|
||||||
if (mGlobalInformationTable == null) {
|
if (mGlobalInformationTable == null) {
|
||||||
// todo: should we align this structure somehow?
|
// todo: should we align this structure somehow?
|
||||||
|
|
||||||
var xEndOfKernel = CPU.GetEndOfKernel();
|
var xEndOfKernel = Processor.GetEndOfKernel();
|
||||||
xEndOfKernel = xEndOfKernel + (1024 * 1024); // for now, skip 1 MB
|
xEndOfKernel = xEndOfKernel + (1024 * 1024); // for now, skip 1 MB
|
||||||
CPU.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + TotalDataLookupTableSize) * 4);
|
Processor.ZeroFill(xEndOfKernel, (uint)(sizeof(GlobalInformationTable) + TotalDataLookupTableSize) * 4);
|
||||||
mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
|
mGlobalInformationTable = (GlobalInformationTable*)xEndOfKernel;
|
||||||
uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
|
uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
|
||||||
//Debugger.DoSend("Setting FirstDataLookupTable to ");
|
//Debugger.DoSend("Setting FirstDataLookupTable to ");
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ namespace Cosmos.CPU.Memory.Old
|
||||||
if (!mInitialized)
|
if (!mInitialized)
|
||||||
{
|
{
|
||||||
mInitialized = true;
|
mInitialized = true;
|
||||||
DoInitialize((CPU.GetAmountOfRAM() - 1) * 1024 * 1024);
|
DoInitialize((Processor.GetAmountOfRAM() - 1) * 1024 * 1024);
|
||||||
//DoInitialize(4 * 1024 * 1024, 16 * 1024 * 1024);
|
//DoInitialize(4 * 1024 * 1024, 16 * 1024 * 1024);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -41,7 +41,7 @@ namespace Cosmos.CPU.Memory.Old
|
||||||
private static void ClearMemory(void* aStartAddress, uint aLength)
|
private static void ClearMemory(void* aStartAddress, uint aLength)
|
||||||
{
|
{
|
||||||
//TODO: Move to memory. Internal access only...
|
//TODO: Move to memory. Internal access only...
|
||||||
CPU.ZeroFill((uint)aStartAddress, aLength);
|
Processor.ZeroFill((uint)aStartAddress, aLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static uint MemAlloc(uint aLength)
|
public static uint MemAlloc(uint aLength)
|
||||||
|
|
@ -53,7 +53,7 @@ namespace Cosmos.CPU.Memory.Old
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var xInterruptsWereEnabled = CPU.DisableInterrupts();
|
var xInterruptsWereEnabled = Processor.DisableInterrupts();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
EnsureIsInitialized();
|
EnsureIsInitialized();
|
||||||
|
|
@ -68,7 +68,7 @@ namespace Cosmos.CPU.Memory.Old
|
||||||
//mDebugger.Trace($"At address {(uint)xCurrentTable}");
|
//mDebugger.Trace($"At address {(uint)xCurrentTable}");
|
||||||
if (ScanDataLookupTable(xCurrentTableIdx, xCurrentTable, aLength, out xResult))
|
if (ScanDataLookupTable(xCurrentTableIdx, xCurrentTable, aLength, out xResult))
|
||||||
{
|
{
|
||||||
if (xResult < CPU.GetEndOfKernel())
|
if (xResult < Processor.GetEndOfKernel())
|
||||||
{
|
{
|
||||||
mDebugger.Send("Wrong handle returned!");
|
mDebugger.Send("Wrong handle returned!");
|
||||||
while (true)
|
while (true)
|
||||||
|
|
@ -118,7 +118,7 @@ namespace Cosmos.CPU.Memory.Old
|
||||||
{
|
{
|
||||||
if (xInterruptsWereEnabled)
|
if (xInterruptsWereEnabled)
|
||||||
{
|
{
|
||||||
CPU.EnableInterrupts();
|
Processor.EnableInterrupts();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
using Cosmos.Core;
|
using Cosmos.Core;
|
||||||
|
|
||||||
namespace Cosmos.CPU {
|
namespace Cosmos.CPU {
|
||||||
// PIC is not in hardware becuase its a special core piece like CPU that is not interacted with by anything except Core.
|
// PIC is not in hardware becuase its a special core piece like Processor that is not interacted with by anything except Core.
|
||||||
//
|
//
|
||||||
// Remaps the IRQ's to INT20-INT2F
|
// Remaps the IRQ's to INT20-INT2F
|
||||||
public class PIC {
|
public class PIC {
|
||||||
|
|
@ -94,7 +94,7 @@ namespace Cosmos.CPU {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void Init(IOGroup.PIC aPIC, byte aBase, byte aIDunno, byte aMask) {
|
protected void Init(IOGroup.PIC aPIC, byte aBase, byte aIDunno, byte aMask) {
|
||||||
// We need to remap the PIC interrupt lines to the CPU. The BIOS sets
|
// We need to remap the PIC interrupt lines to the Processor. The BIOS sets
|
||||||
// them in a way compatible for 16 bit mode, but in a way that causes problems
|
// them in a way compatible for 16 bit mode, but in a way that causes problems
|
||||||
// for 32 bit mode.
|
// for 32 bit mode.
|
||||||
// The only way to remap them however is to completely reinitialize the PICs.
|
// The only way to remap them however is to completely reinitialize the PICs.
|
||||||
|
|
@ -117,7 +117,7 @@ namespace Cosmos.CPU {
|
||||||
Master.Data.Byte = aIDunno;
|
Master.Data.Byte = aIDunno;
|
||||||
IOPort.Wait();
|
IOPort.Wait();
|
||||||
|
|
||||||
//#define ICW4_AUTO 0x02 /C:\Data\Cosmos\source2\Kernel\System\Hardware\Core\Cosmos.Core\CPU.cs* Auto (normal) EOI */
|
//#define ICW4_AUTO 0x02 /C:\Data\Cosmos\source2\Kernel\System\Hardware\Core\Cosmos.Core\Processor.cs* Auto (normal) EOI */
|
||||||
//#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
|
//#define ICW4_BUF_SLAVE 0x08 /* Buffered mode/slave */
|
||||||
//#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
|
//#define ICW4_BUF_MASTER 0x0C /* Buffered mode/master */
|
||||||
//#define ICW4_SFNM 0x10 /* Special fully nested (not) */
|
//#define ICW4_SFNM 0x10 /* Special fully nested (not) */
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ using Cosmos.IL2CPU.API;
|
||||||
|
|
||||||
namespace Cosmos.CPU {
|
namespace Cosmos.CPU {
|
||||||
// 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 Processor
|
||||||
{
|
{
|
||||||
// Amount of RAM in MB's.
|
// Amount of RAM in MB's.
|
||||||
// needs to be static, as Heap needs it before we can instantiate objects
|
// needs to be static, as Heap needs it before we can instantiate objects
|
||||||
|
|
@ -60,7 +60,7 @@ namespace Cosmos.CPU {
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
myPort.Byte = 0xFE;
|
myPort.Byte = 0xFE;
|
||||||
Halt(); // If it didn't work, Halt the CPU
|
Halt(); // If it didn't work, Halt the Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void DoEnableInterrupts()
|
private static void DoEnableInterrupts()
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
using Cosmos.IL2CPU.API;
|
using Cosmos.IL2CPU.API;
|
||||||
|
|
||||||
namespace Cosmos.CPU_Asm {
|
namespace Cosmos.CPU_Asm {
|
||||||
[Plug(Target = typeof(Cosmos.CPU.CPU))]
|
[Plug(Target = typeof(Cosmos.CPU.Processor))]
|
||||||
public class CPUImpl {
|
public class CPUImpl {
|
||||||
[PlugMethod(Assembler = typeof(CPUUpdateIDTAsm))]
|
[PlugMethod(Assembler = typeof(CPUUpdateIDTAsm))]
|
||||||
public static void UpdateIDT(Cosmos.CPU.CPU aThis, bool aEnableInterruptsImmediately) {
|
public static void UpdateIDT(Cosmos.CPU.Processor aThis, bool aEnableInterruptsImmediately) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUGetAmountOfRAMAsm))]
|
[PlugMethod(Assembler = typeof(CPUGetAmountOfRAMAsm))]
|
||||||
|
|
@ -23,15 +23,15 @@ namespace Cosmos.CPU_Asm {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUInitFloatAsm))]
|
[PlugMethod(Assembler = typeof(CPUInitFloatAsm))]
|
||||||
public static void InitFloat(Cosmos.CPU.CPU aThis) {
|
public static void InitFloat(Cosmos.CPU.Processor aThis) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUInitSSEAsm))]
|
[PlugMethod(Assembler = typeof(CPUInitSSEAsm))]
|
||||||
public static void InitSSE(Cosmos.CPU.CPU aThis) {
|
public static void InitSSE(Cosmos.CPU.Processor aThis) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUHaltAsm))]
|
[PlugMethod(Assembler = typeof(CPUHaltAsm))]
|
||||||
public static void Halt(Cosmos.CPU.CPU aThis) {
|
public static void Halt(Cosmos.CPU.Processor aThis) {
|
||||||
}
|
}
|
||||||
|
|
||||||
[PlugMethod(Assembler = typeof(CPUDisableINTsAsm))]
|
[PlugMethod(Assembler = typeof(CPUDisableINTsAsm))]
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue