patch-2.1.7 linux/arch/alpha/lib/clear_user.S

Next file: linux/arch/alpha/lib/copy_user.S
Previous file: linux/arch/alpha/kernel/traps.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.6/linux/arch/alpha/lib/clear_user.S linux/arch/alpha/lib/clear_user.S
@@ -25,6 +25,14 @@
  *	$1,$2,$3,$4,$5,$6
  */
 
+/* Allow an exception for an insn; exit if we get one.  */
+#define EX(x,y...)			\
+	99: x,##y;			\
+	.section __ex_table,"a";	\
+	.gprel32 99b;			\
+	lda $31, $exception-99b($31); 	\
+	.text
+
 	.set noat
 	.set noreorder
 	.align 4
@@ -38,7 +46,7 @@
 	and	$1, 3, $4	# e0    :
 	beq	$4, 1f		# .. e1 :
 
-0:	stq_u	$31, 0($6)	# e0    : zero one word
+0:	EX( stq_u $31, 0($6) )	# e0    : zero one word
 	subq	$0, 8, $0	# .. e1 :
 	subq	$4, 1, $4	# e0    :
 	addq	$6, 8, $6	# .. e1 :
@@ -48,13 +56,13 @@
 1:	bic	$1, 3, $1	# e0    :
 	beq	$1, $tail	# .. e1 :
 
-2:	stq_u	$31, 0($6)	# e0    : zero four words
+2:	EX( stq_u $31, 0($6) )	# e0    : zero four words
 	subq	$0, 8, $0	# .. e1 :
-	stq_u	$31, 8($6)	# e0    :
+	EX( stq_u $31, 8($6) )	# e0    :
 	subq	$0, 8, $0	# .. e1 :
-	stq_u	$31, 16($6)	# e0    :
+	EX( stq_u $31, 16($6) )	# e0    :
 	subq	$0, 8, $0	# .. e1 :
-	stq_u	$31, 24($6)	# e0    :
+	EX( stq_u $31, 24($6) )	# e0    :
 	subq	$0, 8, $0	# .. e1 :
 	subq	$1, 4, $1	# e0    :
 	addq	$6, 32, $6	# .. e1 :
@@ -62,35 +70,29 @@
 
 $tail:
 	bne	$2, 1f		# e1    : is there a tail to do?
-
-	stq	$3, 0($7)	# e0    : decrement exception count
 	ret	$31, ($28), 1	# .. e1 :
 
-1:	ldq_u	$5, 0($6)	# e1    :
-	mskqh	$5, $0, $5	# e0    :
-	stq_u	$5, 0($6)	# e0    :
+1:	EX( ldq_u $5, 0($6) )	# e0    :
 	clr	$0		# .. e1 :
-	stq	$3, 0($7)	# e0    : decrement exception count
+	nop			# e1    :
+	mskqh	$5, $0, $5	# e0    :
+	EX( stq_u $5, 0($6) )	# e0    :
 	ret	$31, ($28), 1	# .. e1 :
 
 __clear_user:
-	ldq	$3, 0($7)	# e0    : load exception count for increment
-	beq	$0, $zerolength # .. e1 :
 	and	$6, 7, $4	# e0    : find dest misalignment
-	addq	$0, $4, $1	# e1    : bias counter
-	addq	$3, 1, $5	# e0    :
-	and	$1, 7, $2	# .. e1 : number of bytes in tail
+	beq	$0, $zerolength # .. e1 :
+	addq	$0, $4, $1	# e0    : bias counter
+	and	$1, 7, $2	# e1    : number of bytes in tail
 	srl	$1, 3, $1	# e0    :
-	unop			#       :
-	stq	$5, 0($7)	# e0    : increment exception count
 	beq	$4, $loop	# .. e1 :
 
-	ldq_u	$5, 0($6)	# e0    : load dst word to mask back in
+	EX( ldq_u $5, 0($6) )	# e0    : load dst word to mask back in
 	beq	$1, $oneword	# .. e1 : sub-word store?
 
 	mskql	$5, $6, $5	# e0    : take care of misaligned head
 	addq	$6, 8, $6	# .. e1 :
-	stq_u	$5, -8($6)	# e0    :
+	EX( stq_u $5, -8($6) )	# e0    :
 	addq	$0, $4, $0	# .. e1 : bytes left -= 8 - misalignment
 	subq	$1, 1, $1	# e0    :
 	subq	$0, 8, $0	# .. e1 :
@@ -101,11 +103,11 @@
 	mskql	$5, $6, $4	# e0    :
 	mskqh	$5, $2, $5	# e0    :
 	or	$5, $4, $5	# e1    :
-	stq_u	$5, 0($6)	# e0    :
+	EX( stq_u $5, 0($6) )	# e0    :
 	clr	$0		# .. e1 :
-	stq	$3, 0($7)	# e0    : decrement exception count
 
 $zerolength:
+$exception:
 	ret	$31, ($28), 1	# .. e1 :
 
 	.end __clear_user

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov