[patch 1/6] remove dead code in ia64_leave_kernel

From: Chen, Kenneth W <kenneth.w.chen_at_intel.com>
Date: 2006-01-31 20:06:58
The code around restoring user backing store in ia64_leave_kernel
is just plain dumb.  ia64_leave_kernel is used for non-syscall
exit path.  When entering the kernel from the user space, we
already preserved the user stack register frame by doing a
cover instruction.  on the way out, ia64_leave_kernel uncondition-
ally bypass a section of code by "br dont_preserve_current_frame"
(pNonSys should always be one in that path).  However, part of
code in the beginning of rbs_switch is used by ia64_leave_syscall
to calculate new "ndirty" bytes since in leave syscall, kernel
have to preserve the current frame and thus needing to re
calculate new ndirty size for loadrs.  Streamline that section of
code into ia64_leave_syscall and remove unneeded reading ar.bsp
in the leave kernel path.

Signed-off-by: Ken Chen <kenneth.w.chen@intel.com>

--- ./arch/ia64/kernel/entry.S.orig	2006-01-02 19:21:10.000000000 -0800
+++ ./arch/ia64/kernel/entry.S	2006-01-22 02:20:46.475278554 -0800
@@ -787,6 +787,13 @@ ENTRY(ia64_leave_syscall)
 
 	mov.m ar.ssd=r0			// M2   clear ar.ssd
 	mov f11=f0			// F    clear f11
+	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
+	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
+	;;
+	sub r19=r19,r16			// calculate total byte size of dirty partition
+	add r18=64,r18			// don't force in0-in7 into memory...
+	;;
+	shl r19=r19,16			// shift size of dirty partition into loadrs pos
 	br.cond.sptk.many rbs_switch	// B
 END(ia64_leave_syscall)
 
@@ -951,32 +958,17 @@ GLOBAL_ENTRY(ia64_leave_kernel)
 (pUStk)	st1 [r18]=r17		// restore current->thread.on_ustack
 	shr.u r18=r19,16	// get byte size of existing "dirty" partition
 	;;
-	mov r16=ar.bsp		// get existing backing store pointer
 	addl r17=THIS_CPU(ia64_phys_stacked_size_p8),r0
 	;;
 	ld4 r17=[r17]		// r17 = cpu_data->phys_stacked_size_p8
 (pKStk)	br.cond.dpnt skip_rbs_switch
 
+rbs_switch:
 	/*
 	 * Restore user backing store.
 	 *
 	 * NOTE: alloc, loadrs, and cover can't be predicated.
-	 */
-(pNonSys) br.cond.dpnt dont_preserve_current_frame
-	cover				// add current frame into dirty partition and set cr.ifs
-	;;
-	mov r19=ar.bsp			// get new backing store pointer
-rbs_switch:
-	sub r16=r16,r18			// krbs = old bsp - size of dirty partition
-	cmp.ne p9,p0=r0,r0		// clear p9 to skip restore of cr.ifs
-	;;
-	sub r19=r19,r16			// calculate total byte size of dirty partition
-	add r18=64,r18			// don't force in0-in7 into memory...
-	;;
-	shl r19=r19,16			// shift size of dirty partition into loadrs position
-	;;
-dont_preserve_current_frame:
-	/*
+	 *
 	 * To prevent leaking bits between the kernel and user-space,
 	 * we must clear the stacked registers in the "invalid" partition here.
 	 * Not pretty, but at least it's fast (3.34 registers/cycle on Itanium,


-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Received on Tue Jan 31 20:07:43 2006

This archive was generated by hypermail 2.1.8 : 2006-01-31 20:07:50 EST