aboutsummaryrefslogtreecommitdiff
path: root/sys/i386
diff options
context:
space:
mode:
authorConrad Meyer <cem@FreeBSD.org>2020-05-25 16:40:48 +0000
committerConrad Meyer <cem@FreeBSD.org>2020-05-25 16:40:48 +0000
commit852c303b61d12d13b56ed7affe31df193aadf9ae (patch)
tree789bb0daba41ca856b37f87708652b4cfcc6403a /sys/i386
parent9085d7d6b86a3435c92d8b817dcc6224ad3e6671 (diff)
downloadsrc-852c303b61d12d13b56ed7affe31df193aadf9ae.tar.gz
src-852c303b61d12d13b56ed7affe31df193aadf9ae.zip
copystr(9): Move to deprecate (attempt #2)
This reapplies logical r360944 and r360946 (reverting r360955), with fixed copystr() stand-in replacement macro. Eventually the goal is to convert consumers and kill the macro, but for a first step it helps if the macro is correct. Prior commit message: Unlike the other copy*() functions, it does not serve to copy from one address space to another or protect against potential faults. It's just an older incarnation of the now-more-common strlcpy(). Add a coccinelle script to tools/ which can be used to mechanically convert existing instances where replacement with strlcpy is trivial. In the two cases which matched, fuse_vfsops.c and union_vfsops.c, the code was further refactored manually to simplify. Replace the declaration of copystr() in systm.h with a small macro wrapper around strlcpy (with correction from brooks@ -- thanks). Remove N redundant MI implementations of copystr. For MIPS, this entailed inlining the assembler copystr into the only consumer, copyinstr, and making the latter a leaf function. Reviewed by: jhb (earlier version) Discussed with: brooks (thanks!) Differential Revision: https://reviews.freebsd.org/D24672
Notes
Notes: svn path=/head/; revision=361466
Diffstat (limited to 'sys/i386')
-rw-r--r--sys/i386/i386/support.s41
1 files changed, 0 insertions, 41 deletions
diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s
index 2c1f2141ed3d..9ae1a5caa5e5 100644
--- a/sys/i386/i386/support.s
+++ b/sys/i386/i386/support.s
@@ -233,47 +233,6 @@ ENTRY(memcpy)
ret
END(memcpy)
-/*
- * copystr(from, to, maxlen, int *lencopied) - MP SAFE
- */
-ENTRY(copystr)
- pushl %esi
- pushl %edi
-
- movl 12(%esp),%esi /* %esi = from */
- movl 16(%esp),%edi /* %edi = to */
- movl 20(%esp),%edx /* %edx = maxlen */
- incl %edx
-1:
- decl %edx
- jz 4f
- lodsb
- stosb
- orb %al,%al
- jnz 1b
-
- /* Success -- 0 byte reached */
- decl %edx
- xorl %eax,%eax
- jmp 6f
-4:
- /* edx is zero -- return ENAMETOOLONG */
- movl $ENAMETOOLONG,%eax
-
-6:
- /* set *lencopied and return %eax */
- movl 20(%esp),%ecx
- subl %edx,%ecx
- movl 24(%esp),%edx
- testl %edx,%edx
- jz 7f
- movl %ecx,(%edx)
-7:
- popl %edi
- popl %esi
- ret
-END(copystr)
-
ENTRY(bcmp)
pushl %edi
pushl %esi