[PATCH 4/8] kvm: decode the argument for KVM_CREATE_VCPU ioctl command

Masatake YAMATO yamato at redhat.com
Fri Dec 1 19:05:28 UTC 2017


* kvm.c (kvm_ioctl_create_vcpu): New function.
(kvm_ioctl) <KVM_CREATE_VCPU>: Use it.

Signed-off-by: Masatake YAMATO <yamato at redhat.com>
---
 kvm.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/kvm.c b/kvm.c
index 7497788e..f725f9df 100644
--- a/kvm.c
+++ b/kvm.c
@@ -33,10 +33,21 @@
 #ifdef HAVE_LINUX_KVM_H
 #include <linux/kvm.h>
 
+static int
+kvm_ioctl_create_vcpu(struct tcb *const tcp, const kernel_ulong_t arg)
+{
+	uint32_t cpuid = arg;
+
+	tprintf(", %u", cpuid);
+	return RVAL_IOCTL_DECODED | RVAL_FD;
+}
+
 int
 kvm_ioctl(struct tcb *const tcp, const unsigned int code, const kernel_ulong_t arg)
 {
 	switch (code) {
+	case KVM_CREATE_VCPU:
+		return kvm_ioctl_create_vcpu(tcp, arg);
 	case KVM_CREATE_VM:
 		return RVAL_DECODED | RVAL_FD;
 	case KVM_RUN:
-- 
2.13.6





More information about the Strace-devel mailing list