From: Lauri Kasanen Date: Thu, 27 May 2021 15:34:00 +0000 (+0300) Subject: Also check these ioctls X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4c6c19083b0118c3c560aada5157e204a336e7c7;p=kvm-minippc.git Also check these ioctls --- diff --git a/main.c b/main.c index cf98fe3..f4e8b58 100644 --- a/main.c +++ b/main.c @@ -365,14 +365,16 @@ int main(int argc, char **argv) { .userspace_addr = (uint64_t) ram, .flags = 0 }; - ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion); + if (ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion) == -1) + abort(); region.slot = 1; region.guest_phys_addr = PROGSTART; region.memory_size = binlen; region.userspace_addr = (uint64_t) progmem; region.flags = KVM_MEM_READONLY; - ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion); + if (ioctl(vmfd, KVM_SET_USER_MEMORY_REGION, ®ion) == -1) + abort(); vcpu = ioctl(vmfd, KVM_CREATE_VCPU, (unsigned long)0); const unsigned vcpulen = ioctl(kvm, KVM_GET_VCPU_MMAP_SIZE, NULL);