diff options
author | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2005-04-16 18:20:36 -0400 |
commit | 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch) | |
tree | 0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ia64/lib/strncpy_from_user.S |
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history,
even though we have it. We can create a separate "historical" git
archive of that later if we want to, and in the meantime it's about
3.2GB when imported into git - space that would just make the early
git days unnecessarily complicated, when we don't have a lot of good
infrastructure for it.
Let it rip!
Diffstat (limited to 'arch/ia64/lib/strncpy_from_user.S')
-rw-r--r-- | arch/ia64/lib/strncpy_from_user.S | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/arch/ia64/lib/strncpy_from_user.S b/arch/ia64/lib/strncpy_from_user.S new file mode 100644 index 000000000000..a504381f31eb --- /dev/null +++ b/arch/ia64/lib/strncpy_from_user.S | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * Just like strncpy() except that if a fault occurs during copying, | ||
3 | * -EFAULT is returned. | ||
4 | * | ||
5 | * Inputs: | ||
6 | * in0: address of destination buffer | ||
7 | * in1: address of string to be copied | ||
8 | * in2: length of buffer in bytes | ||
9 | * Outputs: | ||
10 | * r8: -EFAULT in case of fault or number of bytes copied if no fault | ||
11 | * | ||
12 | * Copyright (C) 1998-2001 Hewlett-Packard Co | ||
13 | * Copyright (C) 1998-2001 David Mosberger-Tang <davidm@hpl.hp.com> | ||
14 | * | ||
15 | * 00/03/06 D. Mosberger Fixed to return proper return value (bug found by | ||
16 | * by Andreas Schwab <schwab@suse.de>). | ||
17 | */ | ||
18 | |||
19 | #include <asm/asmmacro.h> | ||
20 | |||
21 | GLOBAL_ENTRY(__strncpy_from_user) | ||
22 | alloc r2=ar.pfs,3,0,0,0 | ||
23 | mov r8=0 | ||
24 | mov r9=in1 | ||
25 | ;; | ||
26 | add r10=in1,in2 | ||
27 | cmp.eq p6,p0=r0,in2 | ||
28 | (p6) br.ret.spnt.many rp | ||
29 | |||
30 | // XXX braindead copy loop---this needs to be optimized | ||
31 | .Loop1: | ||
32 | EX(.Lexit, ld1 r8=[in1],1) | ||
33 | ;; | ||
34 | EX(.Lexit, st1 [in0]=r8,1) | ||
35 | cmp.ne p6,p7=r8,r0 | ||
36 | ;; | ||
37 | (p6) cmp.ne.unc p8,p0=in1,r10 | ||
38 | (p8) br.cond.dpnt.few .Loop1 | ||
39 | ;; | ||
40 | (p6) mov r8=in2 // buffer filled up---return buffer length | ||
41 | (p7) sub r8=in1,r9,1 // return string length (excluding NUL character) | ||
42 | [.Lexit:] | ||
43 | br.ret.sptk.many rp | ||
44 | END(__strncpy_from_user) | ||