Exemple #1
0
        public void SvcCall(object sender, InstExceptionEventArgs e)
        {
            ExecutionContext context = (ExecutionContext)sender;

            if (context.IsAarch32)
            {
                var svcFunc = SyscallTable.SvcTable32[e.Id];

                if (svcFunc == null)
                {
                    throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
                }

                svcFunc(_syscall32, context);
            }
            else
            {
                var svcFunc = SyscallTable.SvcTable64[e.Id];

                if (svcFunc == null)
                {
                    throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
                }

                svcFunc(_syscall64, context);
            }

            PostSvcHandler();
        }
Exemple #2
0
        public void SvcCall(object sender, InstExceptionEventArgs e)
        {
            Action <SvcHandler, CpuThreadState> svcFunc = SvcTable.GetSvcFunc(e.Id);

            if (svcFunc == null)
            {
                throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
            }

            CpuThreadState threadState = (CpuThreadState)sender;

            svcFunc(this, threadState);
        }
Exemple #3
0
        public void SvcCall(object sender, InstExceptionEventArgs e)
        {
            Action <SvcHandler, IExecutionContext> svcFunc = SvcTable.GetSvcFunc(e.Id);

            if (svcFunc == null)
            {
                throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
            }

            IExecutionContext context = (IExecutionContext)sender;

            svcFunc(this, context);
        }
        public void SvcCall(object sender, InstExceptionEventArgs e)
        {
            ExecutionContext context = (ExecutionContext)sender;

            Action <SvcHandler, ExecutionContext> svcFunc = context.IsAarch32 ? SvcTable.SvcTable32[e.Id] : SvcTable.SvcTable64[e.Id];

            if (svcFunc == null)
            {
                throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
            }

            svcFunc(this, context);

            PostSvcHandler();
        }
Exemple #5
0
        public void SvcCall(object sender, InstExceptionEventArgs e)
        {
            KThread currentThread = KernelStatic.GetCurrentThread();

            if (currentThread.Owner != null &&
                currentThread.GetUserDisableCount() != 0 &&
                currentThread.Owner.PinnedThreads[currentThread.CurrentCore] == null)
            {
                _context.CriticalSection.Enter();

                currentThread.Owner.PinThread(currentThread);

                currentThread.SetUserInterruptFlag();

                _context.CriticalSection.Leave();
            }

            ExecutionContext context = (ExecutionContext)sender;

            if (context.IsAarch32)
            {
                var svcFunc = SyscallTable.SvcTable32[e.Id];

                if (svcFunc == null)
                {
                    throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
                }

                svcFunc(_syscall32, context);
            }
            else
            {
                var svcFunc = SyscallTable.SvcTable64[e.Id];

                if (svcFunc == null)
                {
                    throw new NotImplementedException($"SVC 0x{e.Id:X4} is not implemented.");
                }

                svcFunc(_syscall64, context);
            }

            currentThread.HandlePostSyscall();
        }
Exemple #6
0
        public void SvcCall(object sender, InstExceptionEventArgs e)
        {
            CpuThreadState ThreadState = (CpuThreadState)sender;

            if (SvcFuncs.TryGetValue(e.Id, out SvcFunc Func))
            {
                Logger.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} called.");

                Func(ThreadState);

                Logger.PrintDebug(LogClass.KernelSvc, $"{Func.Method.Name} ended.");
            }
            else
            {
                //Process.PrintStackTrace(ThreadState);

                throw new NotImplementedException($"0x{e.Id:x4}");
            }
        }
Exemple #7
0
        private void BreakHandler(object sender, InstExceptionEventArgs e)
        {
            PrintStackTraceForCurrentThread();

            throw new GuestBrokeExecutionException();
        }