~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/openrisc/lib/string.S

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * OpenRISC string.S
  4  *
  5  * Linux architectural port borrowing liberally from similar works of
  6  * others.  All original copyrights apply as per the original source
  7  * declaration.
  8  *
  9  * Modifications for the OpenRISC architecture:
 10  * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
 11  * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
 12  */
 13 
 14 #include <linux/linkage.h>
 15 #include <asm/errno.h>
 16 
 17         /*
 18          * this can be optimized by doing gcc inline assemlby with
 19          * proper constraints (no need to save args registers...)
 20          *
 21          */
 22 
 23 
 24 /*
 25  *
 26  * int __copy_tofrom_user(void *to, const void *from, unsigned long size);
 27  *
 28  * NOTE: it returns number of bytes NOT copied !!!
 29  *
 30  */
 31         .global __copy_tofrom_user
 32 __copy_tofrom_user:
 33         l.addi  r1,r1,-12
 34         l.sw    0(r1),r6
 35         l.sw    4(r1),r4
 36         l.sw    8(r1),r3
 37 
 38         l.addi  r11,r5,0
 39 2:      l.sfeq  r11,r0
 40         l.bf    1f
 41         l.addi  r11,r11,-1
 42 8:      l.lbz   r6,0(r4)
 43 9:      l.sb    0(r3),r6
 44         l.addi  r3,r3,1
 45         l.j     2b
 46         l.addi  r4,r4,1
 47 1:
 48         l.addi  r11,r11,1               // r11 holds the return value
 49 
 50         l.lwz   r6,0(r1)
 51         l.lwz   r4,4(r1)
 52         l.lwz   r3,8(r1)
 53         l.jr    r9
 54         l.addi  r1,r1,12
 55 
 56         .section .fixup, "ax"
 57 99:
 58                 l.j     1b
 59                 l.nop
 60         .previous
 61 
 62         .section __ex_table, "a"
 63                 .long 8b, 99b           // read fault
 64                 .long 9b, 99b           // write fault
 65         .previous
 66 
 67 /*
 68  * unsigned long clear_user(void *addr, unsigned long size) ;
 69  *
 70  * NOTE: it returns number of bytes NOT cleared !!!
 71  */
 72         .global __clear_user
 73 __clear_user:
 74         l.addi  r1,r1,-8
 75         l.sw    0(r1),r4
 76         l.sw    4(r1),r3
 77 
 78 2:      l.sfeq  r4,r0
 79         l.bf    1f
 80         l.addi  r4,r4,-1
 81 9:      l.sb    0(r3),r0
 82         l.j     2b
 83         l.addi  r3,r3,1
 84 
 85 1:
 86         l.addi  r11,r4,1
 87 
 88         l.lwz   r4,0(r1)
 89         l.lwz   r3,4(r1)
 90         l.jr    r9
 91         l.addi  r1,r1,8
 92 
 93         .section .fixup, "ax"
 94 99:
 95                 l.j     1b
 96                 l.nop
 97         .previous
 98 
 99         .section __ex_table, "a"
100                 .long 9b, 99b           // write fault
101         .previous

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php