public AstNodeStm syscall()
{
if (Instruction.CODE == SyscallInfo.NativeCallSyscallCode)
{
var DelegateId = Memory.Read4(PC + 4);
var SyscallInfoInfo = CpuProcessor.RegisteredNativeSyscallMethods[DelegateId];
SpecialName = SyscallInfoInfo.FunctionEntryName;
var Statements = ast.StatementsInline(
ast.Assign(ast.PC(), PC),
ast.Comment(SyscallInfoInfo.Name),
ast.GetTickCall(true)
);
if (_DynarecConfig.FunctionCallWithStaticReferences)
{
Statements.AddStatement(ast.Statement(ast.CallDelegate(SyscallInfoInfo.PoolItem.AstFieldAccess, ast.CpuThreadState)));
}
else
{
Statements.AddStatement(ast.Statement(ast.CallInstance(ast.CpuThreadState, (Action<uint>)CpuThreadState.Methods.SyscallNative, DelegateId)));
}
Statements.AddStatement(ast.Return());
return Statements;
}
else
{
return ast.StatementsInline(
ast.AssignPC(PC),
ast.GetTickCall(true),
ast.Statement(ast.CallInstance(ast.CpuThreadState, (Action<int>)CpuThreadState.Methods.Syscall, (int)Instruction.CODE))
);
}
}