示例#1
0
 def to_handle(cffi_ptr) -> Pointer[NativeFunction]:
     pointer_int = int(ffi.cast('ssize_t', cffi_ptr))
     # TODO we're just making up a memory mapping that this pointer is inside;
     # we should figure out the actual mapping, and the size for that matter.
     mapping = MemoryMapping(task,
                             near.MemoryMapping(pointer_int, 0, 1),
                             far.File())
     return Pointer(mapping, NullGateway(), NativeFunctionSerializer(),
                    StaticAllocation())
示例#2
0
文件: ram.py 项目: dholth/rsyscall
 async def malloc(
         self, size: int,
         alignment: int) -> t.Tuple[MemoryMapping, AllocationInterface]:
     self.allocations.append((size, alignment))
     return (
         MemoryMapping(t.cast(Task, None),
                       near.MemoryMapping(0, size, 4096), far.File()),
         NullAllocation(size),
     )