/*1* arch/alpha/lib/clear_user.S2* Contributed by Richard Henderson <[email protected]>3*4* Zero user space, handling exceptions as we go.5*6* We have to make sure that $0 is always up-to-date and contains the7* right "bytes left to zero" value (and that it is updated only _after_8* a successful copy). There is also some rather minor exception setup9* stuff.10*11* NOTE! This is not directly C-callable, because the calling semantics12* are different:13*14* Inputs:15* length in $016* destination address in $617* exception pointer in $718* return address in $28 (exceptions expect it there)19*20* Outputs:21* bytes left to copy in $022*23* Clobbers:24* $1,$2,$3,$4,$5,$625*/2627/* Allow an exception for an insn; exit if we get one. */28#define EX(x,y...) \2999: x,##y; \30.section __ex_table,"a"; \31.long 99b - .; \32lda $31, $exception-99b($31); \33.previous3435.set noat36.set noreorder37.align 43839.globl __do_clear_user40.ent __do_clear_user41.frame $30, 0, $2842.prologue 04344$loop:45and $1, 3, $4 # e0 :46beq $4, 1f # .. e1 :47480: EX( stq_u $31, 0($6) ) # e0 : zero one word49subq $0, 8, $0 # .. e1 :50subq $4, 1, $4 # e0 :51addq $6, 8, $6 # .. e1 :52bne $4, 0b # e1 :53unop # :54551: bic $1, 3, $1 # e0 :56beq $1, $tail # .. e1 :57582: EX( stq_u $31, 0($6) ) # e0 : zero four words59subq $0, 8, $0 # .. e1 :60EX( stq_u $31, 8($6) ) # e0 :61subq $0, 8, $0 # .. e1 :62EX( stq_u $31, 16($6) ) # e0 :63subq $0, 8, $0 # .. e1 :64EX( stq_u $31, 24($6) ) # e0 :65subq $0, 8, $0 # .. e1 :66subq $1, 4, $1 # e0 :67addq $6, 32, $6 # .. e1 :68bne $1, 2b # e1 :6970$tail:71bne $2, 1f # e1 : is there a tail to do?72ret $31, ($28), 1 # .. e1 :73741: EX( ldq_u $5, 0($6) ) # e0 :75clr $0 # .. e1 :76nop # e1 :77mskqh $5, $0, $5 # e0 :78EX( stq_u $5, 0($6) ) # e0 :79ret $31, ($28), 1 # .. e1 :8081__do_clear_user:82and $6, 7, $4 # e0 : find dest misalignment83beq $0, $zerolength # .. e1 :84addq $0, $4, $1 # e0 : bias counter85and $1, 7, $2 # e1 : number of bytes in tail86srl $1, 3, $1 # e0 :87beq $4, $loop # .. e1 :8889EX( ldq_u $5, 0($6) ) # e0 : load dst word to mask back in90beq $1, $oneword # .. e1 : sub-word store?9192mskql $5, $6, $5 # e0 : take care of misaligned head93addq $6, 8, $6 # .. e1 :94EX( stq_u $5, -8($6) ) # e0 :95addq $0, $4, $0 # .. e1 : bytes left -= 8 - misalignment96subq $1, 1, $1 # e0 :97subq $0, 8, $0 # .. e1 :98br $loop # e1 :99unop # :100101$oneword:102mskql $5, $6, $4 # e0 :103mskqh $5, $2, $5 # e0 :104or $5, $4, $5 # e1 :105EX( stq_u $5, 0($6) ) # e0 :106clr $0 # .. e1 :107108$zerolength:109$exception:110ret $31, ($28), 1 # .. e1 :111112.end __do_clear_user113114115