public override T Execute <T>(params object[] arguments) { using (SPEWrapper spe = new SPEWrapper()) { //TODO: Should be cached? spe.LoadELF(m_elf); LSBitConverter conv = new LSBitConverter(spe.LS); SPEObjectManager manager = new SPEObjectManager(conv); if (manager.ObjectTable.Memsize != spe.Size) { throw new Exception(string.Format("Unexpected size in loaded ELF {0} should be {1}", manager.ObjectTable.Memsize, spe.Size)); } Dictionary <uint, int> transferedObjects = base.LoadInitialArguments(conv, manager, arguments); int r = spe.Run(new CallbackHandlerDelegate(spe_callback)); if (r != (SPEJITCompiler.STOP_SUCCESSFULL & 0xff)) { throw new Exception("Unexpected return code: " + r); } return(base.FinalizeAndReturn <T>(conv, manager, transferedObjects, arguments)); } }
private bool spe_callback(IntPtr ls, uint offset) { //Console.WriteLine("Callback with ls: {0}, offset: {1}", ls.ToInt64(), offset); SPEEmulator.IEndianBitConverter conv = new LSBitConverter(ls); return(base.MethodCallback(conv, offset)); }