Пример #1
0
        private void SvcCreateTransferMemory(AThreadState ThreadState)
        {
            long Src  = (long)ThreadState.X1;
            long Size = (long)ThreadState.X2;
            int  Perm = (int)ThreadState.X3;

            if (!IsValidPosition(Src))
            {
                Ns.Log.PrintWarning(LogClass.KernelSvc, $"Invalid address {Src:x16}!");

                ThreadState.X0 = MakeError(ErrorModule.Kernel, KernelErr.InvalidMemRange);

                return;
            }

            AMemoryMapInfo MapInfo = Memory.Manager.GetMapInfo(Src);

            Memory.Manager.Reprotect(Src, Size, (AMemoryPerm)Perm);

            HTransferMem TMem = new HTransferMem(Memory, MapInfo.Perm, Src, Size);

            ulong Handle = (ulong)Process.HandleTable.OpenHandle(TMem);

            ThreadState.X0 = 0;
            ThreadState.X1 = Handle;
        }
Пример #2
0
        private void SvcCreateTransferMemory(AThreadState ThreadState)
        {
            long Position = (long)ThreadState.X1;
            long Size     = (long)ThreadState.X2;
            int  Perm     = (int)ThreadState.X3;

            AMemoryMapInfo MapInfo = Memory.Manager.GetMapInfo(Position);

            Memory.Manager.Reprotect(Position, Size, (AMemoryPerm)Perm);

            HTransferMem HndData = new HTransferMem(Memory, MapInfo.Perm, Position, Size);

            int Handle = Ns.Os.Handles.GenerateId(HndData);

            ThreadState.X1 = (ulong)Handle;
            ThreadState.X0 = (int)SvcResult.Success;
        }
Пример #3
0
        private static void SvcCreateTransferMemory(Switch Ns, ARegisters Registers, AMemory Memory)
        {
            long Position = (long)Registers.X1;
            long Size     = (long)Registers.X2;
            int  Perm     = (int)Registers.X3;

            AMemoryMapInfo MapInfo = Memory.Manager.GetMapInfo(Position);

            Memory.Manager.Reprotect(Position, Size, (AMemoryPerm)Perm);

            HTransferMem HndData = new HTransferMem(Memory, MapInfo.Perm, Position, Size);

            int Handle = Ns.Os.Handles.GenerateId(HndData);

            Registers.X1 = (ulong)Handle;
            Registers.X0 = (int)SvcResult.Success;
        }