4 * Linux architectural port borrowing liberally from similar works of
5 * others. All original copyrights apply as per the original source
8 * Modifications for the OpenRISC architecture:
9 * Copyright (C) 2003 Matjaz Breskvar <phoenix@bsemi.com>
10 * Copyright (C) 2010-2011 Jonas Bonn <jonas@southpole.se>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version
15 * 2 of the License, or (at your option) any later version.
18 #include <linux/linkage.h>
19 #include <asm/errno.h>
22 * this can be optimized by doing gcc inline assemlby with
23 * proper constraints (no need to save args registers...)
30 * int __copy_tofrom_user(void *to, const void *from, unsigned long size);
32 * NOTE: it returns number of bytes NOT copied !!!
35 .global __copy_tofrom_user
52 l.addi r11,r11,1 // r11 holds the return value
66 .section __ex_table, "a"
67 .long 8b, 99b // read fault
68 .long 9b, 99b // write fault
72 * unsigned long clear_user(void *addr, unsigned long size) ;
74 * NOTE: it returns number of bytes NOT cleared !!!
103 .section __ex_table, "a"
104 .long 9b, 99b // write fault