/* SPDX-License-Identifier: GPL-2.0 */1/*2* arch/alpha/lib/clear_user.S3* Contributed by Richard Henderson <[email protected]>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 the8* right "bytes left to zero" value (and that it is updated only _after_9* a successful copy). There is also some rather minor exception setup10* stuff.11*/12#include <linux/export.h>1314/* Allow an exception for an insn; exit if we get one. */15#define EX(x,y...) \1699: x,##y; \17.section __ex_table,"a"; \18.long 99b - .; \19lda $31, $exception-99b($31); \20.previous2122.set noat23.set noreorder24.align 42526.globl __clear_user27.ent __clear_user28.frame $30, 0, $2629.prologue 03031$loop:32and $1, 3, $4 # e0 :33beq $4, 1f # .. e1 :34350: EX( stq_u $31, 0($16) ) # e0 : zero one word36subq $0, 8, $0 # .. e1 :37subq $4, 1, $4 # e0 :38addq $16, 8, $16 # .. e1 :39bne $4, 0b # e1 :40unop # :41421: bic $1, 3, $1 # e0 :43beq $1, $tail # .. e1 :44452: EX( stq_u $31, 0($16) ) # e0 : zero four words46subq $0, 8, $0 # .. e1 :47EX( stq_u $31, 8($16) ) # e0 :48subq $0, 8, $0 # .. e1 :49EX( stq_u $31, 16($16) ) # e0 :50subq $0, 8, $0 # .. e1 :51EX( stq_u $31, 24($16) ) # e0 :52subq $0, 8, $0 # .. e1 :53subq $1, 4, $1 # e0 :54addq $16, 32, $16 # .. e1 :55bne $1, 2b # e1 :5657$tail:58bne $2, 1f # e1 : is there a tail to do?59ret $31, ($26), 1 # .. e1 :60611: EX( ldq_u $5, 0($16) ) # e0 :62clr $0 # .. e1 :63nop # e1 :64mskqh $5, $0, $5 # e0 :65EX( stq_u $5, 0($16) ) # e0 :66ret $31, ($26), 1 # .. e1 :6768__clear_user:69and $17, $17, $070and $16, 7, $4 # e0 : find dest misalignment71beq $0, $zerolength # .. e1 :72addq $0, $4, $1 # e0 : bias counter73and $1, 7, $2 # e1 : number of bytes in tail74srl $1, 3, $1 # e0 :75beq $4, $loop # .. e1 :7677EX( ldq_u $5, 0($16) ) # e0 : load dst word to mask back in78beq $1, $oneword # .. e1 : sub-word store?7980mskql $5, $16, $5 # e0 : take care of misaligned head81addq $16, 8, $16 # .. e1 :82EX( stq_u $5, -8($16) ) # e0 :83addq $0, $4, $0 # .. e1 : bytes left -= 8 - misalignment84subq $1, 1, $1 # e0 :85subq $0, 8, $0 # .. e1 :86br $loop # e1 :87unop # :8889$oneword:90mskql $5, $16, $4 # e0 :91mskqh $5, $2, $5 # e0 :92or $5, $4, $5 # e1 :93EX( stq_u $5, 0($16) ) # e0 :94clr $0 # .. e1 :9596$zerolength:97$exception:98ret $31, ($26), 1 # .. e1 :99100.end __clear_user101EXPORT_SYMBOL(__clear_user)102103104