Ejemplo n.º 1
0
        private void *mmap(uint unknown, uint flags, size_t pages)
        {
            var bytes = pages * 4096;
            var ptr   = (byte *)RawVirtualFrameAllocator.RequestRawVirtalMemoryPages(pages);

            //KernelMessage.WriteLine("mmap: Pages: {0}, Addr: {1:X8}", pages, (uint)ptr);
            for (var i = 0; i < bytes; i++)
            {
                *(ptr + i) = 0;
            }

            return(ptr);
        }
Ejemplo n.º 2
0
        public unsafe static void Setup()
        {
            kmallocAllocator = new Allocator();

            var ptr = (byte *)RawVirtualFrameAllocator.RequestRawVirtalMemoryPages(KMath.AlignValueCeil(Allocator.headSize, 4096));

            for (var i = 0; i < Allocator.headSize; i++)
            {
                *(ptr + i) = 0;
            }
            kmallocAllocator.list_heads = (malloc_meta **)ptr;
            ManagedMemoy.useAllocator   = true;

            KernelMessage.WriteLine("Memory free: {0} MB", (PageFrameManager.PagesAvailable * 4096) / 1024 / 1024);
        }