repository: /home/avi/kvm
branch: master
commit 2efce2afd0e615d5bc98d81706594fbc5f1c681c
Author: Izik Eidus <[EMAIL PROTECTED]>
Date:   Sat Oct 27 21:12:23 2007 +0200

    this make kvmctl use the KVM_CAP_SET_TSS_ADDR
    it allow you to set where the tss memory should be mapped
    
    Signed-off-by: Izik Eidus <[EMAIL PROTECTED]>

diff --git a/user/kvmctl.c b/user/kvmctl.c
index 839e527..456df8f 100644
--- a/user/kvmctl.c
+++ b/user/kvmctl.c
@@ -451,6 +451,46 @@ int kvm_create_vm(kvm_context_t kvm)
        return 0;
 }
 
+int kvm_set_tss_addr(kvm_context_t kvm, unsigned long addr)
+{
+#ifdef KVM_CAP_SET_TSS_ADDR
+       int r;
+
+       r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
+       if (r > 0) {
+               r = ioctl(kvm->vm_fd, KVM_SET_TSS_ADDR, addr);
+               if (r == -1) {
+                       fprintf(stderr, "kvm_set_tss_addr: %m\n");
+                       return -errno;
+               }
+               return 0;
+       }
+#endif
+       return -1;
+}
+
+static int kvm_init_tss(kvm_context_t kvm)
+{
+#ifdef KVM_CAP_SET_TSS_ADDR
+       int r;
+
+       r = ioctl(kvm->fd, KVM_CHECK_EXTENSION, KVM_CAP_SET_TSS_ADDR);
+       if (r > 0) {
+               /*
+                * this address is 3 pages before the bios, and the bios should 
present
+                * as unavaible memory
+                */
+               r = kvm_set_tss_addr(kvm, 0xfffbd000);
+               if (r < 0) {
+                       printf("kvm_init_tss: unable to set tss addr\n");
+                       return r;
+               }
+
+       }
+#endif
+       return 0;
+}
+
 static int kvm_create_default_phys_mem(kvm_context_t kvm,
                                       unsigned long phys_mem_bytes,
                                       void **vm_mem)
@@ -504,6 +544,9 @@ int kvm_create(kvm_context_t kvm, unsigned long 
phys_mem_bytes, void **vm_mem)
        r = kvm_create_vm(kvm);
        if (r < 0)
                return r;
+       r = kvm_init_tss(kvm);
+       if (r < 0)
+               return r;
        r = kvm_create_default_phys_mem(kvm, phys_mem_bytes, vm_mem);
        if (r < 0)
                return r;
diff --git a/user/kvmctl.h b/user/kvmctl.h
index fd2600d..26a6eee 100644
--- a/user/kvmctl.h
+++ b/user/kvmctl.h
@@ -412,6 +412,8 @@ int kvm_dump_vcpu(kvm_context_t kvm, int vcpu);
  */
 void kvm_show_regs(kvm_context_t kvm, int vcpu);
 
+int kvm_set_tss_addr(kvm_context_t kvm, unsigned long addr);
+
 void *kvm_create_phys_mem(kvm_context_t, unsigned long phys_start, 
                          unsigned long len, int slot, int log, int writable);
 void kvm_destroy_phys_mem(kvm_context_t, unsigned long phys_start, 

-------------------------------------------------------------------------
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-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to