From 9c11d8d483c4a8e5e530c101101b26695e33b080 Mon Sep 17 00:00:00 2001 From: Brooks Davis Date: Tue, 17 Apr 2018 18:04:28 +0000 Subject: [PATCH] Remove the unused fuwintr() and suiwintr() functions. Half of implementations always failed (returned (-1)) and they were previously used in only one place. Reviewed by: kib, andrew Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15102 --- ObsoleteFiles.inc | 3 ++ share/man/man9/Makefile | 2 -- share/man/man9/fetch.9 | 12 ++------ share/man/man9/store.9 | 11 ++----- sys/amd64/amd64/support.S | 14 --------- sys/arm/arm/fusu.S | 22 -------------- sys/arm64/arm64/support.S | 45 ----------------------------- sys/arm64/arm64/trap.c | 10 ------- sys/conf/files.powerpc | 2 -- sys/i386/i386/support.s | 14 --------- sys/mips/mips/support.S | 35 ---------------------- sys/mips/mips/trap.c | 8 ----- sys/powerpc/powerpc/fuswintr.c | 53 ---------------------------------- sys/powerpc/powerpc/suswintr.c | 53 ---------------------------------- sys/riscv/riscv/support.S | 42 --------------------------- sys/riscv/riscv/trap.c | 10 ------- sys/sparc64/sparc64/support.S | 25 ---------------- sys/sys/resourcevar.h | 2 -- 18 files changed, 7 insertions(+), 356 deletions(-) delete mode 100644 sys/powerpc/powerpc/fuswintr.c delete mode 100644 sys/powerpc/powerpc/suswintr.c diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index 44eb2740d958..a34d49ff4b82 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20180417: remove fuswintr and suswintr +OLD_FILES+=usr/share/man/man9/fuswintr.9.gz +OLD_FILES+=usr/share/man/man9/suswintr.9.gz # 20180413: remove Arcnet support OLD_FILES+=usr/include/net/if_arc.h OLD_FILES+=usr/share/man/man4/cm.4.gz diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index 597d36842b5a..e3b67a604076 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -960,7 +960,6 @@ MLINKS+=fdt_pinctrl.9 fdt_pinctrl_configure.9 \ fdt_pinctrl.9 fdt_pinctrl_configure_tree.9 \ fdt_pinctrl.9 fdt_pinctrl_register.9 MLINKS+=fetch.9 fubyte.9 \ - fetch.9 fuswintr.9 \ fetch.9 fuword.9 \ fetch.9 fuword16.9 \ fetch.9 fuword32.9 \ @@ -1934,7 +1933,6 @@ MLINKS+=stack.9 stack_copy.9 \ stack.9 stack_sbuf_print_ddb.9 \ stack.9 stack_zero.9 MLINKS+=store.9 subyte.9 \ - store.9 suswintr.9 \ store.9 suword.9 \ store.9 suword16.9 \ store.9 suword32.9 \ diff --git a/share/man/man9/fetch.9 b/share/man/man9/fetch.9 index 1d46784ed310..778b80c98cf6 100644 --- a/share/man/man9/fetch.9 +++ b/share/man/man9/fetch.9 @@ -34,13 +34,12 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd April 17, 2018 .Dt FETCH 9 .Os .Sh NAME .Nm fetch , .Nm fubyte , -.Nm fuswintr , .Nm fuword , .Nm fuword16 , .Nm fuword32 , @@ -69,8 +68,6 @@ .Ft int64_t .Fn fueword64 "volatile const void *base" "int64_t *val" .In sys/resourcevar.h -.Ft int -.Fn fuswintr "void *base" .Sh DESCRIPTION The .Nm @@ -100,10 +97,6 @@ Fetches 32 bits of data from the user-space address .It Fn fuword64 Fetches 64 bits of data from the user-space address .Pa base . -.It Fn fuswintr -Fetches a short word of data from the user-space address -.Pa base . -This function is safe to call during an interrupt context. .It Fn fueword Fetches a word of data (long) from the user-space address .Pa base @@ -134,9 +127,8 @@ The .Fn fuword , .Fn fuword16 , .Fn fuword32 , -.Fn fuword64 , and -.Fn fuswintr +.Fn fuword64 functions return the data fetched or -1 on failure. The .Fn fueword , diff --git a/share/man/man9/store.9 b/share/man/man9/store.9 index cc442f25f47c..40a6d7e2b216 100644 --- a/share/man/man9/store.9 +++ b/share/man/man9/store.9 @@ -34,13 +34,12 @@ .\" .\" $FreeBSD$ .\" -.Dd October 29, 2014 +.Dd April 17, 2018 .Dt STORE 9 .Os .Sh NAME .Nm store , .Nm subyte , -.Nm suswintr , .Nm suword .Nd store data to user-space .Sh SYNOPSIS @@ -58,8 +57,6 @@ .Ft int .Fn suword64 "volatile void *base" "int64_t word" .In sys/resourcevar.h -.Ft int -.Fn suswintr "void *base" "int word" .Sh DESCRIPTION The .Nm @@ -70,7 +67,7 @@ The data written must be naturally aligned. The .Nm routines provide the following functionality: -.Bl -tag -width "suswintr()" +.Bl -tag -width "suword64()" .It Fn subyte Stores a byte of data to the user-space address .Pa base . @@ -86,10 +83,6 @@ Stores 32 bits of data to the user-space address .It Fn suword64 Stores 64 bits of data to the user-space address .Pa base . -.It Fn suswintr -Stores a short word of data to the user-space address -.Pa base . -This function is safe to call during an interrupt context. .El .Sh RETURN VALUES The diff --git a/sys/amd64/amd64/support.S b/sys/amd64/amd64/support.S index 908ea635b001..505adcbf134c 100644 --- a/sys/amd64/amd64/support.S +++ b/sys/amd64/amd64/support.S @@ -456,20 +456,6 @@ ENTRY(fueword32) ret END(fueword32) -/* - * fuswintr() and suswintr() are specialized variants of fuword16() and - * suword16(), respectively. They are called from the profiling code, - * potentially at interrupt time. If they fail, that's okay; good things - * will happen later. They always fail for now, until the trap code is - * able to deal with this. - */ -ALTENTRY(suswintr) -ENTRY(fuswintr) - movq $-1,%rax - ret -END(suswintr) -END(fuswintr) - ENTRY(fuword16) PUSH_FRAME_POINTER movq PCPU(CURPCB),%rcx diff --git a/sys/arm/arm/fusu.S b/sys/arm/arm/fusu.S index 91c6d9ed2f60..590440100a76 100644 --- a/sys/arm/arm/fusu.S +++ b/sys/arm/arm/fusu.S @@ -175,17 +175,6 @@ ENTRY(fusword) RET END(fusword) -/* - * fuswintr(caddr_t uaddr); - * Fetch a short from the user's address space. Can be called during an - * interrupt. - */ - -ENTRY(fuswintr) - mov r0, #-1 - RET -END(fuswintr) - /* * fubyte(caddr_t uaddr); * Fetch a byte from the user's address space. @@ -272,17 +261,6 @@ EENTRY_NP(suword32) EEND(suword32) END(suword) -/* - * suswintr(caddr_t uaddr, short x); - * Store a short in the user's address space. Can be called during an - * interrupt. - */ - -ENTRY(suswintr) - mov r0, #-1 - RET -END(suswintr) - /* * susword(caddr_t uaddr, short x); * Store a short in the user's address space. diff --git a/sys/arm64/arm64/support.S b/sys/arm64/arm64/support.S index 7007978f2374..4b4d34469126 100644 --- a/sys/arm64/arm64/support.S +++ b/sys/arm64/arm64/support.S @@ -218,51 +218,6 @@ EENTRY(suword64) EEND(suword64) END(suword) -/* - * fuswintr and suswintr are just like fusword and susword except that if - * the page is not in memory or would cause a trap, then we return an error. - * The important thing is to prevent sleep() and switch(). - */ - -/* - * Special handler so the trap code knows not to sleep. - */ -ENTRY(fsu_intr_fault) - SET_FAULT_HANDLER(xzr, x1) /* Reset the handler function */ - EXIT_USER_ACCESS_CHECK(w0, x1) - mov x0, #-1 - ret -END(fsu_fault) - -/* - * int fuswintr(void *) - */ -ENTRY(fuswintr) - ldr x1, =(VM_MAXUSER_ADDRESS-3) - cmp x0, x1 - b.cs fsu_fault_nopcb - adr x6, fsu_intr_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x1) /* And set it */ - ldtr w0, [x0] /* Try loading the data */ - SET_FAULT_HANDLER(xzr, x1) /* Reset the fault handler */ - ret /* Return */ -END(fuswintr) - -/* - * int suswintr(void *base, int word) - */ -ENTRY(suswintr) - ldr x2, =(VM_MAXUSER_ADDRESS-3) - cmp x0, x2 - b.cs fsu_fault_nopcb - adr x6, fsu_intr_fault /* Load the fault handler */ - SET_FAULT_HANDLER(x6, x2) /* And set it */ - sttr w1, [x0] /* Try storing the data */ - SET_FAULT_HANDLER(xzr, x2) /* Reset the fault handler */ - mov x0, #0 /* Success */ - ret /* Return */ -END(suswintr) - ENTRY(setjmp) /* Store the stack pointer */ mov x8, sp diff --git a/sys/arm64/arm64/trap.c b/sys/arm64/arm64/trap.c index 81b8abcdf3b4..71237bb98e4f 100644 --- a/sys/arm64/arm64/trap.c +++ b/sys/arm64/arm64/trap.c @@ -172,16 +172,6 @@ data_abort(struct thread *td, struct trapframe *frame, uint64_t esr, #endif pcb = td->td_pcb; - - /* - * Special case for fuswintr and suswintr. These can't sleep so - * handle them early on in the trap handler. - */ - if (__predict_false(pcb->pcb_onfault == (vm_offset_t)&fsu_intr_fault)) { - frame->tf_elr = pcb->pcb_onfault; - return; - } - p = td->td_proc; if (lower) map = &p->p_vmspace->vm_map; diff --git a/sys/conf/files.powerpc b/sys/conf/files.powerpc index 9001665568db..7c5cf2c65ca4 100644 --- a/sys/conf/files.powerpc +++ b/sys/conf/files.powerpc @@ -212,7 +212,6 @@ powerpc/powerpc/elf32_machdep.c optional powerpc | powerpcspe | compat_freebsd32 powerpc/powerpc/elf64_machdep.c optional powerpc64 powerpc/powerpc/exec_machdep.c standard powerpc/powerpc/fpu.c standard -powerpc/powerpc/fuswintr.c standard powerpc/powerpc/gdb_machdep.c optional gdb powerpc/powerpc/in_cksum.c optional inet | inet6 powerpc/powerpc/interrupt.c standard @@ -236,7 +235,6 @@ powerpc/powerpc/sigcode64.S optional powerpc64 powerpc/powerpc/swtch32.S optional powerpc | powerpcspe powerpc/powerpc/swtch64.S optional powerpc64 powerpc/powerpc/stack_machdep.c optional ddb | stack -powerpc/powerpc/suswintr.c standard powerpc/powerpc/syncicache.c standard powerpc/powerpc/sys_machdep.c standard powerpc/powerpc/trap.c standard diff --git a/sys/i386/i386/support.s b/sys/i386/i386/support.s index 6a11dc6f5bb6..8e70659eefae 100644 --- a/sys/i386/i386/support.s +++ b/sys/i386/i386/support.s @@ -251,20 +251,6 @@ ENTRY(memcpy) ret END(memcpy) -/* - * fuswintr() and suswintr() are specialized variants of fuword16() and - * suword16(), respectively. They are called from the profiling code, - * potentially at interrupt time. If they fail, that's okay; good things - * will happen later. They always fail for now, until the trap code is - * able to deal with this. - */ -ALTENTRY(suswintr) -ENTRY(fuswintr) - movl $-1,%eax - ret -END(suswintr) -END(fuswintr) - /* * copystr(from, to, maxlen, int *lencopied) - MP SAFE */ diff --git a/sys/mips/mips/support.S b/sys/mips/mips/support.S index ba188ec39340..0c6e814b053a 100644 --- a/sys/mips/mips/support.S +++ b/sys/mips/mips/support.S @@ -416,41 +416,6 @@ LEAF(fswberr) li v0, -1 END(fswberr) -/* - * fuswintr and suswintr are just like fusword and susword except that if - * the page is not in memory or would cause a trap, then we return an error. - * The important thing is to prevent sleep() and switch(). - */ -LEAF(fuswintr) - PTR_LA v0, fswintrberr - blt a0, zero, fswintrberr # make sure address is in user space - nop - GET_CPU_PCPU(v1) - PTR_L v1, PC_CURPCB(v1) - PTR_S v0, U_PCB_ONFAULT(v1) - lhu v0, 0(a0) # fetch short - j ra - PTR_S zero, U_PCB_ONFAULT(v1) -END(fuswintr) - -LEAF(suswintr) - PTR_LA v0, fswintrberr - blt a0, zero, fswintrberr # make sure address is in user space - nop - GET_CPU_PCPU(v1) - PTR_L v1, PC_CURPCB(v1) - PTR_S v0, U_PCB_ONFAULT(v1) - sh a1, 0(a0) # store short - PTR_S zero, U_PCB_ONFAULT(v1) - j ra - move v0, zero -END(suswintr) - -LEAF(fswintrberr) - j ra - li v0, -1 -END(fswintrberr) - /* * memset(void *s1, int c, int len) * NetBSD: memset.S,v 1.3 2001/10/16 15:40:53 uch Exp diff --git a/sys/mips/mips/trap.c b/sys/mips/mips/trap.c index e373840d1deb..0938cf2f06da 100644 --- a/sys/mips/mips/trap.c +++ b/sys/mips/mips/trap.c @@ -684,14 +684,6 @@ trap(struct trapframe *trapframe) if (td->td_pcb->pcb_onfault == NULL) goto err; - /* check for fuswintr() or suswintr() getting a page fault */ - /* XXX There must be a nicer way to do this. */ - if (td->td_pcb->pcb_onfault == fswintrberr) { - pc = (register_t)(intptr_t)td->td_pcb->pcb_onfault; - td->td_pcb->pcb_onfault = NULL; - return (pc); - } - goto dofault; case T_TLB_LD_MISS + T_USER: diff --git a/sys/powerpc/powerpc/fuswintr.c b/sys/powerpc/powerpc/fuswintr.c deleted file mode 100644 index 5b75d7b81320..000000000000 --- a/sys/powerpc/powerpc/fuswintr.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (C) 1994 Wolfgang Solfrank. - * Copyright (C) 1994 TooLs GmbH. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: fuswintr.c,v 1.2 2000/06/08 07:29:54 kleink Exp $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -/* - * Emulate fuswintr - * - * Simply return fault for all cases - */ -int -fuswintr(void *addr) -{ - - return -1; -} diff --git a/sys/powerpc/powerpc/suswintr.c b/sys/powerpc/powerpc/suswintr.c deleted file mode 100644 index 77d69071b8bb..000000000000 --- a/sys/powerpc/powerpc/suswintr.c +++ /dev/null @@ -1,53 +0,0 @@ -/*- - * SPDX-License-Identifier: BSD-4-Clause - * - * Copyright (C) 1994 Wolfgang Solfrank. - * Copyright (C) 1994 TooLs GmbH. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by TooLs GmbH. - * 4. The name of TooLs GmbH may not be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - * $NetBSD: suswintr.c,v 1.2 2000/06/09 14:05:48 kleink Exp $ - */ - -#include -__FBSDID("$FreeBSD$"); - -#include -#include -#include - -/* - * Emulate suswintr - * - * Simply return fault for all cases - */ -int -suswintr(void *addr, int s) -{ - - return -1; -} diff --git a/sys/riscv/riscv/support.S b/sys/riscv/riscv/support.S index df88acfead6f..e3848cd94c9a 100644 --- a/sys/riscv/riscv/support.S +++ b/sys/riscv/riscv/support.S @@ -202,48 +202,6 @@ EENTRY(suword64) EEND(suword64) END(suword) -/* - * fuswintr and suswintr are just like fusword and susword except that if - * the page is not in memory or would cause a trap, then we return an error. - * The important thing is to prevent sleep() and switch(). - */ - -/* - * Special handler so the trap code knows not to sleep. - */ -ENTRY(fsu_intr_fault) - SET_FAULT_HANDLER(x0, a1) /* Reset the handler function */ - li a0, -1 - ret -END(fsu_fault) - -/* - * int fuswintr(void *) - */ -ENTRY(fuswintr) - li a1, (VM_MAXUSER_ADDRESS-3) - bgt a0, a1, fsu_fault_nopcb - la a6, fsu_intr_fault /* Load the fault handler */ - SET_FAULT_HANDLER(a6, a1) /* And set it */ - lw a0, 0(a0) /* Try loading the data */ - SET_FAULT_HANDLER(x0, x1) /* Reset the fault handler */ - ret /* Return */ -END(fuswintr) - -/* - * int suswintr(void *base, int word) - */ -ENTRY(suswintr) - li a2, (VM_MAXUSER_ADDRESS-3) - bgt a0, a2, fsu_fault_nopcb - la a6, fsu_intr_fault /* Load the fault handler */ - SET_FAULT_HANDLER(a6, a2) /* And set it */ - sw a1, 0(a0) /* Try storing the data */ - SET_FAULT_HANDLER(x0, a2) /* Reset the fault handler */ - li a0, 0 /* Success */ - ret /* Return */ -END(suswintr) - ENTRY(setjmp) /* Store the stack pointer */ sd sp, 0(a0) diff --git a/sys/riscv/riscv/trap.c b/sys/riscv/riscv/trap.c index 002e10e82fe0..ced05c52588f 100644 --- a/sys/riscv/riscv/trap.c +++ b/sys/riscv/riscv/trap.c @@ -186,16 +186,6 @@ data_abort(struct trapframe *frame, int lower) td = curthread; pcb = td->td_pcb; - - /* - * Special case for fuswintr and suswintr. These can't sleep so - * handle them early on in the trap handler. - */ - if (__predict_false(pcb->pcb_onfault == (vm_offset_t)&fsu_intr_fault)) { - frame->tf_sepc = pcb->pcb_onfault; - return; - } - sbadaddr = frame->tf_sbadaddr; p = td->td_proc; diff --git a/sys/sparc64/sparc64/support.S b/sys/sparc64/sparc64/support.S index d8074d5e4464..0440ef6f9522 100644 --- a/sys/sparc64/sparc64/support.S +++ b/sys/sparc64/sparc64/support.S @@ -487,31 +487,6 @@ ENTRY(suword64) clr %o0 END(suword64) - .globl fs_nofault_intr_begin -fs_nofault_intr_begin: - nop - -/* - * int fuswintr(const void *base) - */ -ENTRY(fuswintr) - retl - lduha [%o0] ASI_AIUP, %o0 -END(fuswintr) - -/* - * int suswintr(const void *base, int word) - */ -ENTRY(suswintr) - stha %o1, [%o0] ASI_AIUP - retl - clr %o0 -END(suswintr) - - .globl fs_nofault_intr_end -fs_nofault_intr_end: - nop - .globl fs_nofault_end fs_nofault_end: nop diff --git a/sys/sys/resourcevar.h b/sys/sys/resourcevar.h index d28297f3d0b4..c61ac3e1a6cf 100644 --- a/sys/sys/resourcevar.h +++ b/sys/sys/resourcevar.h @@ -128,7 +128,6 @@ int chgsbsize(struct uidinfo *uip, u_int *hiwat, u_int to, rlim_t maxval); int chgptscnt(struct uidinfo *uip, int diff, rlim_t maxval); int chgumtxcnt(struct uidinfo *uip, int diff, rlim_t maxval); -int fuswintr(void *base); int kern_proc_setrlimit(struct thread *td, struct proc *p, u_int which, struct rlimit *limp); struct plimit @@ -152,7 +151,6 @@ void rufetchcalc(struct proc *p, struct rusage *ru, struct timeval *up, struct timeval *sp); void rufetchtd(struct thread *td, struct rusage *ru); void ruxagg(struct proc *p, struct thread *td); -int suswintr(void *base, int word); struct uidinfo *uifind(uid_t uid); void uifree(struct uidinfo *uip);