mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 05:52:11 +00:00
parent
720f6187ed
commit
2de222bb2d
5 changed files with 27 additions and 13 deletions
|
|
@ -2,20 +2,25 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Cosmos.IL2CPU.Plugs;
|
||||||
namespace Cosmos.Core {
|
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.
|
||||||
// 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
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public static uint GetAmountOfRAM() { return 0; } // Plugged
|
public static uint GetAmountOfRAM() { return 0; } // Plugged
|
||||||
// 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
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public static uint GetEndOfKernel() { return 0; } // Plugged
|
public static uint GetEndOfKernel() { return 0; } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public void UpdateIDT(bool aEnableInterruptsImmediately) { } // Plugged
|
public void UpdateIDT(bool aEnableInterruptsImmediately) { } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public void InitFloat() { } // Plugged
|
public void InitFloat() { } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public static void ZeroFill(uint aStartAddress, uint aLength) { } // Plugged
|
public static void ZeroFill(uint aStartAddress, uint aLength) { } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public void Halt() { } // Plugged
|
public void Halt() { } // Plugged
|
||||||
|
|
||||||
public void Reboot() {
|
public void Reboot() {
|
||||||
// Disable all interrupts
|
// Disable all interrupts
|
||||||
DisableInterrupts();
|
DisableInterrupts();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
using System;
|
using System;
|
||||||
|
using Cosmos.IL2CPU.Plugs;
|
||||||
namespace Cosmos.Core
|
namespace Cosmos.Core
|
||||||
{
|
{
|
||||||
public abstract class IOPortBase
|
public abstract class IOPortBase
|
||||||
|
|
@ -29,12 +29,17 @@ namespace Cosmos.Core
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Reads and writes can use this to get port instead of argument
|
//TODO: Reads and writes can use this to get port instead of argument
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
static protected void Write8(UInt16 aPort, byte aData) { } // Plugged
|
static protected void Write8(UInt16 aPort, byte aData) { } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
static protected void Write16(UInt16 aPort, UInt16 aData) { } // Plugged
|
static protected void Write16(UInt16 aPort, UInt16 aData) { } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
static protected void Write32(UInt16 aPort, UInt32 aData) { } // Plugged
|
static protected void Write32(UInt16 aPort, UInt32 aData) { } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
static protected byte Read8(UInt16 aPort) { return 0; } // Plugged
|
static protected byte Read8(UInt16 aPort) { return 0; } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
static protected UInt16 Read16(UInt16 aPort) { return 0; } // Plugged
|
static protected UInt16 Read16(UInt16 aPort) { return 0; } // Plugged
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
static protected UInt32 Read32(UInt16 aPort) { return 0; } // Plugged
|
static protected UInt32 Read32(UInt16 aPort) { return 0; } // Plugged
|
||||||
|
|
||||||
//TODO: Plug these Reads with asm to read directly to RAM
|
//TODO: Plug these Reads with asm to read directly to RAM
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ namespace Cosmos.IL2CPU.Plugs
|
||||||
public Type Assembler = null;
|
public Type Assembler = null;
|
||||||
public bool IsMonoOnly = false;
|
public bool IsMonoOnly = false;
|
||||||
public bool IsMicrosoftdotNETOnly = false;
|
public bool IsMicrosoftdotNETOnly = false;
|
||||||
|
public bool PlugRequired = false;
|
||||||
public bool IsWildcard = false;
|
public bool IsWildcard = false;
|
||||||
public bool WildcardMatchParameters = false;
|
public bool WildcardMatchParameters = false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,29 @@
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
using Cosmos.IL2CPU.Plugs;
|
||||||
namespace Cosmos.IL2CPU {
|
namespace Cosmos.IL2CPU {
|
||||||
partial class RuntimeEngine {
|
partial class RuntimeEngine {
|
||||||
public static uint HeapHandle = 0;
|
public static uint HeapHandle = 0;
|
||||||
public const uint InitialHeapSize = 4096;
|
public const uint InitialHeapSize = 4096;
|
||||||
public const uint MaximumHeapSize = 10 * 1024 * InitialHeapSize; // 10 megabytes
|
public const uint MaximumHeapSize = 10 * 1024 * InitialHeapSize; // 10 megabytes
|
||||||
public static void Heap_Initialize() {
|
public static void Heap_Initialize() {
|
||||||
//HeapHandle = PInvokes.Kernel32_HeapCreate(0, InitialHeapSize, MaximumHeapSize);
|
//HeapHandle = PInvokes.Kernel32_HeapCreate(0, InitialHeapSize, MaximumHeapSize);
|
||||||
}
|
}
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public static uint Heap_AllocNewObject(uint aSize) {
|
public static uint Heap_AllocNewObject(uint aSize) {
|
||||||
// if (aSize == 0) {
|
// if (aSize == 0) {
|
||||||
// aSize = 1;
|
// aSize = 1;
|
||||||
// }
|
// }
|
||||||
//return PInvokes.Kernel32_HeapAlloc(HeapHandle, 0x00000008, aSize);
|
//return PInvokes.Kernel32_HeapAlloc(HeapHandle, 0x00000008, aSize);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public static void Heap_Free(uint aObject) {
|
public static void Heap_Free(uint aObject) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
[PlugMethod(PlugRequired = true)]
|
||||||
public static void Heap_Shutdown() {
|
public static void Heap_Shutdown() {
|
||||||
//PInvokes.Kernel32_HeapDestroy(HeapHandle);
|
//PInvokes.Kernel32_HeapDestroy(HeapHandle);
|
||||||
//HeapHandle = 0;
|
//HeapHandle = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -918,6 +918,10 @@ namespace Cosmos.IL2CPU
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else if(xAttrib.PlugRequired)
|
||||||
|
{
|
||||||
|
throw new Exception(string.Format("Method {0} requires a plug, but none is implemented",xMethod.Name));
|
||||||
|
}
|
||||||
xPlugAssembler = xAttrib.Assembler;
|
xPlugAssembler = xAttrib.Assembler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue