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
This commit is contained in:
Brooks Davis 2018-04-17 18:04:28 +00:00
parent ee9f155f8f
commit 9c11d8d483
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=332656
18 changed files with 7 additions and 356 deletions

View File

@ -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

View File

@ -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 \

View File

@ -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 ,

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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
*/

View File

@ -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

View File

@ -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:

View File

@ -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 <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/resourcevar.h>
/*
* Emulate fuswintr
*
* Simply return fault for all cases
*/
int
fuswintr(void *addr)
{
return -1;
}

View File

@ -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 <sys/cdefs.h>
__FBSDID("$FreeBSD$");
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/resourcevar.h>
/*
* Emulate suswintr
*
* Simply return fault for all cases
*/
int
suswintr(void *addr, int s)
{
return -1;
}

View File

@ -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)

View File

@ -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;

View File

@ -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

View File

@ -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);