svn commit: r332656 - in head: . share/man/man9 sys/amd64/amd64 sys/arm/arm sys/arm64/arm64 sys/conf sys/i386/i386 sys/mips/mips sys/powerpc/powerpc sys/riscv/riscv sys/sparc64/sparc64 sys/sys

Brooks Davis brooks at FreeBSD.org
Tue Apr 17 18:04:31 UTC 2018


Author: brooks
Date: Tue Apr 17 18:04:28 2018
New Revision: 332656
URL: https://svnweb.freebsd.org/changeset/base/332656

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

Deleted:
  head/sys/powerpc/powerpc/fuswintr.c
  head/sys/powerpc/powerpc/suswintr.c
Modified:
  head/ObsoleteFiles.inc
  head/share/man/man9/Makefile
  head/share/man/man9/fetch.9
  head/share/man/man9/store.9
  head/sys/amd64/amd64/support.S
  head/sys/arm/arm/fusu.S
  head/sys/arm64/arm64/support.S
  head/sys/arm64/arm64/trap.c
  head/sys/conf/files.powerpc
  head/sys/i386/i386/support.s
  head/sys/mips/mips/support.S
  head/sys/mips/mips/trap.c
  head/sys/riscv/riscv/support.S
  head/sys/riscv/riscv/trap.c
  head/sys/sparc64/sparc64/support.S
  head/sys/sys/resourcevar.h

Modified: head/ObsoleteFiles.inc
==============================================================================
--- head/ObsoleteFiles.inc	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/ObsoleteFiles.inc	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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

Modified: head/share/man/man9/Makefile
==============================================================================
--- head/share/man/man9/Makefile	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/share/man/man9/Makefile	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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 \

Modified: head/share/man/man9/fetch.9
==============================================================================
--- head/share/man/man9/fetch.9	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/share/man/man9/fetch.9	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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 ,

Modified: head/share/man/man9/store.9
==============================================================================
--- head/share/man/man9/store.9	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/share/man/man9/store.9	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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

Modified: head/sys/amd64/amd64/support.S
==============================================================================
--- head/sys/amd64/amd64/support.S	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/amd64/amd64/support.S	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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

Modified: head/sys/arm/arm/fusu.S
==============================================================================
--- head/sys/arm/arm/fusu.S	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/arm/arm/fusu.S	Tue Apr 17 18:04:28 2018	(r332656)
@@ -176,17 +176,6 @@ ENTRY(fusword)
 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.
  */
@@ -271,17 +260,6 @@ EENTRY_NP(suword32)
 	RET
 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);

Modified: head/sys/arm64/arm64/support.S
==============================================================================
--- head/sys/arm64/arm64/support.S	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/arm64/arm64/support.S	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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

Modified: head/sys/arm64/arm64/trap.c
==============================================================================
--- head/sys/arm64/arm64/trap.c	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/arm64/arm64/trap.c	Tue Apr 17 18:04:28 2018	(r332656)
@@ -172,16 +172,6 @@ data_abort(struct thread *td, struct trapframe *frame,
 #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;

Modified: head/sys/conf/files.powerpc
==============================================================================
--- head/sys/conf/files.powerpc	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/conf/files.powerpc	Tue Apr 17 18:04:28 2018	(r332656)
@@ -212,7 +212,6 @@ powerpc/powerpc/elf32_machdep.c	optional	powerpc | pow
 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

Modified: head/sys/i386/i386/support.s
==============================================================================
--- head/sys/i386/i386/support.s	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/i386/i386/support.s	Tue Apr 17 18:04:28 2018	(r332656)
@@ -252,20 +252,6 @@ ENTRY(memcpy)
 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
  */
 ENTRY(copystr)

Modified: head/sys/mips/mips/support.S
==============================================================================
--- head/sys/mips/mips/support.S	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/mips/mips/support.S	Tue Apr 17 18:04:28 2018	(r332656)
@@ -417,41 +417,6 @@ LEAF(fswberr)
 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
  */

Modified: head/sys/mips/mips/trap.c
==============================================================================
--- head/sys/mips/mips/trap.c	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/mips/mips/trap.c	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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:

Modified: head/sys/riscv/riscv/support.S
==============================================================================
--- head/sys/riscv/riscv/support.S	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/riscv/riscv/support.S	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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)

Modified: head/sys/riscv/riscv/trap.c
==============================================================================
--- head/sys/riscv/riscv/trap.c	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/riscv/riscv/trap.c	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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;

Modified: head/sys/sparc64/sparc64/support.S
==============================================================================
--- head/sys/sparc64/sparc64/support.S	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/sparc64/sparc64/support.S	Tue Apr 17 18:04:28 2018	(r332656)
@@ -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

Modified: head/sys/sys/resourcevar.h
==============================================================================
--- head/sys/sys/resourcevar.h	Tue Apr 17 17:23:47 2018	(r332655)
+++ head/sys/sys/resourcevar.h	Tue Apr 17 18:04:28 2018	(r332656)
@@ -128,7 +128,6 @@ int	 chgsbsize(struct uidinfo *uip, u_int *hiwat, u_in
 	    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, s
 	    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);


More information about the svn-src-all mailing list