mirror of
https://github.com/creeperlv/SVM.git
synced 2026-01-11 12:59:54 +00:00
Working on a BSD-Style syscall wrapper.
This commit is contained in:
@@ -25,6 +25,8 @@ namespace SVM.Core
|
||||
public MState MachineState;
|
||||
public SVMProgram* Program = null;
|
||||
public static uint InitGPMemorySize = 696320;
|
||||
public Object? AdditionalData = null;
|
||||
public ErrorIDs ErrorIDs = new ErrorIDs();
|
||||
public void Init(uint StackSize = 1024 * 1024, uint RegisterSize = 512, uint GPMemory = uint.MaxValue)
|
||||
{
|
||||
registers.Init(RegisterSize);
|
||||
@@ -181,11 +183,19 @@ namespace SVM.Core
|
||||
case PrimaryInstruction.System:
|
||||
if (Config != null)
|
||||
{
|
||||
var target = Instruction.GetData<uint>(1);
|
||||
var target = Instruction.GetData<uint>(4);
|
||||
if (Config.FuncCalls.TryGetValue(target, out var func))
|
||||
{
|
||||
func(this);
|
||||
}
|
||||
else
|
||||
{
|
||||
registers.SetData((int)ErrorIDOffset,ErrorIDs.SyscallCallNotExist);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
registers.SetData((int)ErrorIDOffset, ErrorIDs.SyscallCallNotExist);
|
||||
}
|
||||
break;
|
||||
case PrimaryInstruction.SIMD:
|
||||
@@ -359,6 +369,11 @@ namespace SVM.Core
|
||||
/// </summary>
|
||||
public uint EIDRegisterID;
|
||||
}
|
||||
public class ErrorIDs
|
||||
{
|
||||
public int SyscallCallNotExist = 1;
|
||||
public int MAX_ERROR_ID = short.MaxValue;
|
||||
}
|
||||
public delegate void FuncCall(SimpleVirtualMachine machine);
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct MState
|
||||
|
||||
Reference in New Issue
Block a user