aboutsummaryrefslogtreecommitdiffstats
path: root/arch/ia64/lib/strnlen_user.S
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /arch/ia64/lib/strnlen_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/strnlen_user.S')
-rw-r--r--arch/ia64/lib/strnlen_user.S45
1 files changed, 45 insertions, 0 deletions
diff --git a/arch/ia64/lib/strnlen_user.S b/arch/ia64/lib/strnlen_user.S
new file mode 100644
index 000000000000..d09066b1e49d
--- /dev/null
+++ b/arch/ia64/lib/strnlen_user.S
@@ -0,0 +1,45 @@
1/*
2 * Returns 0 if exception before NUL or reaching the supplied limit (N),
3 * a value greater than N if the string is longer than the limit, else
4 * strlen.
5 *
6 * Inputs:
7 * in0: address of buffer
8 * in1: string length limit N
9 * Outputs:
10 * r8: 0 in case of fault, strlen(buffer)+1 otherwise
11 *
12 * Copyright (C) 1999, 2001 David Mosberger-Tang <davidm@hpl.hp.com>
13 */
14
15#include <asm/asmmacro.h>
16
17GLOBAL_ENTRY(__strnlen_user)
18 .prologue
19 alloc r2=ar.pfs,2,0,0,0
20 .save ar.lc, r16
21 mov r16=ar.lc // preserve ar.lc
22
23 .body
24
25 add r3=-1,in1
26 ;;
27 mov ar.lc=r3
28 mov r9=0
29 ;;
30 // XXX braindead strlen loop---this needs to be optimized
31.Loop1:
32 EXCLR(.Lexit, ld1 r8=[in0],1)
33 add r9=1,r9
34 ;;
35 cmp.eq p6,p0=r8,r0
36(p6) br.cond.dpnt .Lexit
37 br.cloop.dptk.few .Loop1
38
39 add r9=1,in1 // NUL not found---return N+1
40 ;;
41.Lexit:
42 mov r8=r9
43 mov ar.lc=r16 // restore ar.lc
44 br.ret.sptk.many rp
45END(__strnlen_user)