# HG changeset patch # User Jerone Young <[EMAIL PROTECTED]> # Date 1193999487 18000 # Node ID 1eeb2919a59229d76aa856e782ebb622aacf5013 # Parent ff04bb3d78f2a6163d08448ee15af35fcf8910d4 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 <[EMAIL PROTECTED]> diff --git a/libkvm/libkvm-x86.c b/libkvm/libkvm-x86.c --- a/libkvm/libkvm-x86.c +++ b/libkvm/libkvm-x86.c @@ -742,3 +742,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-x86.h b/libkvm/libkvm-x86.h --- a/libkvm/libkvm-x86.h +++ b/libkvm/libkvm-x86.h @@ -104,4 +104,19 @@ void kvm_set_cr8(kvm_context_t kvm, int */ __u64 kvm_get_cr8(kvm_context_t kvm, int vcpu); +/*! + * \brief Setup a vcpu's cpuid instruction emulation + * + * Set up a table of cpuid function to cpuid outputs.\n + * + * \param kvm Pointer to the current kvm_context + * \param vcpu Which virtual CPU should be initialized + * \param nent number of entries to be installed + * \param entries cpuid function entries table + * \return 0 on success, or -errno on error + */ +int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent, + struct kvm_cpuid_entry *entries); + + #endif diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c --- a/libkvm/libkvm.c +++ b/libkvm/libkvm.c @@ -863,24 +863,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; diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h --- a/libkvm/libkvm.h +++ b/libkvm/libkvm.h @@ -324,20 +324,6 @@ int kvm_guest_debug(kvm_context_t, int v int kvm_guest_debug(kvm_context_t, int vcpu, struct kvm_debug_guest *dbg); /*! - * \brief Setup a vcpu's cpuid instruction emulation - * - * Set up a table of cpuid function to cpuid outputs.\n - * - * \param kvm Pointer to the current kvm_context - * \param vcpu Which virtual CPU should be initialized - * \param nent number of entries to be installed - * \param entries cpuid function entries table - * \return 0 on success, or -errno on error - */ -int kvm_setup_cpuid(kvm_context_t kvm, int vcpu, int nent, - struct kvm_cpuid_entry *entries); - -/*! * \brief Set a vcpu's signal mask for guest mode * * A vcpu can have different signals blocked in guest mode and user mode. ------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/ _______________________________________________ kvm-devel mailing list kvm-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/kvm-devel