mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-27 22:12:25 +00:00
Working context switching but far from stable. Changes needed to be made to the internals of cosmos to include mutex's in vital components (Heap, Thread Manager, ect). Context switching currently only switches the general registers and does not switch the MMX context, however this will be added in the future. Also when a thread currently dies it takes the whole system down, patches to the IDT handlers needed to be made to prevent system lockup in the future
39 lines
1.3 KiB
C#
39 lines
1.3 KiB
C#
using Cosmos.Core;
|
|
using IL2CPU.API.Attribs;
|
|
using System;
|
|
using XSharp;
|
|
using XSharp.Assembler;
|
|
|
|
namespace Cosmos.Core_Asm
|
|
{
|
|
[Plug(Target = typeof(ObjUtilities))]
|
|
public static unsafe class ObjUtilitiesImpl
|
|
{
|
|
[PlugMethod(Assembler = typeof(ObjUtilitiesGetPointer))]
|
|
public static uint GetPointer(Delegate aVal) { return 0; }
|
|
|
|
[PlugMethod(Assembler = typeof(ObjUtilitiesGetPointer))]
|
|
public static uint GetPointer(Object aVal) { return 0; }
|
|
|
|
[PlugMethod(Assembler = typeof(ObjUtilitiesGetEntry))]
|
|
public static uint GetEntryPoint() { return 0; }
|
|
}
|
|
|
|
public class ObjUtilitiesGetPointer : AssemblerMethod
|
|
{
|
|
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
|
|
{
|
|
XS.Set(XSRegisters.EAX, XSRegisters.EBP, sourceDisplacement: 0x8);
|
|
XS.Push(XSRegisters.EAX);
|
|
}
|
|
}
|
|
|
|
public class ObjUtilitiesGetEntry : AssemblerMethod
|
|
{
|
|
public override void AssembleNew(Assembler aAssembler, object aMethodInfo)
|
|
{
|
|
XS.Set(XSRegisters.EAX, LabelName.Get(CPUUpdateIDTAsm.GetMethodDef(typeof(Cosmos.Core.Processing.ProcessorScheduler).Assembly, typeof(Cosmos.Core.Processing.ProcessorScheduler).FullName, "EntryPoint", true)));
|
|
XS.Push(XSRegisters.EAX);
|
|
}
|
|
}
|
|
}
|