Example #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);
        }
Example #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);
        }
Example #3
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;
        }
Example #4
0
        public Horizon(Switch Ns)
        {
            this.Ns = Ns;

            Scheduler = new KProcessScheduler();

            Processes = new ConcurrentDictionary <int, Process>();

            HidSharedMem  = new HSharedMem();
            FontSharedMem = new HSharedMem();

            VsyncEvent = new KEvent();
        }
Example #5
0
        public Horizon(Switch Ns)
        {
            this.Ns = Ns;

            Scheduler = new KProcessScheduler(Ns.Log);

            Processes = new ConcurrentDictionary <int, Process>();

            SystemState = new SystemStateMgr();

            Allocator = new MemoryAllocator();

            HidSharedMem  = new HSharedMem();
            FontSharedMem = new HSharedMem();

            VsyncEvent = new KEvent();
        }
Example #6
0
        public Horizon(Switch Device)
        {
            this.Device = Device;

            Scheduler = new KProcessScheduler(Device.Log);

            Processes = new ConcurrentDictionary <int, Process>();

            State = new SystemStateMgr();

            if (!Device.Memory.Allocator.TryAllocate(HidSize, out long HidPA) ||
                !Device.Memory.Allocator.TryAllocate(FontSize, out long FontPA))
            {
                throw new InvalidOperationException();
            }

            HidSharedMem  = new KSharedMemory(HidPA, HidSize);
            FontSharedMem = new KSharedMemory(FontPA, FontSize);

            Font = new SharedFontManager(Device, FontSharedMem.PA);

            VsyncEvent = new KEvent();
        }