Subject: port-powerpc/6095: bcopy->memcpy for arch/powerpc
To: None <gnats-bugs@gnats.netbsd.org>
From: Erik Bertelsen <erik@q610.ebe.uni-c.dk>
List: netbsd-bugs
Date: 09/03/1998 20:56:33
>Number: 6095
>Category: port-powerpc
>Synopsis: bcopy->memcpy for arch/powerpc
>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 12:05: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:
Recently parts of the kernel has been updated to use memcpy and
friends instead of bcopy.
Below is the patches to changes calls of bcopy into calls of
memcpy for powerpc. These patches have been developed while
building a macppc kernel without bcopy.
>How-To-Repeat:
>Fix:
Index: db_interface.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/powerpc/powerpc/db_interface.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 db_interface.c
*** db_interface.c 1998/09/01 17:15:15 1.1.1.3
--- db_interface.c 1998/09/03 18:51:21
***************
*** 28,40 ****
&& (frame->srr1 & 0x20000))
|| frame->exc == EXC_BPT)) {
! bcopy(frame->fixreg, DDB_REGS->r, 32 * sizeof(u_int32_t));
DDB_REGS->iar = frame->srr0;
DDB_REGS->msr = frame->srr1;
db_trap(T_BREAKPOINT, 0);
! bcopy(DDB_REGS->r, frame->fixreg, 32 * sizeof(u_int32_t));
return 1;
}
--- 28,40 ----
&& (frame->srr1 & 0x20000))
|| frame->exc == EXC_BPT)) {
! memcpy(DDB_REGS->r, frame->fixreg, 32 * sizeof(u_int32_t));
DDB_REGS->iar = frame->srr0;
DDB_REGS->msr = frame->srr1;
db_trap(T_BREAKPOINT, 0);
! memcpy(frame->fixreg, DDB_REGS->r, 32 * sizeof(u_int32_t));
return 1;
}
Index: pmap.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/powerpc/powerpc/pmap.c,v
retrieving revision 1.1.1.7
diff -c -r1.1.1.7 pmap.c
*** pmap.c 1998/09/01 17:15:17 1.1.1.7
--- pmap.c 1998/09/03 18:51:21
***************
*** 389,395 ****
*/
if (sz == 0) {
empty:
! bcopy(mp + 1, mp,
(cnt - (mp - avail)) * sizeof *mp);
cnt--;
mp--;
--- 389,395 ----
*/
if (sz == 0) {
empty:
! memcpy(mp, mp + 1,
(cnt - (mp - avail)) * sizeof *mp);
cnt--;
mp--;
***************
*** 403,409 ****
if (s < mp1->start)
break;
if (mp1 < mp) {
! bcopy(mp1, mp1 + 1, (void *)mp - (void *)mp1);
mp1->start = s;
mp1->size = sz;
} else {
--- 403,409 ----
if (s < mp1->start)
break;
if (mp1 < mp) {
! memcpy(mp1 + 1, mp1, (void *)mp - (void *)mp1);
mp1->start = s;
mp1->size = sz;
} else {
***************
*** 432,445 ****
if (s)
mp->size = s;
else {
! bcopy(mp + 1, mp,
(cnt - (mp - avail)) * sizeof *mp);
mp = avail;
}
break;
}
if (s != 0) {
! bcopy(mp, mp + 1,
(cnt - (mp - avail)) * sizeof *mp);
mp++->size = s;
}
--- 432,445 ----
if (s)
mp->size = s;
else {
! memcpy(mp, mp + 1,
(cnt - (mp - avail)) * sizeof *mp);
mp = avail;
}
break;
}
if (s != 0) {
! memcpy(mp + 1, mp,
(cnt - (mp - avail)) * sizeof *mp);
mp++->size = s;
}
***************
*** 471,477 ****
mp->size -= sz;
mp->start += sz;
if (mp->size <= 0)
! bcopy(mp + 1, mp, (cnt - (mp - avail)) * sizeof *mp);
for (i = 0; i < ptab_cnt; i++)
LIST_INIT(potable + i);
LIST_INIT(&pv_page_freelist);
--- 471,477 ----
mp->size -= sz;
mp->start += sz;
if (mp->size <= 0)
! memcpy(mp, mp + 1, (cnt - (mp - avail)) * sizeof *mp);
for (i = 0; i < ptab_cnt; i++)
LIST_INIT(potable + i);
LIST_INIT(&pv_page_freelist);
***************
*** 492,498 ****
mp->size -= sz;
mp->start += sz;
if (mp->size <= 0)
! bcopy(mp + 1, mp, (cnt - (mp - avail)) * sizeof *mp);
#endif
#if defined(MACHINE_NEW_NONCONTIG)
--- 492,498 ----
mp->size -= sz;
mp->start += sz;
if (mp->size <= 0)
! memcpy(mp, mp + 1, (cnt - (mp - avail)) * sizeof *mp);
#endif
#if defined(MACHINE_NEW_NONCONTIG)
***************
*** 822,828 ****
pmap_copy_page(src, dst)
paddr_t src, dst;
{
! bcopy((caddr_t)src, (caddr_t)dst, NBPG);
}
static struct pv_entry *
--- 822,828 ----
pmap_copy_page(src, dst)
paddr_t src, dst;
{
! memcpy((void *)dst, (void *)src, NBPG);
}
static struct pv_entry *
Index: trap.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/powerpc/powerpc/trap.c,v
retrieving revision 1.1.1.5
diff -c -r1.1.1.5 trap.c
*** trap.c 1998/09/01 17:15:18 1.1.1.5
--- trap.c 1998/09/03 18:51:21
***************
*** 117,123 ****
frame->srr0 = (*fb)[0];
frame->fixreg[1] = (*fb)[1];
frame->cr = (*fb)[2];
! bcopy(&(*fb)[3], &frame->fixreg[13],
19 * sizeof(register_t));
return;
}
--- 117,123 ----
frame->srr0 = (*fb)[0];
frame->fixreg[1] = (*fb)[1];
frame->cr = (*fb)[2];
! memcpy(&frame->fixreg[13], &(*fb)[3],
19 * sizeof(register_t));
return;
}
***************
*** 215,221 ****
argsize = callp->sy_argsize;
n = NARGREG - (params - (frame->fixreg + FIRSTARG));
if (argsize > n * sizeof(register_t)) {
! bcopy(params, args, n * sizeof(register_t));
if (error = copyin(MOREARGS(frame->fixreg[1]),
args + n,
argsize - n * sizeof(register_t))) {
--- 215,221 ----
argsize = callp->sy_argsize;
n = NARGREG - (params - (frame->fixreg + FIRSTARG));
if (argsize > n * sizeof(register_t)) {
! memcpy(args, params, n * sizeof(register_t));
if (error = copyin(MOREARGS(frame->fixreg[1]),
args + n,
argsize - n * sizeof(register_t))) {
***************
*** 406,412 ****
if (l > len)
l = len;
setusr(curpcb->pcb_pm->pm_sr[(u_int)udaddr >> ADDR_SR_SHFT]);
! bcopy(p, kaddr, l);
udaddr += l;
kaddr += l;
len -= l;
--- 406,412 ----
if (l > len)
l = len;
setusr(curpcb->pcb_pm->pm_sr[(u_int)udaddr >> ADDR_SR_SHFT]);
! memcpy(kaddr, p, l);
udaddr += l;
kaddr += l;
len -= l;
***************
*** 433,439 ****
if (l > len)
l = len;
setusr(curpcb->pcb_pm->pm_sr[(u_int)udaddr >> ADDR_SR_SHFT]);
! bcopy(kaddr, p, l);
udaddr += l;
kaddr += l;
len -= l;
--- 433,439 ----
if (l > len)
l = len;
setusr(curpcb->pcb_pm->pm_sr[(u_int)udaddr >> ADDR_SR_SHFT]);
! memcpy(p, kaddr, l);
udaddr += l;
kaddr += l;
len -= l;
***************
*** 466,472 ****
return EFAULT;
}
! bcopy(src, dst, len);
curpcb->pcb_onfault = 0;
return 0;
--- 466,472 ----
return EFAULT;
}
! memcpy(dst, src, len);
curpcb->pcb_onfault = 0;
return 0;
Index: vm_machdep.c
===================================================================
RCS file: /home/cvs-base/src/sys/arch/powerpc/powerpc/vm_machdep.c,v
retrieving revision 1.1.1.3
diff -c -r1.1.1.3 vm_machdep.c
*** vm_machdep.c 1998/09/01 17:15:19 1.1.1.3
--- vm_machdep.c 1998/09/03 18:51:21
***************
*** 77,83 ****
*/
stktop1 = (caddr_t)trapframe(p1);
stktop2 = (caddr_t)trapframe(p2);
! bcopy(stktop1, stktop2, sizeof(struct trapframe));
stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */
/*
--- 77,83 ----
*/
stktop1 = (caddr_t)trapframe(p1);
stktop2 = (caddr_t)trapframe(p2);
! memcpy(stktop2, stktop1, sizeof(struct trapframe));
stktop2 = (caddr_t)((u_long)stktop2 & ~15); /* Align stack pointer */
/*
***************
*** 197,203 ****
chdr->c_cpusize = sizeof md_core;
tf = trapframe(p);
! bcopy(tf, &md_core.frame, sizeof md_core.frame);
CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_POWERPC, CORE_CPU);
cseg.c_addr = 0;
--- 197,203 ----
chdr->c_cpusize = sizeof md_core;
tf = trapframe(p);
! memcpy(&md_core.frame, tf, sizeof md_core.frame);
CORE_SETMAGIC(cseg, CORESEGMAGIC, MID_POWERPC, CORE_CPU);
cseg.c_addr = 0;
regards
Erik Bertelsen
>Audit-Trail:
>Unformatted: