Beispiel #1
0
 public void Setup()
 {
     Ram       = Marshal.AllocHGlobal((IntPtr)AMemoryMgr.RamSize);
     Allocator = new AMemoryAlloc();
     Memory    = new AMemory(Ram, Allocator);
     Memory.Manager.MapPhys(0x1000, 0x1000, 2, AMemoryPerm.Read | AMemoryPerm.Write | AMemoryPerm.Execute);
 }
Beispiel #2
0
 public void Teardown()
 {
     Thread    = null;
     Memory    = null;
     Allocator = null;
     Marshal.FreeHGlobal(Ram);
 }
Beispiel #3
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);
        }
Beispiel #4
0
        public Horizon(Switch Ns)
        {
            this.Ns = Ns;

            IdGen    = new IdPool();
            NvMapIds = new IdPool();

            Handles  = new IdPoolWithObj();
            Fds      = new IdPoolWithObj();
            Displays = new IdPoolWithObj();

            Mutexes  = new ConcurrentDictionary <long, Mutex>();
            CondVars = new ConcurrentDictionary <long, CondVar>();

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

            Allocator = new AMemoryAlloc();

            HidOffset  = Allocator.Alloc(HidSize);
            FontOffset = Allocator.Alloc(FontSize);

            HidSharedMem = new HSharedMem(HidOffset);

            HidSharedMem.MemoryMapped += HidInit;

            HidHandle = Handles.GenerateId(HidSharedMem);

            FontHandle = Handles.GenerateId(new HSharedMem(FontOffset));
        }
Beispiel #5
0
        public void Setup()
        {
            Position = 0x0;
            Size     = 0x1000;

            EntryPoint = Position;

            Ram = Marshal.AllocHGlobal((IntPtr)AMemoryMgr.RamSize);
            ATranslator Translator = new ATranslator();

            Allocator = new AMemoryAlloc();
            Memory    = new AMemory(Ram, Allocator);
            Memory.Manager.MapPhys(Position, Size, 2, AMemoryPerm.Read | AMemoryPerm.Write | AMemoryPerm.Execute);
            Thread = new AThread(Translator, Memory, ThreadPriority.Normal, EntryPoint);
        }
Beispiel #6
0
        public AMemoryMgr(AMemoryAlloc Allocator)
        {
            this.Allocator = Allocator;

            PageTable = new PTEntry[PTLvl0Size][];
        }