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 * NOTE! This is not directly C-callable, because the calling semantics
17 * destination address in $6
18 * exception pointer in $7
19 * return address in $28 (exceptions expect it there)
22 * bytes left to copy in $0
27 #include <asm/export.h>
29 /* Allow an exception for an insn; exit if we get one. */
32 .section __ex_table,"a"; \
34 lda $31, $exception-99b($31); \
41 .globl __do_clear_user
50 0: EX( stq_u $31, 0($6) ) # e0 : zero one word
51 subq $0, 8, $0 # .. e1 :
53 addq $6, 8, $6 # .. e1 :
57 1: bic $1, 3, $1 # e0 :
58 beq $1, $tail # .. e1 :
60 2: EX( stq_u $31, 0($6) ) # e0 : zero four words
61 subq $0, 8, $0 # .. e1 :
62 EX( stq_u $31, 8($6) ) # e0 :
63 subq $0, 8, $0 # .. e1 :
64 EX( stq_u $31, 16($6) ) # e0 :
65 subq $0, 8, $0 # .. e1 :
66 EX( stq_u $31, 24($6) ) # e0 :
67 subq $0, 8, $0 # .. e1 :
69 addq $6, 32, $6 # .. e1 :
73 bne $2, 1f # e1 : is there a tail to do?
74 ret $31, ($28), 1 # .. e1 :
76 1: EX( ldq_u $5, 0($6) ) # e0 :
79 mskqh $5, $0, $5 # e0 :
80 EX( stq_u $5, 0($6) ) # e0 :
81 ret $31, ($28), 1 # .. e1 :
84 and $6, 7, $4 # e0 : find dest misalignment
85 beq $0, $zerolength # .. e1 :
86 addq $0, $4, $1 # e0 : bias counter
87 and $1, 7, $2 # e1 : number of bytes in tail
89 beq $4, $loop # .. e1 :
91 EX( ldq_u $5, 0($6) ) # e0 : load dst word to mask back in
92 beq $1, $oneword # .. e1 : sub-word store?
94 mskql $5, $6, $5 # e0 : take care of misaligned head
95 addq $6, 8, $6 # .. e1 :
96 EX( stq_u $5, -8($6) ) # e0 :
97 addq $0, $4, $0 # .. e1 : bytes left -= 8 - misalignment
99 subq $0, 8, $0 # .. e1 :
104 mskql $5, $6, $4 # e0 :
105 mskqh $5, $2, $5 # e0 :
107 EX( stq_u $5, 0($6) ) # e0 :
112 ret $31, ($28), 1 # .. e1 :
115 EXPORT_SYMBOL(__do_clear_user)