summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-06-06 11:20:18 -0700
committerRobert Mustacchi <rm@joyent.com>2011-06-06 11:20:18 -0700
commit6bb635022345ac4ce9bdc4c94734aaa8e38b16b9 (patch)
tree67e2df6df0f22e5f1db704fd953b893e733a2be5
parent8e9a7b5f8ed4ed008e679644c28bc9c43f56f794 (diff)
downloadillumos-kvm-6bb635022345ac4ce9bdc4c94734aaa8e38b16b9.tar.gz
HVM-300 Remove externs from kvm_irq_comm.c
-rw-r--r--kvm.c32
-rw-r--r--kvm_irq_comm.c18
-rw-r--r--kvm_subr.c29
-rw-r--r--kvm_vmx.c1
-rw-r--r--kvm_x86host.h1
5 files changed, 33 insertions, 48 deletions
diff --git a/kvm.c b/kvm.c
index 3fb2a1d..219ba0a 100644
--- a/kvm.c
+++ b/kvm.c
@@ -248,32 +248,6 @@ extern void kvm_mmu_flush_tlb(struct kvm_vcpu *);
extern void kvm_mmu_unload(struct kvm_vcpu *vcpu);
extern int kvm_pic_set_irq(void *, int, int);
-/*
- * Find the first cleared bit in a memory region.
- */
-unsigned long
-find_first_zero_bit(const unsigned long *addr, unsigned long size)
-{
- const unsigned long *p = addr;
- unsigned long result = 0;
- unsigned long tmp;
-
- while (size & ~(64-1)) {
- if (~(tmp = *(p++)))
- goto found;
- result += 64;
- size -= 64;
- }
- if (!size)
- return (result);
-
- tmp = (*p) | (~0UL << size);
- if (tmp == ~0UL) /* Are any bits zero? */
- return (result + size); /* Nope. */
-found:
- return (result + ffz(tmp));
-}
-
static void vmx_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l);
extern void update_exception_bitmap(struct kvm_vcpu *vcpu);
@@ -285,12 +259,6 @@ static int setup_vmcs_config(struct vmcs_config *vmcs_conf);
struct kvm_x86_ops *kvm_x86_ops;
-
-
-
-
-
-
inline int
kvm_exception_is_soft(unsigned int nr)
{
diff --git a/kvm_irq_comm.c b/kvm_irq_comm.c
index 249c07e..519bfbe 100644
--- a/kvm_irq_comm.c
+++ b/kvm_irq_comm.c
@@ -19,27 +19,15 @@
*
*/
+#include <sys/mutex.h>
#include <sys/sysmacros.h>
-/*
- * XXX Need proper header files!
- */
#include "kvm_bitops.h"
-#include "msr.h"
-#include "irqflags.h"
+#include "kvm_apicdef.h"
#include "kvm_msidef.h"
#include "kvm_host.h"
-#include "kvm_x86host.h"
-#include "kvm_iodev.h"
-#include "kvm.h"
-#include "kvm_apicdef.h"
-#include "kvm_lapic.h"
-#include "kvm_ioapic.h"
#include "kvm_irq.h"
-
-extern long find_first_zero_bit(const unsigned long *, unsigned long);
-extern int kvm_pic_set_irq(void *, int, int);
-extern int irqchip_in_kernel(struct kvm *kvm);
+#include "kvm_ioapic.h"
static int
kvm_irq_line_state(unsigned long *irq_state, int irq_source_id, int level)
diff --git a/kvm_subr.c b/kvm_subr.c
index 3b8b49b..7df28b4 100644
--- a/kvm_subr.c
+++ b/kvm_subr.c
@@ -17,6 +17,7 @@
#include <sys/cpuvar.h>
#include <sys/segments.h>
+#include "kvm_bitops.h"
#include "msr.h"
#include "kvm_vmx.h"
#include "irqflags.h"
@@ -277,3 +278,31 @@ kvm_get_gdt(struct descriptor_table *table)
{
__asm__("sgdt %0" : "=m"(*table));
}
+
+/*
+ * Find the first cleared bit in a memory region.
+ */
+unsigned long
+find_first_zero_bit(const unsigned long *addr, unsigned long size)
+{
+ const unsigned long *p = addr;
+ unsigned long result = 0;
+ unsigned long tmp;
+
+ while (size & ~(64-1)) {
+ if (~(tmp = *(p++)))
+ goto found;
+ result += 64;
+ size -= 64;
+ }
+ if (!size)
+ return (result);
+
+ tmp = (*p) | (~0UL << size);
+ if (tmp == ~0UL) /* Are any bits zero? */
+ return (result + size); /* Nope. */
+found:
+ return (result + ffz(tmp));
+}
+
+
diff --git a/kvm_vmx.c b/kvm_vmx.c
index 69df17b..dd2aef5 100644
--- a/kvm_vmx.c
+++ b/kvm_vmx.c
@@ -62,7 +62,6 @@ extern int is_protmode(struct kvm_vcpu *vcpu);
extern kmutex_t vmx_vpid_lock;
extern ulong_t *vmx_vpid_bitmap;
extern size_t vpid_bitmap_words;
-extern long find_first_zero_bit(const unsigned long *, unsigned long);
extern unsigned long native_read_cr0(void);
#define read_cr0() (native_read_cr0())
extern unsigned long native_read_cr4(void);
diff --git a/kvm_x86host.h b/kvm_x86host.h
index bc8bb67..60e6247 100644
--- a/kvm_x86host.h
+++ b/kvm_x86host.h
@@ -828,6 +828,7 @@ void kvm_load_gs(unsigned short sel);
void kvm_load_ldt(unsigned short sel);
void kvm_get_idt(struct descriptor_table *table);
void kvm_get_gdt(struct descriptor_table *table);
+unsigned long find_first_zero_bit(const unsigned long *, unsigned long);
extern unsigned long kvm_read_tr_base(void);