Russell King | d73e60b | 2008-10-31 13:08:02 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * linux/arch/arm/mm/copypage-v3.c |
| 3 | * |
| 4 | * Copyright (C) 1995-1999 Russell King |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | #include <linux/init.h> |
| 11 | |
| 12 | #include <asm/page.h> |
| 13 | |
| 14 | /* |
| 15 | * ARMv3 optimised copy_user_page |
| 16 | * |
| 17 | * FIXME: do we need to handle cache stuff... |
| 18 | */ |
| 19 | void __attribute__((naked)) |
| 20 | v3_copy_user_page(void *kto, const void *kfrom, unsigned long vaddr) |
| 21 | { |
| 22 | asm("\n\ |
| 23 | stmfd sp!, {r4, lr} @ 2\n\ |
| 24 | mov r2, %2 @ 1\n\ |
| 25 | ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\ |
| 26 | 1: stmia %1!, {r3, r4, ip, lr} @ 4\n\ |
| 27 | ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\ |
| 28 | stmia %1!, {r3, r4, ip, lr} @ 4\n\ |
| 29 | ldmia %0!, {r3, r4, ip, lr} @ 4+1\n\ |
| 30 | stmia %1!, {r3, r4, ip, lr} @ 4\n\ |
| 31 | ldmia %0!, {r3, r4, ip, lr} @ 4\n\ |
| 32 | subs r2, r2, #1 @ 1\n\ |
| 33 | stmia %1!, {r3, r4, ip, lr} @ 4\n\ |
| 34 | ldmneia %0!, {r3, r4, ip, lr} @ 4\n\ |
| 35 | bne 1b @ 1\n\ |
| 36 | ldmfd sp!, {r4, pc} @ 3" |
| 37 | : |
| 38 | : "r" (kfrom), "r" (kto), "I" (PAGE_SIZE / 64)); |
| 39 | } |
| 40 | |
| 41 | /* |
| 42 | * ARMv3 optimised clear_user_page |
| 43 | * |
| 44 | * FIXME: do we need to handle cache stuff... |
| 45 | */ |
| 46 | void __attribute__((naked)) v3_clear_user_page(void *kaddr, unsigned long vaddr) |
| 47 | { |
| 48 | asm("\n\ |
| 49 | str lr, [sp, #-4]!\n\ |
| 50 | mov r1, %1 @ 1\n\ |
| 51 | mov r2, #0 @ 1\n\ |
| 52 | mov r3, #0 @ 1\n\ |
| 53 | mov ip, #0 @ 1\n\ |
| 54 | mov lr, #0 @ 1\n\ |
| 55 | 1: stmia %0!, {r2, r3, ip, lr} @ 4\n\ |
| 56 | stmia %0!, {r2, r3, ip, lr} @ 4\n\ |
| 57 | stmia %0!, {r2, r3, ip, lr} @ 4\n\ |
| 58 | stmia %0!, {r2, r3, ip, lr} @ 4\n\ |
| 59 | subs r1, r1, #1 @ 1\n\ |
| 60 | bne 1b @ 1\n\ |
| 61 | ldr pc, [sp], #4" |
| 62 | : |
| 63 | : "r" (kaddr), "I" (PAGE_SIZE / 64)); |
| 64 | } |
| 65 | |
| 66 | struct cpu_user_fns v3_user_fns __initdata = { |
| 67 | .cpu_clear_user_page = v3_clear_user_page, |
| 68 | .cpu_copy_user_page = v3_copy_user_page, |
| 69 | }; |