예제 #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
            };

            Context = _contextFactory.Create(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((IVirtualMemoryManagerTracked)CpuMemory);
            }

            if (Context.AddressSpace is MemoryManagerHostMapped)
            {
                MemoryManager = new KPageTableHostMapped(KernelContext, CpuMemory);
            }
            else
            {
                MemoryManager = new KPageTable(KernelContext, CpuMemory);
            }
        }
예제 #2
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);
        }