mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-19 04:18:43 +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.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
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.
|
||||
// needs to be static, as Heap needs it before we can instantiate objects
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public static uint GetAmountOfRAM() { return 0; } // Plugged
|
||||
// needs to be static, as Heap needs it before we can instantiate objects
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public static uint GetEndOfKernel() { return 0; } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public void UpdateIDT(bool aEnableInterruptsImmediately) { } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public void InitFloat() { } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public static void ZeroFill(uint aStartAddress, uint aLength) { } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public void Halt() { } // Plugged
|
||||
|
||||
public void Reboot() {
|
||||
// Disable all interrupts
|
||||
DisableInterrupts();
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using System;
|
||||
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
namespace Cosmos.Core
|
||||
{
|
||||
public abstract class IOPortBase
|
||||
|
|
@ -29,12 +29,17 @@ namespace Cosmos.Core
|
|||
}
|
||||
|
||||
//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
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
static protected void Write16(UInt16 aPort, UInt16 aData) { } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
static protected void Write32(UInt16 aPort, UInt32 aData) { } // Plugged
|
||||
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
static protected byte Read8(UInt16 aPort) { return 0; } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
static protected UInt16 Read16(UInt16 aPort) { return 0; } // Plugged
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
static protected UInt32 Read32(UInt16 aPort) { return 0; } // Plugged
|
||||
|
||||
//TODO: Plug these Reads with asm to read directly to RAM
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ namespace Cosmos.IL2CPU.Plugs
|
|||
public Type Assembler = null;
|
||||
public bool IsMonoOnly = false;
|
||||
public bool IsMicrosoftdotNETOnly = false;
|
||||
|
||||
public bool PlugRequired = false;
|
||||
public bool IsWildcard = false;
|
||||
public bool WildcardMatchParameters = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,29 +2,29 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
using Cosmos.IL2CPU.Plugs;
|
||||
namespace Cosmos.IL2CPU {
|
||||
partial class RuntimeEngine {
|
||||
public static uint HeapHandle = 0;
|
||||
public const uint InitialHeapSize = 4096;
|
||||
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);
|
||||
}
|
||||
|
||||
public static uint Heap_AllocNewObject(uint aSize) {
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public static uint Heap_AllocNewObject(uint aSize) {
|
||||
// if (aSize == 0) {
|
||||
// aSize = 1;
|
||||
// }
|
||||
//return PInvokes.Kernel32_HeapAlloc(HeapHandle, 0x00000008, aSize);
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static void Heap_Free(uint aObject) {
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public static void Heap_Free(uint aObject) {
|
||||
//
|
||||
}
|
||||
|
||||
public static void Heap_Shutdown() {
|
||||
[PlugMethod(PlugRequired = true)]
|
||||
public static void Heap_Shutdown() {
|
||||
//PInvokes.Kernel32_HeapDestroy(HeapHandle);
|
||||
//HeapHandle = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -918,6 +918,10 @@ namespace Cosmos.IL2CPU
|
|||
{
|
||||
continue;
|
||||
}
|
||||
else if(xAttrib.PlugRequired)
|
||||
{
|
||||
throw new Exception(string.Format("Method {0} requires a plug, but none is implemented",xMethod.Name));
|
||||
}
|
||||
xPlugAssembler = xAttrib.Assembler;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue