summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Mustacchi <rm@joyent.com>2011-06-06 14:22:44 -0700
committerRobert Mustacchi <rm@joyent.com>2011-06-06 14:22:44 -0700
commit18e279fbbd087ed9d6d3ce36a0623ca20ec62e0a (patch)
treeedd4716ba3da7eaed3cc94567f82e37457d0989b
parent2bf44f2dccc841c8baa621634e8cf0ceedf1c73c (diff)
downloadillumos-kvm-18e279fbbd087ed9d6d3ce36a0623ca20ec62e0a.tar.gz
HVM-308 Cleanup kvm_mmu.c includes and externs
HVM-306 kvm_cache_regs.h missing forward declarations (cont.)
-rw-r--r--kvm.c11
-rw-r--r--kvm_cache_regs.h3
-rw-r--r--kvm_mmu.c48
-rw-r--r--kvm_subr.c7
-rw-r--r--kvm_x86impl.h5
5 files changed, 19 insertions, 55 deletions
diff --git a/kvm.c b/kvm.c
index 219ba0a..ed45e36 100644
--- a/kvm.c
+++ b/kvm.c
@@ -223,6 +223,7 @@ static void hardware_disable_all(void);
extern int sigprocmask(int, const sigset_t *, sigset_t *);
extern void cli(void);
extern void sti(void);
+extern int zero_constructor(void *, void *, int);
static void kvm_destroy_vm(struct kvm *);
static int kvm_avlmmucmp(const void *, const void *);
@@ -411,16 +412,6 @@ kvm_is_visible_gfn(struct kvm *kvm, gfn_t gfn)
return (0);
}
-
-
-int
-zero_constructor(void *buf, void *arg, int tags)
-{
- bzero(buf, (size_t)arg);
- return (0);
-}
-
-
/*
* List of msr numbers which we expose to userspace through KVM_GET_MSRS
* and KVM_SET_MSRS, and KVM_GET_MSR_INDEX_LIST.
diff --git a/kvm_cache_regs.h b/kvm_cache_regs.h
index 54086e9..b375e9a 100644
--- a/kvm_cache_regs.h
+++ b/kvm_cache_regs.h
@@ -3,10 +3,9 @@
#include <sys/types.h>
+#include "kvm_host.h"
#include "processor-flags.h"
-enum kvm_reg;
-
#define KVM_POSSIBLE_CR0_GUEST_BITS X86_CR0_TS
#define KVM_POSSIBLE_CR4_GUEST_BITS \
(X86_CR4_PVI | X86_CR4_DE | X86_CR4_PCE | X86_CR4_OSFXSR \
diff --git a/kvm_mmu.c b/kvm_mmu.c
index d658b6c..d32967a 100644
--- a/kvm_mmu.c
+++ b/kvm_mmu.c
@@ -1,51 +1,11 @@
#include <sys/sysmacros.h>
-#include "processor-flags.h"
#include "kvm_bitops.h"
-#include "msr.h"
-#include "irqflags.h"
+#include "kvm_cache_regs.h"
+#include "kvm_x86impl.h"
#include "kvm_host.h"
-#include "kvm_x86host.h"
-#include "kvm_iodev.h"
-#include "kvm.h"
-#include "kvm_irq.h"
#include "kvm_mmu.h"
-
-/*
- * XXX
- * We're missing system headers. I'm not usre why it compiles...
- */
-
-/*
- * XXX
- * Yet another set of stupid externs. I look forward to the day that I can just
- * simply get rid of them all!
- */
-extern ulong kvm_read_cr0_bits(struct kvm_vcpu *, ulong);
-extern page_t *alloc_page(size_t, int);
-extern caddr_t page_address(page_t *);
-extern struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *,
- gfn_t);
-extern struct kvm_mmu_page *page_header(kvm_t *, hpa_t);
-extern uint64_t kvm_va2pa(caddr_t va);
-extern void kvm_set_pfn_accessed(struct kvm *, pfn_t);
-extern void kvm_set_pfn_dirty(pfn_t pfn);
-#define virt_to_page(addr) pfn_to_page(hat_getpfnum(kas.a_hat, addr))
-extern void bitmap_zero(unsigned long *, int);
-extern page_t *pfn_to_page(pfn_t);
-void kvm_mmu_flush_tlb(struct kvm_vcpu *);
-extern int kvm_is_mmio_pfn(pfn_t pfn);
-extern void kvm_release_pfn_clean(pfn_t);
-extern void kvm_release_pfn_dirty(pfn_t);
-extern int is_paging(struct kvm_vcpu *vcpu);
-extern uint64_t kvm_pdptr_read(struct kvm_vcpu *, int);
-extern void kvm_inject_page_fault(struct kvm_vcpu *, unsigned long, uint32_t);
-extern int is_long_mode(struct kvm_vcpu *);
-extern int is_pae(struct kvm_vcpu *);
-extern int is_pse(struct kvm_vcpu *vcpu);
-extern gpa_t kvm_mmu_gva_to_gpa_read(struct kvm_vcpu *, gva_t, uint32_t *);
-extern int emulate_instruction(struct kvm_vcpu *, unsigned long, uint16_t, int);
-extern int zero_constructor(void *, void *, int);
+#include "msr-index.h"
/*
* When setting this variable to true it enables Two-Dimensional-Paging
@@ -58,6 +18,8 @@ int tdp_enabled = 0;
static int oos_shadow = 1;
+#define virt_to_page(addr) pfn_to_page(hat_getpfnum(kas.a_hat, addr))
+
#define PT_FIRST_AVAIL_BITS_SHIFT 9
#define PT64_SECOND_AVAIL_BITS_SHIFT 52
diff --git a/kvm_subr.c b/kvm_subr.c
index 2d24aa3..a4230ce 100644
--- a/kvm_subr.c
+++ b/kvm_subr.c
@@ -304,3 +304,10 @@ find_first_zero_bit(const unsigned long *addr, unsigned long size)
found:
return (result + ffz(tmp));
}
+
+int
+zero_constructor(void *buf, void *arg, int tags)
+{
+ bzero(buf, (size_t)arg);
+ return (0);
+}
diff --git a/kvm_x86impl.h b/kvm_x86impl.h
index e4a7811..12014d0 100644
--- a/kvm_x86impl.h
+++ b/kvm_x86impl.h
@@ -26,5 +26,10 @@ inline int is_pse(struct kvm_vcpu *vcpu);
inline int is_paging(struct kvm_vcpu *vcpu);
caddr_t page_address(page_t *page);
+extern page_t *alloc_page(size_t, int);
+extern uint64_t kvm_va2pa(caddr_t va);
+extern void bitmap_zero(unsigned long *, int);
+extern page_t *pfn_to_page(pfn_t);
+extern int zero_constructor(void *, void *, int);
#endif