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-ia64-devel

[Xen-ia64-devel] [PATCH 6/7] vti fault handler clean up: Don't overwrite

To: xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-ia64-devel] [PATCH 6/7] vti fault handler clean up: Don't overwrite guest mode register
From: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Date: Thu, 22 Nov 2007 16:07:09 +0900
Cc: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
Delivery-date: Wed, 21 Nov 2007 23:08:00 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ia64-devel-request@lists.xensource.com?subject=help>
List-id: Discussion of the ia64 port of Xen <xen-ia64-devel.lists.xensource.com>
List-post: <mailto:xen-ia64-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ia64-devel>, <mailto:xen-ia64-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-ia64-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.4.2.1i
# HG changeset patch
# User yamahata@xxxxxxxxxxxxx
# Date 1195702687 -32400
# Node ID b771d4cc5bf79473c2b99a2215f9114f37f9085a
# Parent  ebf5a3fd7f6f3b2df485bddd772002a81f14bcb3
Don't overwrite guest mode register in vmx fault handler.
Set pKStk and pUStk in VMX_DO_SAVE_MIN and use them to get the correct
place to save registers.
PATCHNAME: set_pkstk_pustk

Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>

diff -r ebf5a3fd7f6f -r b771d4cc5bf7 xen/arch/ia64/vmx/vmx_minstate.h
--- a/xen/arch/ia64/vmx/vmx_minstate.h  Wed Nov 21 16:51:29 2007 +0900
+++ b/xen/arch/ia64/vmx/vmx_minstate.h  Thu Nov 22 12:38:07 2007 +0900
@@ -35,19 +35,21 @@
 #include "entry.h"
 
 #define VMX_MINSTATE_START_SAVE_MIN                                            
                 \
-    mov ar.rsc=0;       /* set enforced lazy mode, pl 0, little-endian, 
loadrs=0 */             \
-    ;;                                                                         
                 \
-    mov.m r28=ar.rnat;                                                         
                 \
-    addl r22=IA64_RBS_OFFSET,r1;                        /* compute base of RBS 
*/               \
-    ;;                                                                         
                 \
-    lfetch.fault.excl.nt1 [r22];                                               
                 \
-    addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;       /* compute base of 
memory stack */      \
-    mov r23=ar.bspstore;                                /* save ar.bspstore */ 
                 \
-    ;;                                                                         
                 \
-    mov ar.bspstore=r22;                                /* switch to kernel 
RBS */              \
-    ;;                                                                         
                 \
-    mov r18=ar.bsp;                                                            
                 \
-    mov ar.rsc=0x3;     /* set eager mode, pl 0, little-endian, loadrs=0 */
+(pUStk) mov ar.rsc=0;           /* set enforced lazy mode, pl 0, 
little-endian, loadrs=0 */     \
+        ;;                                                                     
                 \
+(pUStk) mov.m r28=ar.rnat;                                                     
                 \
+(pUStk) addl r22=IA64_RBS_OFFSET,r1;                    /* compute base of RBS 
*/               \
+(pKStk) mov r1=sp                                       /* get sp  */          
                 \
+        ;;                                                                     
                 \
+(pUStk) lfetch.fault.excl.nt1 [r22];                                           
                 \
+(pUStk) addl r1=IA64_STK_OFFSET-IA64_PT_REGS_SIZE,r1;   /* compute base of 
memory stack */      \
+(pUStk) mov r23=ar.bspstore;                            /* save ar.bspstore */ 
                 \
+        ;;                                                                     
                 \
+(pUStk) mov ar.bspstore=r22;                            /* switch to kernel 
RBS */              \
+(pKStk) addl r1=-IA64_PT_REGS_SIZE,r1;                  /* if in kernel mode, 
use sp (r12) */   \
+        ;;                                                                     
                 \
+(pUStk) mov r18=ar.bsp;                                                        
                 \
+(pUStk) mov ar.rsc=0x3;         /* set eager mode, pl 0, little-endian, 
loadrs=0 */
 
 #define VMX_MINSTATE_END_SAVE_MIN                                              
                 \
     bsw.1;              /* switch back to bank 1 (must be last in insn group) 
*/                \
@@ -55,24 +57,24 @@
 
 #define PAL_VSA_SYNC_READ                               \
     /* begin to call pal vps sync_read */               \
-    add r25=IA64_VPD_BASE_OFFSET, r21;                  \
-    movl r20=__vsa_base;                                \
-    ;;                                                  \
-    ld8 r25=[r25];              /* read vpd base */     \
-    ld8 r20=[r20];              /* read entry point */  \
-    ;;                                                  \
-    add r20=PAL_VPS_SYNC_READ,r20;                      \
+(pUStk) add r25=IA64_VPD_BASE_OFFSET, r21;              \
+(pUStk) movl r20=__vsa_base;                            \
+    ;;                                                  \
+(pUStk) ld8 r25=[r25];          /* read vpd base */     \
+(pUStk) ld8 r20=[r20];          /* read entry point */  \
+    ;;                                                  \
+(pUStk) add r20=PAL_VPS_SYNC_READ,r20;                  \
     ;;                                                  \
 { .mii;                                                 \
-    nop 0x0;                                            \
-    mov r24=ip;                                         \
-    mov b0=r20;                                         \
+(pUStk) nop 0x0;                                        \
+(pUStk) mov r24=ip;                                     \
+(pUStk) mov b0=r20;                                     \
     ;;                                                  \
 };                                                      \
 { .mmb;                                                 \
-    add r24 = 0x20, r24;                                \
-    nop 0x0;                                            \
-    br.cond.sptk b0;        /*  call the service */     \
+(pUStk) add r24 = 0x20, r24;                            \
+(pUStk) nop 0x0;                                        \
+(pUStk) br.cond.sptk b0;        /*  call the service */ \
     ;;                                                  \
 };
 
@@ -128,9 +130,10 @@
     mov r18=cr.isr;                                                            
         \
     COVER;                              /* B;; (or nothing) */                 
         \
     ;;                                                                         
         \
-    tbit.z p6,p0=r29,IA64_PSR_VM_BIT;                                          
         \
-    ;;                                                                         
         \
-    tbit.nz.or p6,p0=r18,IA64_ISR_NI_BIT;                                      
         \
+    cmp.eq p6,p0=r0,r0;                                                        
         \
+    tbit.z pKStk,pUStk=r29,IA64_PSR_VM_BIT;                                    
         \
+    ;;                                                                         
         \
+(pUStk) tbit.nz.and p6,p0=r18,IA64_ISR_NI_BIT;                                 
         \
     ;;                                                                         
         \
     P6_BR_VMX_PANIC                                                            
         \
     tbit.z p0,p15=r29,IA64_PSR_I_BIT;                                          
         \
@@ -154,6 +157,7 @@
         ;;                                                                     
         \
     adds r16=PT(R8),r1; /* initialize first base pointer */                    
         \
     adds r17=PT(R9),r1; /* initialize second base pointer */                   
         \
+(pKStk) mov r18=r0;     /* make sure r18 isn't NaT */                          
         \
     ;;                                                                         
         \
 .mem.offset 0,0; st8.spill [r16]=r8,16;                                        
         \
 .mem.offset 8,0; st8.spill [r17]=r9,16;                                        
         \
@@ -166,17 +170,19 @@
     ;;                                                                         
         \
     st8 [r16]=r9,16;    /* save cr.iip */                                      
         \
     st8 [r17]=r30,16;   /* save cr.ifs */                                      
         \
-    sub r18=r18,r22;    /* r18=RSE.ndirty*8 */                                 
         \
+(pUStk) sub r18=r18,r22;/* r18=RSE.ndirty*8 */                                 
         \
     ;;                                                                         
         \
     st8 [r16]=r25,16;   /* save ar.unat */                                     
         \
     st8 [r17]=r26,16;    /* save ar.pfs */                                     
         \
     shl r18=r18,16;     /* compute ar.rsc to be used for "loadrs" */           
         \
     ;;                                                                         
         \
     st8 [r16]=r27,16;   /* save ar.rsc */                                      
         \
-    st8 [r17]=r28,16;   /* save ar.rnat */                                     
         \
+(pUStk) st8 [r17]=r28,16;/* save ar.rnat */                                    
         \
+(pKStk) adds r17=16,r17;/* skip over ar_rnat field */                          
         \
     ;;                  /* avoid RAW on r16 & r17 */                           
         \
-    st8 [r16]=r23,16;   /* save ar.bspstore */                                 
         \
+(pUStk) st8 [r16]=r23,16;   /* save ar.bspstore */                             
         \
     st8 [r17]=r31,16;   /* save predicates */                                  
         \
+(pKStk) adds r16=16,r16;    /* skip over ar_bspstore field */                  
         \
     ;;                                                                         
         \
     st8 [r16]=r29,16;   /* save b0 */                                          
         \
     st8 [r17]=r18,16;   /* save ar.rsc value for "loadrs" */                   
         \

Attachment: 16423_b771d4cc5bf7_set_pkstk_pustk.patch
Description: Text Data

_______________________________________________
Xen-ia64-devel mailing list
Xen-ia64-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ia64-devel
<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-ia64-devel] [PATCH 6/7] vti fault handler clean up: Don't overwrite guest mode register, Isaku Yamahata <=