WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Merge with ia64 tree.

# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1195728294 0
# Node ID 980b8d1a5541d8d59ab8db16528d0e076bb31c12
# Parent  53dc1cf505060a06e5b34a4812fce4312743ca26
# Parent  7186e9611d55dc5ab6fd9c6a8bd6e5c674be8c10
Merge with ia64 tree.
---
 tools/libxc/xc_core.c                 |   16 +++++++++++-----
 tools/libxc/xc_core_x86.c             |    4 ++--
 xen/arch/x86/hvm/svm/emulate.c        |    4 ----
 xen/arch/x86/hvm/svm/svm.c            |   29 +++++++++++------------------
 xen/arch/x86/hvm/vmx/vmx.c            |    8 ++++++++
 xen/include/asm-x86/hvm/svm/emulate.h |    2 --
 6 files changed, 32 insertions(+), 31 deletions(-)

diff -r 53dc1cf50506 -r 980b8d1a5541 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Wed Nov 21 09:12:06 2007 -0700
+++ b/tools/libxc/xc_core.c     Thu Nov 22 10:44:54 2007 +0000
@@ -107,16 +107,22 @@ xc_core_strtab_get(struct xc_core_strtab
     uint16_t ret = 0;
     uint16_t len = strlen(name) + 1;
 
+    if ( strtab->current > UINT16_MAX - len )
+    {
+        PERROR("too long string table");
+        errno = E2BIG;
+        return ret;
+    }
+    
     if ( strtab->current + len > strtab->max )
     {
         char *tmp;
-        if ( strtab->max * 2 < strtab->max )
+        if ( strtab->max > UINT16_MAX / 2 )
         {
             PERROR("too long string table");
             errno = ENOMEM;
             return ret;
         }
-
 
         tmp = realloc(strtab->strings, strtab->max * 2);
         if ( tmp == NULL )
@@ -143,8 +149,8 @@ struct xc_core_section_headers {
 
     Elf64_Shdr  *shdrs;
 };
-#define SHDR_INIT       16
-#define SHDR_INC        4U
+#define SHDR_INIT       ((uint16_t)16)
+#define SHDR_INC        ((uint16_t)4)
 
 static struct xc_core_section_headers*
 xc_core_shdr_init(void)
@@ -180,7 +186,7 @@ xc_core_shdr_get(struct xc_core_section_
     if ( sheaders->num == sheaders->num_max )
     {
         Elf64_Shdr *shdrs;
-        if ( sheaders->num_max + SHDR_INC < sheaders->num_max )
+        if ( sheaders->num_max > UINT16_MAX - SHDR_INC )
         {
             errno = E2BIG;
             return NULL;
diff -r 53dc1cf50506 -r 980b8d1a5541 tools/libxc/xc_core_x86.c
--- a/tools/libxc/xc_core_x86.c Wed Nov 21 09:12:06 2007 -0700
+++ b/tools/libxc/xc_core_x86.c Thu Nov 22 10:44:54 2007 +0000
@@ -89,7 +89,7 @@ xc_core_arch_map_p2m(int xc_handle, xc_d
     }
 
     live_p2m_frame_list =
-        xc_map_foreign_batch(xc_handle, dom, PROT_READ,
+        xc_map_foreign_pages(xc_handle, dom, PROT_READ,
                              live_p2m_frame_list_list,
                              P2M_FLL_ENTRIES);
 
@@ -99,7 +99,7 @@ xc_core_arch_map_p2m(int xc_handle, xc_d
         goto out;
     }
 
-    *live_p2m = xc_map_foreign_batch(xc_handle, dom, PROT_READ,
+    *live_p2m = xc_map_foreign_pages(xc_handle, dom, PROT_READ,
                                     live_p2m_frame_list,
                                     P2M_FL_ENTRIES);
 
diff -r 53dc1cf50506 -r 980b8d1a5541 xen/arch/x86/hvm/svm/emulate.c
--- a/xen/arch/x86/hvm/svm/emulate.c    Wed Nov 21 09:12:06 2007 -0700
+++ b/xen/arch/x86/hvm/svm/emulate.c    Thu Nov 22 10:44:54 2007 +0000
@@ -348,8 +348,6 @@ MAKE_INSTR(CPUID,  2, 0x0f, 0xa2);
 MAKE_INSTR(CPUID,  2, 0x0f, 0xa2);
 MAKE_INSTR(RDMSR,  2, 0x0f, 0x32);
 MAKE_INSTR(WRMSR,  2, 0x0f, 0x30);
-MAKE_INSTR(RDTSC,  2, 0x0f, 0x31);
-MAKE_INSTR(RDTSCP, 3, 0x0f, 0x01, 0xf9);
 MAKE_INSTR(CLI,    1, 0xfa);
 MAKE_INSTR(STI,    1, 0xfb);
 MAKE_INSTR(RDPMC,  2, 0x0f, 0x33);
@@ -383,8 +381,6 @@ static const u8 *opc_bytes[INSTR_MAX_COU
     [INSTR_CPUID]  = OPCODE_CPUID,
     [INSTR_RDMSR]  = OPCODE_RDMSR,
     [INSTR_WRMSR]  = OPCODE_WRMSR,
-    [INSTR_RDTSC]  = OPCODE_RDTSC,
-    [INSTR_RDTSCP] = OPCODE_RDTSCP,
     [INSTR_CLI]    = OPCODE_CLI,
     [INSTR_STI]    = OPCODE_STI,
     [INSTR_RDPMC]  = OPCODE_RDPMC,
diff -r 53dc1cf50506 -r 980b8d1a5541 xen/arch/x86/hvm/svm/svm.c
--- a/xen/arch/x86/hvm/svm/svm.c        Wed Nov 21 09:12:06 2007 -0700
+++ b/xen/arch/x86/hvm/svm/svm.c        Thu Nov 22 10:44:54 2007 +0000
@@ -996,6 +996,7 @@ static void svm_do_no_device_fault(struc
 /* Reserved bits EDX: [31:29], [27], [22:20], [18], [10] */
 #define SVM_VCPU_CPUID_L1_EDX_RESERVED 0xe8740400
 
+#define bitmaskof(idx)  (1U << ((idx) & 31))
 static void svm_vmexit_do_cpuid(struct vmcb_struct *vmcb,
                                 struct cpu_user_regs *regs)
 {
@@ -1022,32 +1023,23 @@ static void svm_vmexit_do_cpuid(struct v
         break;
 
     case 0x80000001:
+        /* Filter features which are shared with 0x00000001:EDX. */
         if ( vlapic_hw_disabled(vcpu_vlapic(v)) )
             __clear_bit(X86_FEATURE_APIC & 31, &edx);
-
 #if CONFIG_PAGING_LEVELS >= 3
         if ( !v->domain->arch.hvm_domain.params[HVM_PARAM_PAE_ENABLED] )
 #endif
             __clear_bit(X86_FEATURE_PAE & 31, &edx);
-
         __clear_bit(X86_FEATURE_PSE36 & 31, &edx);
 
-        /* Clear the Cmp_Legacy bit
-         * This bit is supposed to be zero when HTT = 0.
-         * See details on page 23 of AMD CPUID Specification.
-         */
-        __clear_bit(X86_FEATURE_CMP_LEGACY & 31, &ecx);
-
-        /* Make SVM feature invisible to the guest. */
-        __clear_bit(X86_FEATURE_SVME & 31, &ecx);
-        __clear_bit(X86_FEATURE_SKINIT & 31, &ecx);
-
-        __clear_bit(X86_FEATURE_OSVW & 31, &ecx);
-        __clear_bit(X86_FEATURE_WDT & 31, &ecx);
-
-        /* So far, we do not support 3DNow for the guest. */
-        __clear_bit(X86_FEATURE_3DNOW & 31, &edx);
-        __clear_bit(X86_FEATURE_3DNOWEXT & 31, &edx);
+        /* Filter all other features according to a whitelist. */
+        edx &= (0x0183f3ff | /* features shared with 0x00000001:EDX */
+                bitmaskof(X86_FEATURE_NX) |
+                bitmaskof(X86_FEATURE_LM) |
+                bitmaskof(X86_FEATURE_SYSCALL) |
+                bitmaskof(X86_FEATURE_MP) |
+                bitmaskof(X86_FEATURE_MMXEXT) |
+                bitmaskof(X86_FEATURE_FFXSR));
         break;
 
     case 0x80000007:
@@ -2293,6 +2285,7 @@ asmlinkage void svm_vmexit_handler(struc
         hvm_triple_fault();
         break;
 
+    case VMEXIT_RDTSCP:
     case VMEXIT_MONITOR:
     case VMEXIT_MWAIT:
     case VMEXIT_VMRUN:
diff -r 53dc1cf50506 -r 980b8d1a5541 xen/arch/x86/hvm/vmx/vmx.c
--- a/xen/arch/x86/hvm/vmx/vmx.c        Wed Nov 21 09:12:06 2007 -0700
+++ b/xen/arch/x86/hvm/vmx/vmx.c        Thu Nov 22 10:44:54 2007 +0000
@@ -1298,6 +1298,14 @@ static void vmx_do_cpuid(struct cpu_user
     case 0x0000000A:
         eax = ebx = ecx = edx = 0;
         break;
+
+    case 0x80000001:
+        /* Only a few features are advertised in Intel's 0x80000001. */
+        ecx &= (bitmaskof(X86_FEATURE_LAHF_LM));
+        edx &= (bitmaskof(X86_FEATURE_NX) |
+                bitmaskof(X86_FEATURE_LM) |
+                bitmaskof(X86_FEATURE_SYSCALL));
+        break;
     }
 
     regs->eax = eax;
diff -r 53dc1cf50506 -r 980b8d1a5541 xen/include/asm-x86/hvm/svm/emulate.h
--- a/xen/include/asm-x86/hvm/svm/emulate.h     Wed Nov 21 09:12:06 2007 -0700
+++ b/xen/include/asm-x86/hvm/svm/emulate.h     Thu Nov 22 10:44:54 2007 +0000
@@ -47,8 +47,6 @@ enum instruction_index {
     INSTR_CPUID,
     INSTR_RDMSR,
     INSTR_WRMSR,
-    INSTR_RDTSC,
-    INSTR_RDTSCP,
     INSTR_CLI,
     INSTR_STI,
     INSTR_RDPMC,

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>