root/arch/unicore32/lib/copy_to_user.S

/* [<][>][^][v][top][bottom][index][help] */
   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * linux/arch/unicore32/lib/copy_to_user.S
   4  *
   5  * Code specific to PKUnity SoC and UniCore ISA
   6  *
   7  * Copyright (C) 2001-2010 GUAN Xue-tao
   8  */
   9 
  10 #include <linux/linkage.h>
  11 #include <asm/assembler.h>
  12 
  13 /*
  14  * Prototype:
  15  *
  16  *      size_t raw_copy_to_user(void *to, const void *from, size_t n)
  17  *
  18  * Purpose:
  19  *
  20  *      copy a block to user memory from kernel memory
  21  *
  22  * Params:
  23  *
  24  *      to = user memory
  25  *      from = kernel memory
  26  *      n = number of bytes to copy
  27  *
  28  * Return value:
  29  *
  30  *      Number of bytes NOT copied.
  31  */
  32 
  33         .macro ldr1w ptr reg abort
  34         ldw.w \reg, [\ptr]+, #4
  35         .endm
  36 
  37         .macro ldr4w ptr reg1 reg2 reg3 reg4 abort
  38         ldm.w   (\reg1, \reg2, \reg3, \reg4), [\ptr]+
  39         .endm
  40 
  41         .macro ldr8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
  42         ldm.w (\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8), [\ptr]+
  43         .endm
  44 
  45         .macro ldr1b ptr reg cond=al abort
  46         notcond \cond, .+8
  47         ldb.w \reg, [\ptr]+, #1
  48         .endm
  49 
  50         .macro str1w ptr reg abort
  51         strusr  \reg, \ptr, 4, abort=\abort
  52         .endm
  53 
  54         .macro str8w ptr reg1 reg2 reg3 reg4 reg5 reg6 reg7 reg8 abort
  55 100:    stm.w (\reg1, \reg2, \reg3, \reg4, \reg5, \reg6, \reg7, \reg8), [\ptr]+
  56 
  57         .pushsection __ex_table, "a"
  58         .long 100b, \abort
  59         .popsection
  60         .endm
  61 
  62         .macro str1b ptr reg cond=al abort
  63         strusr  \reg, \ptr, 1, \cond, abort=\abort
  64         .endm
  65 
  66         .macro enter
  67         mov     r3, #0
  68         stm.w   (r0, r2, r3), [sp-]
  69         .endm
  70 
  71         .macro exit
  72         add     sp, sp, #8
  73         ldm.w   (r0), [sp]+
  74         mov     pc, lr
  75         .endm
  76 
  77         .text
  78 
  79 WEAK(raw_copy_to_user)
  80 
  81 #include "copy_template.S"
  82 
  83 ENDPROC(raw_copy_to_user)
  84 
  85         .pushsection .fixup,"ax"
  86         .align 0
  87         copy_abort_preamble
  88         ldm.w   (r1, r2, r3), [sp]+
  89         sub     r0, r0, r1
  90         rsub    r0, r0, r2
  91         copy_abort_end
  92         .popsection
  93 

/* [<][>][^][v][top][bottom][index][help] */