From 5e1b568c2a6d9ea5500c000b7bcd6a8e0b13dbc3 Mon Sep 17 00:00:00 2001 From: brooks Date: Tue, 17 Apr 2018 17:20:04 +0000 Subject: [PATCH] Remove unused implementations of copyoutstr(). Also remove the commented out documentation. The documentation arrived with the import of the copy.9 manpage. I suspect the implementations came from NetBSD while bootstrapping the Arm and MIPS ports. Reviewed by: andrew, jmallett Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15108 --- share/man/man9/copy.9 | 14 ----------- sys/arm/arm/copystr.S | 53 ----------------------------------------- sys/mips/mips/support.S | 28 ---------------------- 3 files changed, 95 deletions(-) diff --git a/share/man/man9/copy.9 b/share/man/man9/copy.9 index 18c387c94b23..a3a46351c52f 100644 --- a/share/man/man9/copy.9 +++ b/share/man/man9/copy.9 @@ -61,8 +61,6 @@ .Fn copystr "const void *kfaddr" "void *kdaddr" "size_t len" "size_t *done" .Ft int .Fn copyinstr "const void *uaddr" "void *kaddr" "size_t len" "size_t *done" -.\" .Ft int -.\" .Fn copyoutstr "const void *kaddr" "void *uaddr" "size_t len" "size_t *done" .Sh DESCRIPTION The .Nm @@ -135,15 +133,6 @@ NUL, is returned in .Fa done is .No non- Ns Dv NULL ) . -.\" .It Fn copyoutstr -.\" Copies a NUL-terminated string, at most -.\" bytes long, from kernel-space address -.\" .Fa kaddr -.\" to user-space address -.\" .Fa uaddr . -.\" The number of bytes actually copied, including the terminating -.\" NUL, is returned in -.\" .Fa *done . .Sh RETURN VALUES The .Nm @@ -164,9 +153,6 @@ The .Fn copystr and .Fn copyinstr -.\" .Fn copyinstr , -.\" and -.\" .Fn copyoutstr functions return .Er ENAMETOOLONG if the string is longer than diff --git a/sys/arm/arm/copystr.S b/sys/arm/arm/copystr.S index 8a218b4f7bf9..6a7a3518ea5f 100644 --- a/sys/arm/arm/copystr.S +++ b/sys/arm/arm/copystr.S @@ -149,59 +149,6 @@ ENTRY(copyinstr) RET END(copyinstr) -/* - * r0 - kernel space address - * r1 - user space address - * r2 - maxlens - * r3 - lencopied - * - * Copy string from kernel space to user space - */ -ENTRY(copyoutstr) - SAVE_REGS - - teq r2, #0x00000000 - mov r6, #0x00000000 - moveq r0, #ENAMETOOLONG - beq 2f - - ldr r12, =VM_MAXUSER_ADDRESS - - GET_PCB(r4) - ldr r4, [r4] - -#ifdef DIAGNOSTIC - teq r4, #0x00000000 - beq .Lcopystrpcbfault -#endif - - adr r5, .Lcopystrfault - str r5, [r4, #PCB_ONFAULT] - -1: - cmp r0, r12 - bcs .Lcopystrfault - ldrb r5, [r0], #0x0001 - add r6, r6, #0x00000001 - teq r5, #0x00000000 - strbt r5, [r1], #0x0001 - teqne r6, r2 - bne 1b - - mov r0, #0x00000000 - str r0, [r4, #PCB_ONFAULT] - - teq r5, #0x00000000 - moveq r0, #0x00000000 - movne r0, #ENAMETOOLONG - -2: teq r3, #0x00000000 - strne r6, [r3] - - RESTORE_REGS - RET -END(copyoutstr) - /* A fault occurred during the copy */ .Lcopystrfault: mov r1, #0x00000000 diff --git a/sys/mips/mips/support.S b/sys/mips/mips/support.S index 1117fe1a0c6f..ba188ec39340 100644 --- a/sys/mips/mips/support.S +++ b/sys/mips/mips/support.S @@ -161,34 +161,6 @@ NESTED(copyinstr, CALLFRAME_SIZ, ra) PTR_ADDU sp, sp, CALLFRAME_SIZ END(copyinstr) -/* - * Copy a null terminated string from the kernel address space into - * the user address space. - * - * copyoutstr(fromaddr, toaddr, maxlength, &lencopied) - * caddr_t fromaddr; - * caddr_t toaddr; - * u_int maxlength; - * u_int *lencopied; - */ -NESTED(copyoutstr, CALLFRAME_SIZ, ra) - PTR_SUBU sp, sp, CALLFRAME_SIZ - .mask 0x80000000, (CALLFRAME_RA - CALLFRAME_SIZ) - PTR_LA v0, copyerr - blt a1, zero, _C_LABEL(copyerr) # make sure address is in user space - REG_S ra, CALLFRAME_RA(sp) - GET_CPU_PCPU(v1) - PTR_L v1, PC_CURPCB(v1) - jal _C_LABEL(copystr) - PTR_S v0, U_PCB_ONFAULT(v1) - REG_L ra, CALLFRAME_RA(sp) - GET_CPU_PCPU(v1) - PTR_L v1, PC_CURPCB(v1) - PTR_S zero, U_PCB_ONFAULT(v1) - j ra - PTR_ADDU sp, sp, CALLFRAME_SIZ -END(copyoutstr) - /* * Copy specified amount of data from user space into the kernel * copyin(from, to, len)