Skip to contentSkip to conversation

FPU LWP 1/8: extract extended related code into xstate.h and xstate.c

PATCH New Wei Huang 1 participant 1 message May 3, 2011

lore
Share & tools
lore

Wei Huang

author
#0 lore raw

PATCH 1/1 FPU LWP 1/8: extract extended related code into xstate.h and xstate.c

FPU: extract extended related code into xstate.h and xstate.c

Current extended code is mixing with FPU code in i387.c. As part of FPU code cleanup, this patch moves all extended state code into independent files. Not much semantic are changed and most function names are kept untouched, except for xsave() and xsaveopt(). These two functions are combined into a single function.

# HG changeset patch
# User Wei Huang <[email protected]>
# Date 1304447651 18000
# Node ID a2f5b9631b2f61be37127ef5d5b810d6ce71e858 # Parent 10f27b8b3d63959c7a8e15299a7a398b7ff7f230
FPU: extract extended related code into xstate.h and xstate.c

Current extended code is mixing with FPU code in i387.c. As part of FPU code cleanup, this patch moves all extended state code into independent files. Not much semantic are changed and most function names are kept untouched, except for xsave() and xsaveopt(). These two functions are combined into a single function.

xen/arch/x86/Makefile +1 -0
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/Makefile
@@ -56,6 +56,7 @@
 obj-y += crash.o
 obj-y += tboot.o
 obj-y += hpet.o
+obj-y += xstate.o
 
 obj-$(crash_debug) += gdbstub.o
 
xen/arch/x86/cpu/common.c +2 -2
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/cpu/common.c
@@ -5,7 +5,7 @@
 #include <xen/smp.h>
 #include <asm/current.h>
 #include <asm/processor.h>
-#include <asm/i387.h>
+#include <asm/xstate.h>
 #include <asm/msr.h>
 #include <asm/io.h>
 #include <asm/mpspec.h>
@@ -354,7 +354,7 @@
 		clear_bit(X86_FEATURE_XSAVE, boot_cpu_data.x86_capability);
 
 	if ( cpu_has_xsave )
-		xsave_init();
+		xstate_init();
 
 	/*
 	 * The vendor-specific functions might have changed features.  Now
xen/arch/x86/domain.c +4 -3
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/domain.c
@@ -42,6 +42,7 @@
 #include <asm/processor.h>
 #include <asm/desc.h>
 #include <asm/i387.h>
+#include <asm/xstate.h>
 #include <asm/mpspec.h>
 #include <asm/ldt.h>
 #include <asm/hypercall.h>
@@ -419,7 +420,7 @@
 
     v->arch.perdomain_ptes = perdomain_ptes(d, v);
 
-    if ( (rc = xsave_alloc_save_area(v)) != 0 )
+    if ( (rc = xstate_alloc_save_area(v)) != 0 )
         return rc;
     if ( v->arch.xsave_area )
         v->arch.fpu_ctxt = &v->arch.xsave_area->fpu_sse;
@@ -485,7 +486,7 @@
     if ( rc )
     {
         if ( v->arch.xsave_area )
-            xsave_free_save_area(v);
+            xstate_free_save_area(v);
         else
             xfree(v->arch.fpu_ctxt);
         if ( !is_hvm_domain(d) && standalone_trap_ctxt(v) )
@@ -501,7 +502,7 @@
         release_compat_l4(v);
 
     if ( v->arch.xsave_area )
-        xsave_free_save_area(v);
+        xstate_free_save_area(v);
     else
         xfree(v->arch.fpu_ctxt);
 
xen/arch/x86/domctl.c +1 -1
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/domctl.c
@@ -33,7 +33,7 @@
 #include <asm/mem_event.h>
 #include <public/mem_event.h>
 #include <asm/mem_sharing.h>
-#include <asm/i387.h>
+#include <asm/xstate.h>
 
 #ifdef XEN_KDB_CONFIG
 #include "../kdb/include/kdbdefs.h"
xen/arch/x86/hvm/hvm.c +2 -1
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/hvm/hvm.c
@@ -46,6 +46,7 @@
 #include <asm/types.h>
 #include <asm/msr.h>
 #include <asm/i387.h>
+#include <asm/xstate.h>
 #include <asm/traps.h>
 #include <asm/mc146818rtc.h>
 #include <asm/spinlock.h>
@@ -2427,7 +2428,7 @@
         if ( count == 0 && v->arch.xcr0 ) 
         {
             /* reset EBX to default value first */
-            *ebx = XSAVE_AREA_MIN_SIZE; 
+            *ebx = XSTATE_AREA_MIN_SIZE; 
             for ( sub_leaf = 2; sub_leaf < 64; sub_leaf++ )
             {
                 if ( !(v->arch.xcr0 & (1ULL << sub_leaf)) )
xen/arch/x86/hvm/vmx/vmcs.c +1 -0
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/hvm/vmx/vmcs.c
@@ -26,6 +26,7 @@
 #include <asm/cpufeature.h>
 #include <asm/processor.h>
 #include <asm/msr.h>
+#include <asm/xstate.h>
 #include <asm/hvm/hvm.h>
 #include <asm/hvm/io.h>
 #include <asm/hvm/support.h>
xen/arch/x86/i387.c +2 -145

166 lines not on this page · raw message

xen/arch/x86/traps.c +1 -0
diff -r 10f27b8b3d63 -r a2f5b9631b2f xen/arch/x86/traps.c
@@ -58,6 +58,7 @@
 #include <asm/flushtlb.h>
 #include <asm/uaccess.h>
 #include <asm/i387.h>
+#include <asm/xstate.h>
 #include <asm/debugger.h>
 #include <asm/msr.h>
 #include <asm/shared.h>
xen/arch/x86/xstate.c new file +183 -0

183 lines not on this page · raw message

xen/include/asm-x86/i387.h +2 -66

73 lines not on this page · raw message

xen/include/asm-x86/xstate.h new file +68 -0

68 lines not on this page · raw message

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel