Skip to content

Commit

Permalink
g3
Browse files Browse the repository at this point in the history
  • Loading branch information
czhower committed Jul 30, 2017
1 parent a8c24dd commit aa67985
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions source/Kernel-X86/00-CPU/Cosmos.CPU/Bootstrap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ public static class Bootstrap {
// we eventually eliminate them
static public PIC PIC;
// 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.
// ie the stuff needed to "pre boot". Do only the very minimal here.
Expand All @@ -16,18 +16,18 @@ public static void Init() {
Cosmos.Core.INTs.Dummy();

PIC = new PIC();
CPU.UpdateIDT(true);
Processor.UpdateIDT(true);

/* 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
* but sadly in x86 this resulte impossible as Intel not implemented some needed instruction (for example conversion
* 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.
*/
CPU.InitFloat();
Processor.InitFloat();

// Managed_Memory_System.ManagedMemory.Initialize();
// Managed_Memory_System.ManagedMemory.SetUpMemoryArea();
Expand Down
6 changes: 3 additions & 3 deletions source/Kernel-X86/00-CPU/Cosmos.CPU/Global.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Cosmos.CPU {
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();

Expand All @@ -16,9 +16,9 @@ static public PIC PIC {
}
}

static public CPU CPU {
static public Processor Processor {
get {
return Bootstrap.CPU;
return Bootstrap.Processor;
}
}

Expand Down
4 changes: 2 additions & 2 deletions source/Kernel-X86/00-CPU/Cosmos.CPU/GlobalSystemInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ internal static unsafe class GlobalSystemInfo {

internal static unsafe void EnsureInitialized() {
//if (mGlobalInformationTable == null) {
//var xEndOfKernel = CPU.GetEndOfKernel();
//var xEndOfKernel = Processor.GetEndOfKernel();
//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;
//uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
//mGlobalInformationTable->FirstDataLookupTable = (DataLookupTable*)xFirstDataLookupLocation;
Expand Down
2 changes: 1 addition & 1 deletion source/Kernel-X86/00-CPU/Cosmos.CPU/INTs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ public static void HandleInterrupt_49(ref IRQContext aContext) {

#endregion

#region CPU Exceptions
#region Processor Exceptions

public static IRQDelegate GeneralProtectionFault;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ public static unsafe void EnsureInitialized() {
if (mGlobalInformationTable == null) {
// todo: should we align this structure somehow?

var xEndOfKernel = CPU.GetEndOfKernel();
var xEndOfKernel = Processor.GetEndOfKernel();
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;
uint xFirstDataLookupLocation = (uint)(xEndOfKernel + sizeof(GlobalInformationTable));
//Debugger.DoSend("Setting FirstDataLookupTable to ");
Expand Down
10 changes: 5 additions & 5 deletions source/Kernel-X86/00-CPU/Cosmos.CPU/Memory/Old/Old_Heap.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ internal static void EnsureIsInitialized()
if (!mInitialized)
{
mInitialized = true;
DoInitialize((CPU.GetAmountOfRAM() - 1) * 1024 * 1024);
DoInitialize((Processor.GetAmountOfRAM() - 1) * 1024 * 1024);
//DoInitialize(4 * 1024 * 1024, 16 * 1024 * 1024);
}
}

private static void ClearMemory(void* aStartAddress, uint aLength)
{
//TODO: Move to memory. Internal access only...
CPU.ZeroFill((uint)aStartAddress, aLength);
Processor.ZeroFill((uint)aStartAddress, aLength);
}

public static uint MemAlloc(uint aLength)
Expand All @@ -53,7 +53,7 @@ public static uint MemAlloc(uint aLength)
{
}
}
var xInterruptsWereEnabled = CPU.DisableInterrupts();
var xInterruptsWereEnabled = Processor.DisableInterrupts();
try
{
EnsureIsInitialized();
Expand All @@ -68,7 +68,7 @@ public static uint MemAlloc(uint aLength)
//mDebugger.Trace($"At address {(uint)xCurrentTable}");
if (ScanDataLookupTable(xCurrentTableIdx, xCurrentTable, aLength, out xResult))
{
if (xResult < CPU.GetEndOfKernel())
if (xResult < Processor.GetEndOfKernel())
{
mDebugger.Send("Wrong handle returned!");
while (true)
Expand Down Expand Up @@ -118,7 +118,7 @@ public static uint MemAlloc(uint aLength)
{
if (xInterruptsWereEnabled)
{
CPU.EnableInterrupts();
Processor.EnableInterrupts();
}
else
{
Expand Down
6 changes: 3 additions & 3 deletions source/Kernel-X86/00-CPU/Cosmos.CPU/PIC.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Cosmos.Core;

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
public class PIC {
Expand Down Expand Up @@ -94,7 +94,7 @@ private void Remap(byte masterStart, byte masterMask, byte slaveStart, byte slav
}

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
// for 32 bit mode.
// The only way to remap them however is to completely reinitialize the PICs.
Expand All @@ -117,7 +117,7 @@ protected void Init(IOGroup.PIC aPIC, byte aBase, byte aIDunno, byte aMask) {
Master.Data.Byte = aIDunno;
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_MASTER 0x0C /* Buffered mode/master */
//#define ICW4_SFNM 0x10 /* Special fully nested (not) */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Cosmos.CPU {
// 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.
// needs to be static, as Heap needs it before we can instantiate objects
Expand Down Expand Up @@ -60,7 +60,7 @@ public void Reboot()
{
}
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()
Expand Down
10 changes: 5 additions & 5 deletions source/Kernel-X86/00-CPU/Cosmos.CPU_Asm/CPUImpl.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using Cosmos.IL2CPU.API;

namespace Cosmos.CPU_Asm {
[Plug(Target = typeof(Cosmos.CPU.CPU))]
[Plug(Target = typeof(Cosmos.CPU.Processor))]
public class CPUImpl {
[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))]
Expand All @@ -23,15 +23,15 @@ public static void ZeroFill(uint aStartAddress, uint aLength) {
}

[PlugMethod(Assembler = typeof(CPUInitFloatAsm))]
public static void InitFloat(Cosmos.CPU.CPU aThis) {
public static void InitFloat(Cosmos.CPU.Processor aThis) {
}

[PlugMethod(Assembler = typeof(CPUInitSSEAsm))]
public static void InitSSE(Cosmos.CPU.CPU aThis) {
public static void InitSSE(Cosmos.CPU.Processor aThis) {
}

[PlugMethod(Assembler = typeof(CPUHaltAsm))]
public static void Halt(Cosmos.CPU.CPU aThis) {
public static void Halt(Cosmos.CPU.Processor aThis) {
}

[PlugMethod(Assembler = typeof(CPUDisableINTsAsm))]
Expand Down

0 comments on commit aa67985

Please sign in to comment.