[PATCH 16 of 17] Move kvm_setup_cpuid to libkvm-x86.c

Jerone Young
2007-11-06T16:48:57Z

# Date 1194367666 21600
# Node ID 43dc6f59e0944c18b2cbd092c819b4141889ee61
# Parent f610c78e9f363a53b3e9677aa84873b05a692acb
Move kvm_setup_cpuid to libkvm-x86.c

cpuid is an x86 instruction, so needs to go
in the approriate place.

Signed-off-by: Jerone Young <jyoung5-r/Jw6+rmf7HQT0dZR+AlfA@public.gmane.org>

diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c
--- a/libkvm/libkvm-x86.c
+++ b/libkvm/libkvm-x86.c
@@ -728,3 +728,21 @@ __u64 kvm_get_cr8(kvm_context_t kvm, int
return kvm->run[vcpu]->cr8;
}

+int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
+ struct kvm_cpuid_entry *entries)
+{
+ struct kvm_cpuid *cpuid;
+ int r;
+
+ cpuid = malloc(sizeof(*cpuid) + nent * sizeof(*entries));
+ if (!cpuid)
+ return -ENOMEM;
+
+ cpuid->nent = nent;
+ memcpy(cpuid->entries, entries, nent * sizeof(*entries));
+ r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_CPUID, cpuid);
+
+ free(cpuid);
+ return r;
+}
+
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -919,24 +919,6 @@ int kvm_guest_debug(kvm_context_t kvm, i
return ioctl(kvm->vcpu_fd[vcpu], KVM_DEBUG_GUEST, dbg);
}

-int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent,
- struct kvm_cpuid_entry *entries)
-{
- struct kvm_cpuid *cpuid;
- int r;
-
- cpuid = malloc(sizeof(*cpuid) + nent * sizeof(*entries));
- if (!cpuid)
- return -ENOMEM;
-
- cpuid->nent = nent;
- memcpy(cpuid->entries, entries, nent * sizeof(*entries));
- r = ioctl(kvm->vcpu_fd[vcpu], KVM_SET_CPUID, cpuid);
-
- free(cpuid);
- return r;
-}
-
int kvm_set_signal_mask(kvm_context_t kvm, int vcpu, const sigset_t *sigset)
{
struct kvm_signal_mask *sigmask;