Exemplo n.º 1
0
        private void InitializeMemoryManager(ProcessCreationFlags flags)
        {
            int addrSpaceBits = (flags & ProcessCreationFlags.AddressSpaceMask) switch
            {
                ProcessCreationFlags.AddressSpace32Bit => 32,
                ProcessCreationFlags.AddressSpace64BitDeprecated => 36,
                ProcessCreationFlags.AddressSpace32BitWithoutAlias => 32,
                ProcessCreationFlags.AddressSpace64Bit => 39,
                _ => 39
            };

            bool for64Bit = flags.HasFlag(ProcessCreationFlags.Is64Bit);

            Context = _contextFactory.Create(KernelContext, 1UL << addrSpaceBits, InvalidAccessHandler, for64Bit);

            // TODO: This should eventually be removed.
            // The GPU shouldn't depend on the CPU memory manager at all.
            if (flags.HasFlag(ProcessCreationFlags.IsApplication))
            {
                KernelContext.Device.Gpu.SetVmm((IVirtualMemoryManagerTracked)CpuMemory);
            }

            if (Context.AddressSpace is MemoryManagerHostMapped)
            {
                MemoryManager = new KPageTableHostMapped(KernelContext, CpuMemory);
            }
            else
            {
                MemoryManager = new KPageTable(KernelContext, CpuMemory);
            }
        }
Exemplo n.º 2
0
        void createProcessTracer_OnFunctionEntered(
            DkmStackWalkFrame frame,
            StackFrameAnalyzer functionAnalyzer,
            out bool suppressExitBreakpoint)
        {
            // If this was not created with CREATE_SUSPENDED, then we can't automatically attach to this
            // child process.
            // TODO(zturner): OR in CREATE_SUSPENDED using WriteProcessMemory, then when the exit bp
            // hits, check if we OR'ed in CREATE_SUSPENDED, and if so, resume the process after the
            // attach.
            ProcessCreationFlags flags = (ProcessCreationFlags)
                                         Convert.ToUInt32(functionAnalyzer.GetArgumentValue(frame, "dwCreationFlags"));

            suppressExitBreakpoint = !flags.HasFlag(ProcessCreationFlags.CREATE_SUSPENDED);
        }
Exemplo n.º 3
0
        private void InitializeMemoryManager(ProcessCreationFlags flags)
        {
            int addrSpaceBits = (flags & ProcessCreationFlags.AddressSpaceMask) switch
            {
                ProcessCreationFlags.AddressSpace32Bit => 32,
                ProcessCreationFlags.AddressSpace64BitDeprecated => 36,
                ProcessCreationFlags.AddressSpace32BitWithoutAlias => 32,
                ProcessCreationFlags.AddressSpace64Bit => 39,
                _ => 39
            };

            bool for64Bit = flags.HasFlag(ProcessCreationFlags.Is64Bit);

            Context = _contextFactory.Create(KernelContext, Pid, 1UL << addrSpaceBits, InvalidAccessHandler, for64Bit);

            MemoryManager = new KPageTable(KernelContext, CpuMemory);
        }
Exemplo n.º 4
0
        private void InitializeMemoryManager(ProcessCreationFlags flags)
        {
            int addrSpaceBits = (flags & ProcessCreationFlags.AddressSpaceMask) switch
            {
                ProcessCreationFlags.AddressSpace32Bit => 32,
                ProcessCreationFlags.AddressSpace64BitDeprecated => 36,
                ProcessCreationFlags.AddressSpace32BitWithoutAlias => 32,
                ProcessCreationFlags.AddressSpace64Bit => 39,
                _ => 39
            };

            Context = _contextFactory.Create(KernelContext.Memory, 1UL << addrSpaceBits, InvalidAccessHandler);

            // TODO: This should eventually be removed.
            // The GPU shouldn't depend on the CPU memory manager at all.
            if (flags.HasFlag(ProcessCreationFlags.IsApplication))
            {
                KernelContext.Device.Gpu.SetVmm((MemoryManager)CpuMemory);
            }

            MemoryManager = new KMemoryManager(KernelContext, CpuMemory);
        }