Subject: port-macppc/6096: bcopy->memcpy changes for arch/macppc
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@q610.ebe.uni-c.dk>
List: netbsd-bugs
Date: 09/03/1998 22:09:12
>Number:         6096
>Category:       port-macppc
>Synopsis:       bcopy->memcpy changes for arch/macppc
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin (GNATS administrator)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Sep  3 13:20:00 1998
>Last-Modified:
>Originator:     Erik Bertelsen
>Organization:
	
>Release:        NetBSD-current 3 Sep 1998
>Environment:
	
System: NetBSD q610.ebe.uni-c.dk 1.3H NetBSD 1.3H (Q610) #: Wed Sep 2 20:49:28 MEST 1998 erik@q610.ebe.uni-c.dk:/home/src/sys/arch/mac68k/compile/Q610 mac68k


>Description:
	As a follow-up to the recent changes of parts of the NetBSD kernel
	to use memcpy (and friends) instead of bcopy, etc., please find the
	arch/macppc related changes. These patches were developed while
	building a macppc kernel without bcopy.
>How-To-Repeat:
>Fix:
Index: dev/adb_direct.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/macppc/dev/adb_direct.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 adb_direct.c
*** adb_direct.c	1998/06/27 17:35:19	1.1.1.2
--- adb_direct.c	1998/09/03 20:03:11
***************
*** 1816,1822 ****
  			;
  
  		/* *time = (long)(*(long *)(output + 1)) - 2082844800; */
! 		bcopy(output + 1, time, 4);
  		*time -= 2082844800;
  		return 0;
  
--- 1816,1822 ----
  			;
  
  		/* *time = (long)(*(long *)(output + 1)) - 2082844800; */
! 		memcpy(time, output + 1, 4);
  		*time -= 2082844800;
  		return 0;
  
Index: dev/grf.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/macppc/dev/grf.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 grf.c
*** grf.c	1998/05/20 19:01:17	1.1.1.1
--- grf.c	1998/09/03 20:03:11
***************
*** 207,213 ****
  
  	switch (cmd) {
  	case GRFIOCGINFO:
! 		bcopy(gm, data, sizeof(struct grfinfo));
  		break;
  	case GRFIOCON:
  		error = grfon(dev);
--- 207,213 ----
  
  	switch (cmd) {
  	case GRFIOCGINFO:
! 		memcpy(data, gm, sizeof(struct grfinfo));
  		break;
  	case GRFIOCON:
  		error = grfon(dev);
Index: dev/zs.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/macppc/dev/zs.c,v
retrieving revision 1.1.1.6
diff -c -r1.1.1.6 zs.c
*** zs.c	1998/08/27 15:49:54	1.1.1.6
--- zs.c	1998/09/03 20:03:11
***************
*** 307,314 ****
  		cs->cs_reg_csr  = &zc->zc_csr;
  		cs->cs_reg_data = &zc->zc_data;
  
! 		bcopy(zs_init_reg, cs->cs_creg, 16);
! 		bcopy(zs_init_reg, cs->cs_preg, 16);
  
  		/* Current BAUD rate generator clock. */
  		cs->cs_brg_clk = ZS_STD_BRG;	/* RTxC is 230400*16, so use 230400 */
--- 307,314 ----
  		cs->cs_reg_csr  = &zc->zc_csr;
  		cs->cs_reg_data = &zc->zc_data;
  
! 		memcpy(cs->cs_creg, zs_init_reg, 16);
! 		memcpy(cs->cs_preg, zs_init_reg, 16);
  
  		/* Current BAUD rate generator clock. */
  		cs->cs_brg_clk = ZS_STD_BRG;	/* RTxC is 230400*16, so use 230400 */
Index: macppc/disksubr.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/macppc/macppc/disksubr.c,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 disksubr.c
*** disksubr.c	1998/09/02 16:01:35	1.1.1.2
--- disksubr.c	1998/09/03 20:03:11
***************
*** 323,329 ****
  
  	bp->b_flags = B_BUSY | B_WRITE;
  
! 	bcopy((caddr_t)lp, (caddr_t)bp->b_data + LABELOFFSET, sizeof *lp);
  
  	(*strat)(bp);
  	error = biowait(bp);
--- 323,329 ----
  
  	bp->b_flags = B_BUSY | B_WRITE;
  
! 	memcpy(bp->b_data + LABELOFFSET, lp, sizeof *lp);
  
  	(*strat)(bp);
  	error = biowait(bp);
Index: macppc/machdep.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/macppc/macppc/machdep.c,v
retrieving revision 1.1.1.10
diff -c -r1.1.1.10 machdep.c
*** machdep.c	1998/08/22 14:45:07	1.1.1.10
--- machdep.c	1998/09/03 20:03:11
***************
*** 258,264 ****
  	for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100)
  		switch (exc) {
  		default:
! 			bcopy(&trapcode, (void *)exc, (size_t)&trapsize);
  			break;
  		case EXC_EXI:
  			/*
--- 258,264 ----
  	for (exc = EXC_RSVD; exc <= EXC_LAST; exc += 0x100)
  		switch (exc) {
  		default:
! 			memcpy((void *)exc, &trapcode, (size_t)&trapsize);
  			break;
  		case EXC_EXI:
  			/*
***************
*** 266,296 ****
  			 */
  			break;
  		case EXC_DSI:
! 			bcopy(&dsitrap, (void *)EXC_DSI, (size_t)&dsisize);
  			break;
  		case EXC_ISI:
! 			bcopy(&isitrap, (void *)EXC_ISI, (size_t)&isisize);
  			break;
  		case EXC_DECR:
! 			bcopy(&decrint, (void *)EXC_DECR, (size_t)&decrsize);
  			break;
  		case EXC_IMISS:
! 			bcopy(&tlbimiss, (void *)EXC_IMISS, (size_t)&tlbimsize);
  			break;
  		case EXC_DLMISS:
! 			bcopy(&tlbdlmiss, (void *)EXC_DLMISS, (size_t)&tlbdlmsize);
  			break;
  		case EXC_DSMISS:
! 			bcopy(&tlbdsmiss, (void *)EXC_DSMISS, (size_t)&tlbdsmsize);
  			break;
  #if defined(DDB) || NIPKDB > 0
  		case EXC_PGM:
  		case EXC_TRC:
  		case EXC_BPT:
  #if defined(DDB)
! 			bcopy(&ddblow, (void *)exc, (size_t)&ddbsize);
  #else
! 			bcopy(&ipkdblow, (void *)exc, (size_t)&ipkdbsize);
  #endif
  			break;
  #endif /* DDB || NIPKDB > 0 */
--- 266,296 ----
  			 */
  			break;
  		case EXC_DSI:
! 			memcpy((void *)EXC_DSI, &dsitrap, (size_t)&dsisize);
  			break;
  		case EXC_ISI:
! 			memcpy((void *)EXC_ISI, &isitrap, (size_t)&isisize);
  			break;
  		case EXC_DECR:
! 			memcpy((void *)EXC_DECR, &decrint, (size_t)&decrsize);
  			break;
  		case EXC_IMISS:
! 			memcpy((void *)EXC_IMISS, &tlbimiss, (size_t)&tlbimsize);
  			break;
  		case EXC_DLMISS:
! 			memcpy((void *)EXC_DLMISS, &tlbdlmiss, (size_t)&tlbdlmsize);
  			break;
  		case EXC_DSMISS:
! 			memcpy((void *)EXC_DSMISS, &tlbdsmiss, (size_t)&tlbdsmsize);
  			break;
  #if defined(DDB) || NIPKDB > 0
  		case EXC_PGM:
  		case EXC_TRC:
  		case EXC_BPT:
  #if defined(DDB)
! 			memcpy((void *)exc, &ddblow, (size_t)&ddbsize);
  #else
! 			memcpy((void *)exc, &ipkdblow, (size_t)&ipkdbsize);
  #endif
  			break;
  #endif /* DDB || NIPKDB > 0 */
***************
*** 425,431 ****
  	asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
  		      : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
  	extint_call = (extint_call & 0xfc000003) | offset;
! 	bcopy(&extint, (void *)EXC_EXI, (size_t)&extsize);
  	syncicache((void *)&extint_call, sizeof extint_call);
  	syncicache((void *)EXC_EXI, (int)&extsize);
  	asm volatile ("mtmsr %0" :: "r"(omsr));
--- 425,431 ----
  	asm volatile ("mfmsr %0; andi. %1,%0,%2; mtmsr %1"
  		      : "=r"(omsr), "=r"(msr) : "K"((u_short)~PSL_EE));
  	extint_call = (extint_call & 0xfc000003) | offset;
! 	memcpy((void *)EXC_EXI, &extint, (size_t)&extsize);
  	syncicache((void *)&extint_call, sizeof extint_call);
  	syncicache((void *)EXC_EXI, (int)&extsize);
  	asm volatile ("mtmsr %0" :: "r"(omsr));
***************
*** 748,754 ****
  	 */
  	frame.sf_sc.sc_onstack = oldonstack;
  	frame.sf_sc.sc_mask = mask;
! 	bcopy(tf, &frame.sf_sc.sc_frame, sizeof *tf);
  	if (copyout(&frame, fp, sizeof frame) != 0)
  		sigexit(p, SIGILL);
  
--- 748,754 ----
  	 */
  	frame.sf_sc.sc_onstack = oldonstack;
  	frame.sf_sc.sc_mask = mask;
! 	memcpy(&frame.sf_sc.sc_frame, tf, sizeof *tf);
  	if (copyout(&frame, fp, sizeof frame) != 0)
  		sigexit(p, SIGILL);
  
***************
*** 782,788 ****
  	tf = trapframe(p);
  	if ((sc.sc_frame.srr1 & PSL_USERSTATIC) != (tf->srr1 & PSL_USERSTATIC))
  		return EINVAL;
! 	bcopy(&sc.sc_frame, tf, sizeof *tf);
  	if (sc.sc_onstack & 1)
  		p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
  	else
--- 782,788 ----
  	tf = trapframe(p);
  	if ((sc.sc_frame.srr1 & PSL_USERSTATIC) != (tf->srr1 & PSL_USERSTATIC))
  		return EINVAL;
! 	memcpy(tf, &sc.sc_frame, sizeof *tf);
  	if (sc.sc_onstack & 1)
  		p->p_sigacts->ps_sigstk.ss_flags |= SS_ONSTACK;
  	else

regards
Erik Bertelsen.
>Audit-Trail:
>Unformatted: