Esempio n. 1
0
        public Process(Switch Ns, KProcessScheduler Scheduler, int ProcessId)
        {
            this.Ns        = Ns;
            this.Scheduler = Scheduler;
            this.ProcessId = ProcessId;

            Memory = new AMemory();

            HandleTable = new KProcessHandleTable();

            AppletState = new AppletStateMgr();

            SvcHandler = new SvcHandler(Ns, this);

            TlsSlots = new ConcurrentDictionary <int, AThread>();

            ThreadsByTpidr = new ConcurrentDictionary <long, KThread>();

            Executables = new List <Executable>();

            ImageBase = MemoryRegions.AddrSpaceStart;

            MapRWMemRegion(
                MemoryRegions.TlsPagesAddress,
                MemoryRegions.TlsPagesSize,
                MemoryType.ThreadLocal);
        }
Esempio n. 2
0
        public Process(Switch Ns, AMemoryAlloc Allocator, int ProcessId)
        {
            this.Ns        = Ns;
            this.ProcessId = ProcessId;

            Memory = new AMemory(Ns.Ram, Allocator);

            Scheduler = new KProcessScheduler();

            SvcHandler = new SvcHandler(Ns, this);

            TlsSlots = new ConcurrentDictionary<int, AThread>();

            ThreadsByTpidr = new ConcurrentDictionary<long, HThread>();

            Executables = new List<Executable>();

            ImageBase = 0x8000000;

            Memory.Manager.MapPhys(
                TlsPageAddr,
                TlsTotalSize,
                (int)MemoryType.ThreadLocal,
                AMemoryPerm.RW);
        }
Esempio n. 3
0
        public KProcess(Horizon system) : base(system)
        {
            _processLock   = new object();
            _threadingLock = new object();

            CpuMemory = new MemoryManager(system.Device.Memory.RamPointer);

            CpuMemory.InvalidAccess += InvalidAccessHandler;

            AddressArbiter = new KAddressArbiter(system);

            MemoryManager = new KMemoryManager(system, CpuMemory);

            _fullTlsPages = new SortedDictionary <ulong, KTlsPageInfo>();
            _freeTlsPages = new SortedDictionary <ulong, KTlsPageInfo>();

            Capabilities = new KProcessCapabilities();

            RandomEntropy = new long[KScheduler.CpuCoresCount];

            _threads = new LinkedList <KThread>();

            Translator = new Translator(CpuMemory);

            Translator.CpuTrace += CpuTraceHandler;

            _svcHandler = new SvcHandler(system.Device, this);

            Debugger = new HleProcessDebugger(this);
        }
Esempio n. 4
0
        public Process(Switch Device, KProcessScheduler Scheduler, int ProcessId, Npdm MetaData)
        {
            this.Device    = Device;
            this.Scheduler = Scheduler;
            this.MetaData  = MetaData;
            this.ProcessId = ProcessId;

            Memory = new AMemory(Device.Memory.RamPointer);

            MemoryManager = new KMemoryManager(this);

            TlsPages = new List <KTlsPageManager>();

            ThreadArbiterList = new List <KThread>();

            ThreadSyncLock = new object();

            HandleTable = new KProcessHandleTable();

            AppletState = new AppletStateMgr();

            SvcHandler = new SvcHandler(Device, this);

            Threads = new ConcurrentDictionary <long, KThread>();

            Executables = new List <Executable>();

            ImageBase = MemoryManager.CodeRegionStart;
        }
Esempio n. 5
0
        public Process(Switch Device, int ProcessId, Npdm MetaData)
        {
            this.Device    = Device;
            this.MetaData  = MetaData;
            this.ProcessId = ProcessId;

            Memory = new AMemory(Device.Memory.RamPointer);

            Memory.InvalidAccess += CpuInvalidAccessHandler;

            MemoryManager = new KMemoryManager(this);

            TlsPages = new List <KTlsPageManager>();

            int HandleTableSize = 1024;

            if (MetaData != null)
            {
                foreach (KernelAccessControlItem Item in MetaData.ACI0.KernelAccessControl.Items)
                {
                    if (Item.HasHandleTableSize)
                    {
                        HandleTableSize = Item.HandleTableSize;

                        break;
                    }
                }
            }

            HandleTable = new KProcessHandleTable(Device.System, HandleTableSize);

            AppletState = new AppletStateMgr(Device.System);

            SvcHandler = new SvcHandler(Device, this);

            Threads = new ConcurrentDictionary <long, KThread>();

            Executables = new List <Executable>();

            ImageBase = MemoryManager.CodeRegionStart;
        }
Esempio n. 6
0
        public KProcess(Horizon system) : base(system)
        {
            _processLock   = new object();
            _threadingLock = new object();

            _system = system;

            AddressArbiter = new KAddressArbiter(system);

            _fullTlsPages = new SortedDictionary <ulong, KTlsPageInfo>();
            _freeTlsPages = new SortedDictionary <ulong, KTlsPageInfo>();

            Capabilities = new KProcessCapabilities();

            RandomEntropy = new long[KScheduler.CpuCoresCount];

            _threads = new LinkedList <KThread>();

            _svcHandler = new SvcHandler(system.Device, this);

            Debugger = new HleProcessDebugger(this);
        }