1 // SPDX-License-Identifier: GPL-2.0-only 1 2 /* 3 * linux/arch/arm/mm/copypage-feroceon.S 4 * 5 * Copyright (C) 2008 Marvell Semiconductors 6 * 7 * This handles copy_user_highpage and clear_u 8 * more optimally than the generic implementat 9 */ 10 #include <linux/init.h> 11 #include <linux/highmem.h> 12 13 static void feroceon_copy_user_page(void *kto, 14 { 15 int tmp; 16 17 asm volatile ("\ 18 .arch armv5te 19 1: ldmia %1!, {r2 - r7, ip, lr} 20 pld [%1, #0] 21 pld [%1, #32] 22 pld [%1, #64] 23 pld [%1, #96] 24 pld [%1, #128] 25 pld [%1, #160] 26 pld [%1, #192] 27 stmia %0, {r2 - r7, ip, lr} 28 ldmia %1!, {r2 - r7, ip, lr} 29 mcr p15, 0, %0, c7, c14, 1 30 add %0, %0, #32 31 stmia %0, {r2 - r7, ip, lr} 32 ldmia %1!, {r2 - r7, ip, lr} 33 mcr p15, 0, %0, c7, c14, 1 34 add %0, %0, #32 35 stmia %0, {r2 - r7, ip, lr} 36 ldmia %1!, {r2 - r7, ip, lr} 37 mcr p15, 0, %0, c7, c14, 1 38 add %0, %0, #32 39 stmia %0, {r2 - r7, ip, lr} 40 ldmia %1!, {r2 - r7, ip, lr} 41 mcr p15, 0, %0, c7, c14, 1 42 add %0, %0, #32 43 stmia %0, {r2 - r7, ip, lr} 44 ldmia %1!, {r2 - r7, ip, lr} 45 mcr p15, 0, %0, c7, c14, 1 46 add %0, %0, #32 47 stmia %0, {r2 - r7, ip, lr} 48 ldmia %1!, {r2 - r7, ip, lr} 49 mcr p15, 0, %0, c7, c14, 1 50 add %0, %0, #32 51 stmia %0, {r2 - r7, ip, lr} 52 ldmia %1!, {r2 - r7, ip, lr} 53 mcr p15, 0, %0, c7, c14, 1 54 add %0, %0, #32 55 stmia %0, {r2 - r7, ip, lr} 56 subs %2, %2, #(32 * 8) 57 mcr p15, 0, %0, c7, c14, 1 58 add %0, %0, #32 59 bne 1b 60 mcr p15, 0, %2, c7, c10, 4 61 : "+&r" (kto), "+&r" (kfrom), "=&r" (t 62 : "2" (PAGE_SIZE) 63 : "r2", "r3", "r4", "r5", "r6", "r7", 64 } 65 66 void feroceon_copy_user_highpage(struct page * 67 unsigned long vaddr, struct vm_area_st 68 { 69 void *kto, *kfrom; 70 71 kto = kmap_atomic(to); 72 kfrom = kmap_atomic(from); 73 flush_cache_page(vma, vaddr, page_to_p 74 feroceon_copy_user_page(kto, kfrom); 75 kunmap_atomic(kfrom); 76 kunmap_atomic(kto); 77 } 78 79 void feroceon_clear_user_highpage(struct page 80 { 81 void *ptr, *kaddr = kmap_atomic(page); 82 asm volatile ("\ 83 mov r1, %2 84 mov r2, #0 85 mov r3, #0 86 mov r4, #0 87 mov r5, #0 88 mov r6, #0 89 mov r7, #0 90 mov ip, #0 91 mov lr, #0 92 1: stmia %0, {r2-r7, ip, lr} 93 subs r1, r1, #1 94 mcr p15, 0, %0, c7, c14, 1 95 add %0, %0, #32 96 bne 1b 97 mcr p15, 0, r1, c7, c10, 4 98 : "=r" (ptr) 99 : "" (kaddr), "I" (PAGE_SIZE / 32) 100 : "r1", "r2", "r3", "r4", "r5", "r6", 101 kunmap_atomic(kaddr); 102 } 103 104 struct cpu_user_fns feroceon_user_fns __initda 105 .cpu_clear_user_highpage = feroceon_cl 106 .cpu_copy_user_highpage = feroceon_cop 107 }; 108 109
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.