Exemple #1
0
 public MmappedRegion(SafeUnixHandle handle, int size = 0x1000, int offset = 0)
 {
     Pointer = Mmap(null, Length = (ulong)size, 4 | 2, 1, (int)handle.DangerousGetHandle(), (ulong)offset);
     if (Pointer == null)
     {
         throw new KvmException("Could not mmap region");
     }
 }
Exemple #2
0
 internal RegWrapper(SafeUnixHandle handle, ulong @base, ulong stride)
 {
     Handle = handle;
     Base   = @base;
     Stride = stride;
 }
Exemple #3
0
 internal VecWrapper(SafeUnixHandle handle, ulong @base)
 {
     Handle = handle;
     Base   = @base;
 }
Exemple #4
0
 internal static bool VcpuSetGuestDebug(SafeUnixHandle handle, KvmGuestDebug debug)
 => Ioctl(handle, KVM_SET_GUEST_DEBUG, &debug) == 0;
Exemple #5
0
 internal static bool VcpuSetOneReg(SafeUnixHandle handle, KvmOneReg reg)
 => Ioctl(handle, KVM_SET_ONE_REG, &reg) == 0;
Exemple #6
0
 internal static bool VmArmPreferredTarget(SafeUnixHandle handle, out KvmVcpuInit init) {
     fixed(KvmVcpuInit *ptr = &init)
     return(Ioctl(handle, KVM_ARM_PREFERRED_TARGET, ptr) == 0);
 }
Exemple #7
0
 internal static bool VcpuArmInit(SafeUnixHandle handle, KvmVcpuInit init)
 => Ioctl(handle, KVM_ARM_VCPU_INIT, &init) == 0;
Exemple #8
0
 internal static SafeUnixHandle VmCreateVcpu(SafeUnixHandle handle, int id) => IoctlHandle(handle, KVM_CREATE_VCPU);
Exemple #9
0
 internal static bool VcpuRun(SafeUnixHandle handle) => Ioctl(handle, KVM_RUN) == 0;
Exemple #10
0
 internal static SafeUnixHandle KvmCreateVm(SafeUnixHandle handle) => IoctlHandle(handle, KVM_CREATE_VM);
Exemple #11
0
 internal static int VmSetUserMemoryRegion(SafeUnixHandle handle, KvmUserspaceMemoryRegion region) =>
 Ioctl(handle, KVM_SET_USER_MEMORY_REGION, &region);
Exemple #12
0
 internal static uint KvmGetApiVersion(SafeUnixHandle handle) => (uint)Ioctl(handle, KVM_GET_API_VERSION);
Exemple #13
0
 internal static SafeUnixHandle IoctlHandle(SafeUnixHandle handle, uint request, int param) => IoctlHandle(handle, request, (void *)(uint)param);
Exemple #14
0
 internal static SafeUnixHandle IoctlHandle(SafeUnixHandle handle, uint request) => IoctlHandle(handle, request, null);
Exemple #15
0
 internal static int Ioctl(SafeUnixHandle handle, uint request) => Ioctl(handle, request, null);
Exemple #16
0
 internal static extern SafeUnixHandle IoctlHandle(SafeUnixHandle handle, uint request, void *buffer);