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

TOMOYO Linux Cross Reference
Linux/arch/arm/mm/copypage-fa.c

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ 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.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  *  linux/arch/arm/lib/copypage-fa.S
  4  *
  5  *  Copyright (C) 2005 Faraday Corp.
  6  *  Copyright (C) 2008-2009 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
  7  *
  8  * Based on copypage-v4wb.S:
  9  *  Copyright (C) 1995-1999 Russell King
 10  */
 11 #include <linux/init.h>
 12 #include <linux/highmem.h>
 13 
 14 /*
 15  * Faraday optimised copy_user_page
 16  */
 17 static void fa_copy_user_page(void *kto, const void *kfrom)
 18 {
 19         int tmp;
 20 
 21         asm volatile ("\
 22 1:      ldmia   %1!, {r3, r4, ip, lr}           @ 4\n\
 23         stmia   %0, {r3, r4, ip, lr}            @ 4\n\
 24         mcr     p15, 0, %0, c7, c14, 1          @ 1   clean and invalidate D line\n\
 25         add     %0, %0, #16                     @ 1\n\
 26         ldmia   %1!, {r3, r4, ip, lr}           @ 4\n\
 27         stmia   %0, {r3, r4, ip, lr}            @ 4\n\
 28         mcr     p15, 0, %0, c7, c14, 1          @ 1   clean and invalidate D line\n\
 29         add     %0, %0, #16                     @ 1\n\
 30         subs    %2, %2, #1                      @ 1\n\
 31         bne     1b                              @ 1\n\
 32         mcr     p15, 0, %2, c7, c10, 4          @ 1   drain WB"
 33         : "+&r" (kto), "+&r" (kfrom), "=&r" (tmp)
 34         : "2" (PAGE_SIZE / 32)
 35         : "r3", "r4", "ip", "lr");
 36 }
 37 
 38 void fa_copy_user_highpage(struct page *to, struct page *from,
 39         unsigned long vaddr, struct vm_area_struct *vma)
 40 {
 41         void *kto, *kfrom;
 42 
 43         kto = kmap_atomic(to);
 44         kfrom = kmap_atomic(from);
 45         fa_copy_user_page(kto, kfrom);
 46         kunmap_atomic(kfrom);
 47         kunmap_atomic(kto);
 48 }
 49 
 50 /*
 51  * Faraday optimised clear_user_page
 52  *
 53  * Same story as above.
 54  */
 55 void fa_clear_user_highpage(struct page *page, unsigned long vaddr)
 56 {
 57         void *ptr, *kaddr = kmap_atomic(page);
 58         asm volatile("\
 59         mov     r1, %2                          @ 1\n\
 60         mov     r2, #0                          @ 1\n\
 61         mov     r3, #0                          @ 1\n\
 62         mov     ip, #0                          @ 1\n\
 63         mov     lr, #0                          @ 1\n\
 64 1:      stmia   %0, {r2, r3, ip, lr}            @ 4\n\
 65         mcr     p15, 0, %0, c7, c14, 1          @ 1   clean and invalidate D line\n\
 66         add     %0, %0, #16                     @ 1\n\
 67         stmia   %0, {r2, r3, ip, lr}            @ 4\n\
 68         mcr     p15, 0, %0, c7, c14, 1          @ 1   clean and invalidate D line\n\
 69         add     %0, %0, #16                     @ 1\n\
 70         subs    r1, r1, #1                      @ 1\n\
 71         bne     1b                              @ 1\n\
 72         mcr     p15, 0, r1, c7, c10, 4          @ 1   drain WB"
 73         : "=r" (ptr)
 74         : "" (kaddr), "I" (PAGE_SIZE / 32)
 75         : "r1", "r2", "r3", "ip", "lr");
 76         kunmap_atomic(kaddr);
 77 }
 78 
 79 struct cpu_user_fns fa_user_fns __initdata = {
 80         .cpu_clear_user_highpage = fa_clear_user_highpage,
 81         .cpu_copy_user_highpage = fa_copy_user_highpage,
 82 };
 83 

~ [ 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