[PATCH 16 of 19] Move kvm_get_apic to libkvm-x86.c

Jerone Young
2007-11-02T18:25:05Z

# Date 1194027873 18000
# Node ID 7e750325679dd770206ec6da84f00a4dc4be1b2c
# Parent df89e9282fd9f491579b42624565bac580f7db8e
Move kvm_get_apic to libkvm-x86.c

Moves apic function since it is x86 only.

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
@@ -757,4 +757,12 @@ void kvm_show_regs(kvm_context_t kvm, in
sregs.efer);
}

-
+uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu)
+{
+ struct kvm_run *run = kvm->run[vcpu];
+
+ if (kvm_abi == 10)
+ return ((struct kvm_run_abi10 *)run)->apic_base;
+ return run->apic_base;
+}
+
diff --git a/libkvm/libkvm-x86.h b/libkvm/libkvm-x86.h
--- a/libkvm/libkvm-x86.h
+++ b/libkvm/libkvm-x86.h
@@ -70,4 +70,16 @@ void kvm_show_regs(kvm_context_t kvm, in
void kvm_show_regs(kvm_context_t kvm, int vcpu);

+/*!
+ * \brief Get the value of the APIC_BASE msr as of last exit to userspace
+ *
+ * This gets the APIC_BASE msr as it was on the last exit to userspace.
+ *
+ * \param kvm Pointer to the current kvm_context
+ * \param vcpu Which virtual CPU should get dumped
+ * \return APIC_BASE msr contents
+ */
+uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu);
+
+
#endif
diff --git a/libkvm/libkvm.c b/libkvm/libkvm.c
--- a/libkvm/libkvm.c
+++ b/libkvm/libkvm.c
@@ -718,15 +718,6 @@ int kvm_get_interrupt_flag(kvm_context_t
return run->if_flag;
}

-uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu)
-{
- struct kvm_run *run = kvm->run[vcpu];
-
- if (kvm_abi == 10)
- return ((struct kvm_run_abi10 *)run)->apic_base;
- return run->apic_base;
-}
-
int kvm_is_ready_for_interrupt_injection(kvm_context_t kvm, int vcpu)
{
struct kvm_run *run = kvm->run[vcpu];
diff --git a/libkvm/libkvm.h b/libkvm/libkvm.h
--- a/libkvm/libkvm.h
+++ b/libkvm/libkvm.h
@@ -204,17 +204,6 @@ int kvm_get_interrupt_flag(kvm_context_t
int kvm_get_interrupt_flag(kvm_context_t kvm, int vcpu);

/*!
- * \brief Get the value of the APIC_BASE msr as of last exit to userspace
- *
- * This gets the APIC_BASE msr as it was on the last exit to userspace.
- *
- * \param kvm Pointer to the current kvm_context
- * \param vcpu Which virtual CPU should get dumped
- * \return APIC_BASE msr contents
- */
-uint64_t kvm_get_apic_base(kvm_context_t kvm, int vcpu);
-
-/*!
* \brief Check if a vcpu is ready for interrupt injection
*
* This checks if vcpu interrupts are not masked by mov ss or sti.