示例#1
0
        public static void FreeIOMemory(UIntPtr addr,
                                        UIntPtr bytes)
        {
            Tracing.Log(Tracing.Debug, "PageTableService.FreeIOMemory(addr={0:x8}, bytes={1:x})",
                        addr, bytes);

            MemoryManager.FreeIOMemory(addr, bytes, Thread.CurrentProcess);
        }
示例#2
0
 public static void GetUsageStatistics(out ulong allocatedCount,
                                       out ulong allocatedBytes,
                                       out ulong freedCount,
                                       out ulong freedBytes)
 {
     MemoryManager.GetUserStatistics(
         out allocatedCount,
         out allocatedBytes,
         out freedCount,
         out freedBytes);
 }
示例#3
0
        public static UIntPtr Allocate(UIntPtr bytes)
        {
            UIntPtr addr = MemoryManager.UserAllocate(
                MemoryManager.PagesFromBytes(bytes),
                Thread.CurrentProcess, 0, PageType.Unknown);

            Tracing.Log(Tracing.Debug,
                        "PageTableService.Allocate(bytes={0} addr={1:x8}",
                        bytes, addr);

            return(addr);
        }
示例#4
0
        public static void Free(uint addr,
                                uint bytes)
        {
            Tracing.Log(Tracing.Debug, "PageTableService.Free(addr={0:x8}, bytes={1:x})",
                        addr, bytes);

            // We always round up block allocations to the nearest page,
            // so round up when freeing, too.
            MemoryManager.UserFree(addr,
                                   MemoryManager.PagesFromBytes(bytes),
                                   Thread.CurrentProcess);
        }
示例#5
0
        public static UIntPtr AllocateIOMemory(UIntPtr limit,
                                               UIntPtr bytes,
                                               UIntPtr alignment)
        {
            UIntPtr addr = MemoryManager.AllocateIOMemory(
                limit, bytes, alignment, Thread.CurrentProcess);

            Tracing.Log(Tracing.Debug,
                        "PageTableService.AllocateIOMemory(limit={0:x}, bytes={1:x}, alignment={2:x}) addr= {3:x8}",
                        limit, bytes, alignment, addr);

            return(addr);
        }
示例#6
0
        public static uint AllocateExtend(uint addr,
                                          uint bytes)
        {
            uint got = (uint)MemoryManager.UserExtend(
                addr, MemoryManager.PagesFromBytes(bytes),
                Thread.CurrentProcess, PageType.Unknown);

            Tracing.Log(Tracing.Debug,
                        "PageTableService.AllocateExtend(addr={0:x}, bytes={1:x}) addr={2:x8}",
                        addr, bytes, got);

            return(addr);
        }
示例#7
0
        public static uint AllocateIOMemory(uint limit,
                                            uint bytes,
                                            uint alignment)
        {
            uint addr = (uint)MemoryManager.AllocateIOMemory(
                limit, bytes, alignment, Thread.CurrentProcess);

            Tracing.Log(Tracing.Debug,
                        "PageTableService.AllocateIOMemory(limit={0:x}, bytes={1:x}, alignment={2:x}) addr= {3:x8}",
                        limit, bytes, alignment, addr);

            return(addr);
        }
示例#8
0
        public static UIntPtr AllocateExtend(UIntPtr addr,
                                             UIntPtr bytes)
        {
            UIntPtr got = MemoryManager.UserExtend(
                addr, MemoryManager.PagesFromBytes(bytes),
                Thread.CurrentProcess, PageType.Unknown);

            Tracing.Log(Tracing.Debug,
                        "PageTableService.AllocateExtend(addr={0:x}, bytes={1:x}) addr={2:x8}",
                        addr, bytes, got);

            return(got);
        }
示例#9
0
        public static bool Query(UIntPtr queryAddr,
                                 out UIntPtr regionAddr,
                                 out UIntPtr regionSize)
        {
            PageType type = MemoryManager.UserQuery(
                queryAddr, out regionAddr, out regionSize);

            bool used = (type != PageType.Unknown);

            Tracing.Log(Tracing.Debug,
                        "PageTableService.Query(query={0:x8}, addr={1:x8}, size={2:x}) type={3}",
                        queryAddr, regionAddr, regionSize, (uint)type);

            return(used);
        }