示例#1
0
        internal void ExecuteSubroutine(AThread Thread, long Position)
        {
            do
            {
                if (EnableCpuTrace)
                {
                    if (!SymbolTable.TryGetValue(Position, out string SubName))
                    {
                        SubName = string.Empty;
                    }

                    CpuTrace?.Invoke(this, new ACpuTraceEventArgs(Position, SubName));
                }

                if (!CachedSubs.TryGetValue(Position, out ATranslatedSub Sub))
                {
                    Sub = TranslateTier0(Thread.Memory, Position);
                }

                if (Sub.ShouldReJit())
                {
                    TranslateTier1(Thread.Memory, Position);
                }

                Position = Sub.Execute(Thread.ThreadState, Thread.Memory);
            }while (Position != 0 && Thread.ThreadState.Running);
        }
示例#2
0
        private void ExecuteSubroutine(CpuThreadState state, long position)
        {
            state.CurrentTranslator = this;

            do
            {
                if (EnableCpuTrace)
                {
                    CpuTrace?.Invoke(this, new CpuTraceEventArgs(position));
                }

                TranslatedSub subroutine = GetOrTranslateSubroutine(state, position);

                position = subroutine.Execute(state, _memory);
            }while (position != 0 && state.Running);

            state.CurrentTranslator = null;
        }
示例#3
0
        private void ExecuteSubroutine(CpuThreadState state, long position)
        {
            state.CurrentTranslator = this;

            do
            {
                if (EnableCpuTrace)
                {
                    CpuTrace?.Invoke(this, new CpuTraceEventArgs(position));
                }

                if (!_cache.TryGetSubroutine(position, out TranslatedSub sub))
                {
                    sub = TranslateLowCq(position, state.GetExecutionMode());
                }

                position = sub.Execute(state, _memory);
            }while (position != 0 && state.Running);

            state.CurrentTranslator = null;
        }
示例#4
0
        public void ExecuteSubroutine(AThread Thread, long Position)
        {
            do
            {
                if (EnableCpuTrace)
                {
                    if (!SymbolTable.TryGetValue(Position, out string SubName))
                    {
                        SubName = string.Empty;
                    }

                    CpuTrace?.Invoke(this, new ACpuTraceEventArgs(Position, SubName));
                }

                if (!CachedSubs.TryGetValue(Position, out ATranslatedSub Sub) || Sub.NeedsReJit)
                {
                    Sub = TranslateSubroutine(Thread.Memory, Position);
                }

                Position = Sub.Execute(Thread.ThreadState, Thread.Memory);
            }while (Position != 0 && KeepRunning);
        }
示例#5
0
        private void ExecuteSubroutineA64(AThreadState State, AMemory Memory, long Position)
        {
            do
            {
                if (EnableCpuTrace)
                {
                    CpuTrace?.Invoke(this, new ACpuTraceEventArgs(Position));
                }

                if (!Cache.TryGetSubroutine(Position, out ATranslatedSub Sub))
                {
                    Sub = TranslateTier0(State, Memory, Position);
                }

                if (Sub.ShouldReJit())
                {
                    TranslateTier1(State, Memory, Position);
                }

                Position = Sub.Execute(State, Memory);
            }while (Position != 0 && State.Running);
        }
示例#6
0
        private void ExecuteSubroutine(CpuThreadState state, MemoryManager memory, long position)
        {
            do
            {
                if (EnableCpuTrace)
                {
                    CpuTrace?.Invoke(this, new CpuTraceEventArgs(position));
                }

                if (!_cache.TryGetSubroutine(position, out TranslatedSub sub))
                {
                    sub = TranslateTier0(memory, position, state.GetExecutionMode());
                }

                if (sub.ShouldReJit())
                {
                    TranslateTier1(memory, position, state.GetExecutionMode());
                }

                position = sub.Execute(state, memory);
            }while (position != 0 && state.Running);
        }
示例#7
0
        public void Execute(ARMeilleure.State.IExecutionContext ctx, ulong address)
        {
            CpuThreadState state = (CpuThreadState)ctx;

            long position = (long)address;

            if (Interlocked.Increment(ref _threadCount) == 1)
            {
                _backgroundTranslator = new Thread(TranslateQueuedSubs);
                _backgroundTranslator.Start();
            }

            state.CurrentTranslator = this;

            do
            {
                if (EnableCpuTrace)
                {
                    CpuTrace?.Invoke(this, new CpuTraceEventArgs(position));
                }

                if (!_cache.TryGetSubroutine(position, out TranslatedSub sub))
                {
                    sub = TranslateLowCq(position, state.GetExecutionMode());
                }

                position = sub.Execute(state, _memory);
            }while (position != 0 && state.Running);

            state.CurrentTranslator = null;

            if (Interlocked.Decrement(ref _threadCount) == 0)
            {
                _queue.ForceSignal();
            }
        }