1/* 2 * arch/alpha/lib/clear_user.S 3 * Contributed by Richard Henderson <rth@tamu.edu> 4 * 5 * Zero user space, handling exceptions as we go. 6 * 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 10 * stuff. 11 */ 12#include <asm/export.h> 13 14/* Allow an exception for an insn; exit if we get one. */ 15#define EX(x,y...) \ 16 99: x,##y; \ 17 .section __ex_table,"a"; \ 18 .long 99b - .; \ 19 lda $31, $exception-99b($31); \ 20 .previous 21 22 .set noat 23 .set noreorder 24 .align 4 25 26 .globl __clear_user 27 .ent __clear_user 28 .frame $30, 0, $26 29 .prologue 0 30 31$loop: 32 and $1, 3, $4 # e0 : 33 beq $4, 1f # .. e1 : 34 350: EX( stq_u $31, 0($16) ) # e0 : zero one word 36 subq $0, 8, $0 # .. e1 : 37 subq $4, 1, $4 # e0 : 38 addq $16, 8, $16 # .. e1 : 39 bne $4, 0b # e1 : 40 unop # : 41 421: bic $1, 3, $1 # e0 : 43 beq $1, $tail # .. e1 : 44 452: 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 : 53 subq $1, 4, $1 # e0 : 54 addq $16, 32, $16 # .. e1 : 55 bne $1, 2b # e1 : 56 57$tail: 58 bne $2, 1f # e1 : is there a tail to do? 59 ret $31, ($26), 1 # .. e1 : 60 611: EX( ldq_u $5, 0($16) ) # e0 : 62 clr $0 # .. e1 : 63 nop # e1 : 64 mskqh $5, $0, $5 # e0 : 65 EX( stq_u $5, 0($16) ) # e0 : 66 ret $31, ($26), 1 # .. e1 : 67 68__clear_user: 69 and $17, $17, $0 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 74 srl $1, 3, $1 # e0 : 75 beq $4, $loop # .. e1 : 76 77 EX( ldq_u $5, 0($16) ) # e0 : load dst word to mask back in 78 beq $1, $oneword # .. e1 : sub-word store? 79 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 84 subq $1, 1, $1 # e0 : 85 subq $0, 8, $0 # .. e1 : 86 br $loop # e1 : 87 unop # : 88 89$oneword: 90 mskql $5, $16, $4 # e0 : 91 mskqh $5, $2, $5 # e0 : 92 or $5, $4, $5 # e1 : 93 EX( stq_u $5, 0($16) ) # e0 : 94 clr $0 # .. e1 : 95 96$zerolength: 97$exception: 98 ret $31, ($26), 1 # .. e1 : 99 100 .end __clear_user 101 EXPORT_SYMBOL(__clear_user) 102