Subject: kern/7145: Remove calls to obsoleted ovbcopy
To: None <gnats-bugs@gnats.netbsd.org>
From: None <erik@mediator.uni-c.dk>
List: netbsd-bugs
Date: 03/12/1999 23:27:15
>Number:         7145
>Category:       kern
>Synopsis:       Remove calls to obsoleted ovbcopy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 12 13:35:00 1999
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	
>Release:        NetBSD-current 11 Mar 1999
>Environment:
	
System: NetBSD rlanarh108.uni-c.dk 1.3K NetBSD 1.3K (HJEMME) #48: Fri Mar 12 00:11:07 CET 1999 erik@rlanarh108.uni-c.dk:/home/src/sys/arch/macppc/compile/HJEMME macppc


>Description:
	According to the relatively recently started transition from using
	the historical bxxx byte manipulation functions to the corresponding
	memxxx functions and according to the following extract from 
	<sys/systm.h> the following patch removes all the (relatively few)
	calls to ovbcopy from the MI part of the kernel and from the MD
	parts of the ports that I sup (mac68k/m68k, pmax/mips, macppc/powerpc,
	and i386). As a follow-up the definition of ovbcopy in several
	MD parts of the kernel can be removed. As a bonus, I have also
	cleaned arch/m68k from the declaration of ovbcopy (which was just
	an alias for bcopy).
	This patch has been used for some time on my mac68k, macppc, pmax,
	and i386 -current systems.

	From systm.h:

/* XXX b*() are now macros. should remove these prototypes soon */
#if 0
void	bcopy __P((const void *, void *, size_t));
void	ovbcopy __P((const void *, void *, size_t));
void	bzero __P((void *, size_t));
int	bcmp __P((const void *, const void *, size_t));
#endif

>How-To-Repeat:
	
>Fix:

Index: arch/m68k/m68k/bcopy.s
===================================================================
RCS file: /home/cvs-base/src/sys/arch/m68k/m68k/bcopy.s,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 bcopy.s
*** arch/m68k/m68k/bcopy.s	1998/02/28 19:16:03	1.1.1.2
--- arch/m68k/m68k/bcopy.s	1999/01/30 16:54:30
***************
*** 48,58 ****
  	.text
  
  /*
!  * {ov}bcopy(from, to, len)
   *
   * Works for counts up to 128K.
   */
- ALTENTRY(ovbcopy, _bcopy)
  ENTRY(bcopy)
  	movl	sp@(12),d0		| get count
  	jeq	Lbccpyexit		| if zero, return
--- 48,57 ----
  	.text
  
  /*
!  * bcopy(from, to, len)
   *
   * Works for counts up to 128K.
   */
  ENTRY(bcopy)
  	movl	sp@(12),d0		| get count
  	jeq	Lbccpyexit		| if zero, return
Index: arch/mac68k/dev/ite.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/mac68k/dev/ite.c,v
retrieving revision 1.1.1.17
diff -c -r1.1.1.17 ite.c
*** arch/mac68k/dev/ite.c	1998/12/22 14:08:54	1.1.1.17
--- arch/mac68k/dev/ite.c	1999/01/30 16:40:13
***************
*** 450,456 ****
  	from = to + linebytes;
  
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
! 		ovbcopy(from, to, screenrowbytes);
  		from += videorowbytes;
  		to += videorowbytes;
  	}
--- 450,456 ----
  	from = to + linebytes;
  
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
! 		memmove(to, from, screenrowbytes);
  		from += videorowbytes;
  		to += videorowbytes;
  	}
***************
*** 474,480 ****
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
  		from -= videorowbytes;
  		to -= videorowbytes;
! 		ovbcopy(from, to, screenrowbytes);
  	}
  	for (i = CHARHEIGHT; i > 0; i--) {
  		to -= videorowbytes;
--- 474,480 ----
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
  		from -= videorowbytes;
  		to -= videorowbytes;
! 		memmove(to, from, screenrowbytes);
  	}
  	for (i = CHARHEIGHT; i > 0; i--) {
  		to -= videorowbytes;
Index: arch/macppc/dev/ite.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/macppc/dev/ite.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 ite.c
*** arch/macppc/dev/ite.c	1998/07/14 15:27:12	1.1.1.3
--- arch/macppc/dev/ite.c	1999/01/30 16:40:35
***************
*** 440,446 ****
  	from = to + linebytes;
  
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
! 		ovbcopy(from, to, screenrowbytes);
  		from += videorowbytes;
  		to += videorowbytes;
  	}
--- 440,446 ----
  	from = to + linebytes;
  
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
! 		memmove(to, from, screenrowbytes);
  		from += videorowbytes;
  		to += videorowbytes;
  	}
***************
*** 464,470 ****
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
  		from -= videorowbytes;
  		to -= videorowbytes;
! 		ovbcopy(from, to, screenrowbytes);
  	}
  	for (i = CHARHEIGHT; i > 0; i--) {
  		to -= videorowbytes;
--- 464,470 ----
  	for (i = (scrreg_bottom - scrreg_top) * CHARHEIGHT; i > 0; i--) {
  		from -= videorowbytes;
  		to -= videorowbytes;
! 		memmove(to, from, screenrowbytes);
  	}
  	for (i = CHARHEIGHT; i > 0; i--) {
  		to -= videorowbytes;
Index: arch/sparc/sparc/pmap.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/sparc/sparc/pmap.c,v
retrieving revision 1.1.1.19
diff -c -r1.1.1.19 pmap.c
*** arch/sparc/sparc/pmap.c	1999/02/15 13:25:19	1.1.1.19
--- arch/sparc/sparc/pmap.c	1999/02/28 10:52:34
***************
*** 836,842 ****
  			if (addr < mpj->addr)
  				break;
  		/* slide up any additional entries */
! 		ovbcopy(mpj, mpj + 1, (i - j) * sizeof(*mp));
  		mpj->addr = addr;
  		mpj->len = len;
  	}
--- 836,842 ----
  			if (addr < mpj->addr)
  				break;
  		/* slide up any additional entries */
! 		memmove(mpj + 1, mpj, (i - j) * sizeof(*mp));
  		mpj->addr = addr;
  		mpj->len = len;
  	}
Index: net/if_gre.c
===================================================================
RCS file: /home/cvs-base/src/sys/net/if_gre.c,v
retrieving revision 1.1.1.5
diff -c -r1.1.1.5 if_gre.c
*** net/if_gre.c	1999/01/27 17:29:46	1.1.1.5
--- net/if_gre.c	1999/01/30 16:43:42
***************
*** 250,256 ****
  				m->m_data-=msiz;
  				m->m_len+=msiz;
  				m->m_pkthdr.len+=msiz;
! 				ovbcopy((caddr_t) inp, mtod(m, caddr_t), sizeof(struct ip));
  			}
  			inp=mtod(m,struct ip *);
  			memcpy((caddr_t) (inp+1), &mob_h, (unsigned) msiz);
--- 250,256 ----
  				m->m_data-=msiz;
  				m->m_len+=msiz;
  				m->m_pkthdr.len+=msiz;
! 				memmove(mtod(m, caddr_t), inp, sizeof(struct ip));
  			}
  			inp=mtod(m,struct ip *);
  			memcpy((caddr_t) (inp+1), &mob_h, (unsigned) msiz);
Index: net/slcompress.c
===================================================================
RCS file: /home/cvs-base/src/sys/net/slcompress.c,v
retrieving revision 1.1.1.4
diff -c -r1.1.1.4 slcompress.c
*** net/slcompress.c	1998/12/13 14:44:15	1.1.1.4
--- net/slcompress.c	1999/01/30 16:45:33
***************
*** 63,71 ****
  
  #define BCMP(p1, p2, n) bcmp((char *)(p1), (char *)(p2), (int)(n))
  #define BCOPY(p1, p2, n) bcopy((char *)(p1), (char *)(p2), (int)(n))
- #ifndef _KERNEL
- #define ovbcopy bcopy
- #endif
  
  
  void
--- 63,68 ----
***************
*** 465,471 ****
  	 */
  	if ((long)cp & 3) {
  		if (len > 0)
! 			(void) ovbcopy(cp, (caddr_t)((long)cp &~ 3), len);
  		cp = (u_char *)((long)cp &~ 3);
  	}
  	cp -= hlen;
--- 462,468 ----
  	 */
  	if ((long)cp & 3) {
  		if (len > 0)
! 			memmove(((long)cp &~ 3), cp, len);
  		cp = (u_char *)((long)cp &~ 3);
  	}
  	cp -= hlen;
Index: netinet/ip_output.c
===================================================================
RCS file: /home/cvs-base/src/sys/netinet/ip_output.c,v
retrieving revision 1.1.1.20
diff -c -r1.1.1.20 ip_output.c
*** netinet/ip_output.c	1999/01/21 21:06:05	1.1.1.20
--- netinet/ip_output.c	1999/03/12 22:08:08
***************
*** 543,549 ****
  		m->m_data -= optlen;
  		m->m_len += optlen;
  		m->m_pkthdr.len += optlen;
! 		ovbcopy((caddr_t)ip, mtod(m, caddr_t), sizeof(struct ip));
  	}
  	ip = mtod(m, struct ip *);
  	bcopy((caddr_t)p->ipopt_list, (caddr_t)(ip + 1), (unsigned)optlen);
--- 543,549 ----
  		m->m_data -= optlen;
  		m->m_len += optlen;
  		m->m_pkthdr.len += optlen;
! 		memmove(mtod(m, caddr_t), ip, sizeof(struct ip));
  	}
  	ip = mtod(m, struct ip *);
  	bcopy((caddr_t)p->ipopt_list, (caddr_t)(ip + 1), (unsigned)optlen);
***************
*** 838,844 ****
  	cnt = m->m_len;
  	m->m_len += sizeof(struct in_addr);
  	cp = mtod(m, u_char *) + sizeof(struct in_addr);
! 	ovbcopy(mtod(m, caddr_t), (caddr_t)cp, (unsigned)cnt);
  	bzero(mtod(m, caddr_t), sizeof(struct in_addr));
  
  	for (; cnt > 0; cnt -= optlen, cp += optlen) {
--- 838,844 ----
  	cnt = m->m_len;
  	m->m_len += sizeof(struct in_addr);
  	cp = mtod(m, u_char *) + sizeof(struct in_addr);
! 	memmove(cp, mtod(m, caddr_t), (unsigned)cnt);
  	bzero(mtod(m, caddr_t), sizeof(struct in_addr));
  
  	for (; cnt > 0; cnt -= optlen, cp += optlen) {
***************
*** 882,890 ****
  			 * Then copy rest of options back
  			 * to close up the deleted entry.
  			 */
! 			ovbcopy((caddr_t)(&cp[IPOPT_OFFSET+1] +
! 			    sizeof(struct in_addr)),
! 			    (caddr_t)&cp[IPOPT_OFFSET+1],
  			    (unsigned)cnt + sizeof(struct in_addr));
  			break;
  		}
--- 882,889 ----
  			 * Then copy rest of options back
  			 * to close up the deleted entry.
  			 */
! 			memmove(&cp[IPOPT_OFFSET+1],
!                             (caddr_t)(&cp[IPOPT_OFFSET+1] + sizeof(struct in_addr)),
  			    (unsigned)cnt + sizeof(struct in_addr));
  			break;
  		}
Index: netiso/iso_pcb.c
===================================================================
RCS file: /home/cvs-base/src/sys/netiso/iso_pcb.c,v
retrieving revision 1.1.1.5
diff -c -r1.1.1.5 iso_pcb.c
*** netiso/iso_pcb.c	1998/07/05 17:08:31	1.1.1.5
--- netiso/iso_pcb.c	1999/01/30 16:47:30
***************
*** 311,317 ****
  	if (siso->siso_nlen == 0) {
  		if ((ia = iso_ifaddr.tqh_first) != NULL) {
  			int             nlen = ia->ia_addr.siso_nlen;
! 			ovbcopy(TSEL(siso), nlen + TSEL(siso),
  			siso->siso_plen + siso->siso_tlen + siso->siso_slen);
  			bcopy((caddr_t) & ia->ia_addr.siso_addr,
  			      (caddr_t) & siso->siso_addr, nlen + 1);
--- 311,317 ----
  	if (siso->siso_nlen == 0) {
  		if ((ia = iso_ifaddr.tqh_first) != NULL) {
  			int             nlen = ia->ia_addr.siso_nlen;
! 			memmove(nlen + TSEL(siso), TSEL(siso),
  			siso->siso_plen + siso->siso_tlen + siso->siso_slen);
  			bcopy((caddr_t) & ia->ia_addr.siso_addr,
  			      (caddr_t) & siso->siso_addr, nlen + 1);
***************
*** 385,391 ****
  		}
  		siso->siso_nlen = ia->ia_addr.siso_nlen;
  		newtsel = TSEL(siso);
! 		ovbcopy(oldtsel, newtsel, tlen);
  		bcopy(ia->ia_addr.siso_data, siso->siso_data, nlen);
  		siso->siso_tlen = tlen;
  		siso->siso_family = AF_ISO;
--- 385,391 ----
  		}
  		siso->siso_nlen = ia->ia_addr.siso_nlen;
  		newtsel = TSEL(siso);
! 		memmove(newtsel, oldtsel, tlen);
  		bcopy(ia->ia_addr.siso_data, siso->siso_data, nlen);
  		siso->siso_tlen = tlen;
  		siso->siso_family = AF_ISO;
***************
*** 463,469 ****
  	if ((siso = isop->isop_laddr) && siso->siso_nlen && siso->siso_tlen) {
  		caddr_t         otsel = TSEL(siso);
  		siso->siso_nlen = 0;
! 		ovbcopy(otsel, TSEL(siso), siso->siso_tlen);
  	}
  	if (isop->isop_faddr && isop->isop_faddr != &isop->isop_sfaddr)
  		m_freem(isop->isop_mfaddr);
--- 463,469 ----
  	if ((siso = isop->isop_laddr) && siso->siso_nlen && siso->siso_tlen) {
  		caddr_t         otsel = TSEL(siso);
  		siso->siso_nlen = 0;
! 		memmove(TSEL(siso), otsel, siso->siso_tlen);
  	}
  	if (isop->isop_faddr && isop->isop_faddr != &isop->isop_sfaddr)
  		m_freem(isop->isop_mfaddr);
Index: sys/systm.h
===================================================================
RCS file: /home/cvs-base/src/sys/sys/systm.h,v
retrieving revision 1.1.1.26
diff -c -r1.1.1.26 systm.h
*** sys/systm.h	1999/01/28 14:32:49	1.1.1.26
--- sys/systm.h	1999/01/30 16:49:41
***************
*** 205,211 ****
  /* XXX b*() are now macros. should remove these prototypes soon */
  #if 0
  void	bcopy __P((const void *, void *, size_t));
- void	ovbcopy __P((const void *, void *, size_t));
  void	bzero __P((void *, size_t));
  int	bcmp __P((const void *, const void *, size_t));
  #endif
--- 205,210 ----
***************
*** 215,221 ****
  #endif
  
  #define bcopy(src, dst, len)	memcpy(dst, src, len)
- #define ovbcopy(src, dst, len)	memmove(dst, src, len)
  #define bzero(src, len)		memset(src, 0, len)
  #define bcmp(a, b, len)		memcmp(a, b, len)
  
--- 214,219 ----

regards
Erik Bertelsen, UNI-C.
>Audit-Trail:
>Unformatted: