uaccess.h (38fd2c202a3d82bc12430bce5789fa2c2a406f71) | uaccess.h (8922bc3058abbe5deaf887147e26531750ce7513) |
---|---|
1/* 2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation. 7 * 8 * vineetg: June 2010 --- 645 unchanged lines hidden (view full) --- 654 : "lp_count", "lp_start", "lp_end", "memory"); 655 656 return res; 657} 658 659static inline long 660__arc_strncpy_from_user(char *dst, const char __user *src, long count) 661{ | 1/* 2 * Copyright (C) 2004, 2007-2010, 2011-2012 Synopsys, Inc. (www.synopsys.com) 3 * 4 * This program is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License version 2 as 6 * published by the Free Software Foundation. 7 * 8 * vineetg: June 2010 --- 645 unchanged lines hidden (view full) --- 654 : "lp_count", "lp_start", "lp_end", "memory"); 655 656 return res; 657} 658 659static inline long 660__arc_strncpy_from_user(char *dst, const char __user *src, long count) 661{ |
662 long res = count; | 662 long res = 0; |
663 char val; | 663 char val; |
664 unsigned int hw_count; | |
665 666 if (count == 0) 667 return 0; 668 669 __asm__ __volatile__( | 664 665 if (count == 0) 666 return 0; 667 668 __asm__ __volatile__( |
670 " lp 2f \n" | 669 " lp 3f \n" |
671 "1: ldb.ab %3, [%2, 1] \n" | 670 "1: ldb.ab %3, [%2, 1] \n" |
672 " breq.d %3, 0, 2f \n" | 671 " breq.d %3, 0, 3f \n" |
673 " stb.ab %3, [%1, 1] \n" | 672 " stb.ab %3, [%1, 1] \n" |
674 "2: sub %0, %6, %4 \n" 675 "3: ;nop \n" | 673 " add %0, %0, 1 # Num of NON NULL bytes copied \n" 674 "3: \n" |
676 " .section .fixup, \"ax\" \n" 677 " .align 4 \n" | 675 " .section .fixup, \"ax\" \n" 676 " .align 4 \n" |
678 "4: mov %0, %5 \n" | 677 "4: mov %0, %4 # sets @res as -EFAULT \n" |
679 " j 3b \n" 680 " .previous \n" 681 " .section __ex_table, \"a\" \n" 682 " .align 4 \n" 683 " .word 1b, 4b \n" 684 " .previous \n" | 678 " j 3b \n" 679 " .previous \n" 680 " .section __ex_table, \"a\" \n" 681 " .align 4 \n" 682 " .word 1b, 4b \n" 683 " .previous \n" |
685 : "=r"(res), "+r"(dst), "+r"(src), "=&r"(val), "=l"(hw_count) 686 : "g"(-EFAULT), "ir"(count), "4"(count) /* this "4" seeds lp_count */ | 684 : "+r"(res), "+r"(dst), "+r"(src), "=r"(val) 685 : "g"(-EFAULT), "l"(count) |
687 : "memory"); 688 689 return res; 690} 691 692static inline long __arc_strnlen_user(const char __user *s, long n) 693{ 694 long res, tmp1, cnt; --- 57 unchanged lines hidden --- | 686 : "memory"); 687 688 return res; 689} 690 691static inline long __arc_strnlen_user(const char __user *s, long n) 692{ 693 long res, tmp1, cnt; --- 57 unchanged lines hidden --- |