2 * arch/alpha/lib/clear_user.S
3 * Contributed by Richard Henderson <rth@tamu.edu>
5 * Zero user space, handling exceptions as we go.
7 * We have to make sure that $0 is always up-to-date and contains the
8 * right "bytes left to zero" value (and that it is updated only _after_
9 * a successful copy). There is also some rather minor exception setup
12 #include <asm/export.h>
14 /* Allow an exception for an insn; exit if we get one. */
17 .section __ex_table,"a"; \
19 lda $31, $exception-99b($31); \
35 0: EX( stq_u $31, 0($16) ) # e0 : zero one word
36 subq $0, 8, $0 # .. e1 :
38 addq $16, 8, $16 # .. e1 :
42 1: bic $1, 3, $1 # e0 :
43 beq $1, $tail # .. e1 :
45 2: EX( stq_u $31, 0($16) ) # e0 : zero four words
46 subq $0, 8, $0 # .. e1 :
47 EX( stq_u $31, 8($16) ) # e0 :
48 subq $0, 8, $0 # .. e1 :
49 EX( stq_u $31, 16($16) ) # e0 :
50 subq $0, 8, $0 # .. e1 :
51 EX( stq_u $31, 24($16) ) # e0 :
52 subq $0, 8, $0 # .. e1 :
54 addq $16, 32, $16 # .. e1 :
58 bne $2, 1f # e1 : is there a tail to do?
59 ret $31, ($26), 1 # .. e1 :
61 1: EX( ldq_u $5, 0($16) ) # e0 :
64 mskqh $5, $0, $5 # e0 :
65 EX( stq_u $5, 0($16) ) # e0 :
66 ret $31, ($26), 1 # .. e1 :
70 and $16, 7, $4 # e0 : find dest misalignment
71 beq $0, $zerolength # .. e1 :
72 addq $0, $4, $1 # e0 : bias counter
73 and $1, 7, $2 # e1 : number of bytes in tail
75 beq $4, $loop # .. e1 :
77 EX( ldq_u $5, 0($16) ) # e0 : load dst word to mask back in
78 beq $1, $oneword # .. e1 : sub-word store?
80 mskql $5, $16, $5 # e0 : take care of misaligned head
81 addq $16, 8, $16 # .. e1 :
82 EX( stq_u $5, -8($16) ) # e0 :
83 addq $0, $4, $0 # .. e1 : bytes left -= 8 - misalignment
85 subq $0, 8, $0 # .. e1 :
90 mskql $5, $16, $4 # e0 :
91 mskqh $5, $2, $5 # e0 :
93 EX( stq_u $5, 0($16) ) # e0 :
98 ret $31, ($26), 1 # .. e1 :
101 EXPORT_SYMBOL(__clear_user)