bzero->memset, bcopy->memcpy, bcmp->memcmp

This commit is contained in:
perry 1998-08-05 02:45:08 +00:00
parent 54f97ab9d1
commit c3579ce3f5
13 changed files with 60 additions and 58 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: apm.c,v 1.31 1998/04/03 18:18:05 cgd Exp $ */
/* $NetBSD: apm.c,v 1.32 1998/08/05 02:45:08 perry Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -1089,7 +1089,7 @@ apmattach(parent, self, aux)
apm_powmgt_engage(1, APM_DEV_NETWORK(APM_DEV_ALLUNITS));
apm_powmgt_engage(1, APM_DEV_PCMCIA(APM_DEV_ALLUNITS));
#endif
bzero(&regs, sizeof(regs));
memset(&regs, 0, sizeof(regs));
error = apm_get_powstat(&regs);
if (error == 0) {
apm_power_print(apmsc, &regs);
@ -1242,7 +1242,7 @@ apmioctl(dev, cmd, data, flag, p)
return (EIO);
}
bzero(powerp, sizeof(*powerp));
memset(powerp, 0, sizeof(*powerp));
if (APM_BATT_LIFE(&regs) != APM_BATT_LIFE_UNKNOWN)
powerp->battery_life = APM_BATT_LIFE(&regs);
powerp->ac_state = APM_AC_STATE(&regs);

View File

@ -1,4 +1,4 @@
/* $NetBSD: disksubr.c,v 1.30 1998/06/22 21:12:52 sommerfe Exp $ */
/* $NetBSD: disksubr.c,v 1.31 1998/08/05 02:45:08 perry Exp $ */
/*
* Copyright (c) 1982, 1986, 1988 Regents of the University of California.
@ -122,11 +122,11 @@ readdisklabel(dev, strat, lp, osdep)
} else {
struct dos_partition *ourdp = NULL;
if (bcmp(bp->b_data + MBRSIGOFS, mbrsig, sizeof(mbrsig)))
if (memcmp(bp->b_data + MBRSIGOFS, mbrsig, sizeof(mbrsig)))
goto nombrpart;
/* XXX how do we check veracity/bounds of this? */
bcopy(bp->b_data + DOSPARTOFF, dp,
memcpy(dp, bp->b_data + DOSPARTOFF,
NDOSPART * sizeof(*dp));
/* look for NetBSD partition */
@ -348,11 +348,11 @@ writedisklabel(dev, strat, lp, osdep)
if ((error = biowait(bp)) == 0) {
struct dos_partition *ourdp = NULL;
if (bcmp(bp->b_data + MBRSIGOFS, mbrsig, sizeof(mbrsig)))
if (memcmp(bp->b_data + MBRSIGOFS, mbrsig, sizeof(mbrsig)))
goto nombrpart;
/* XXX how do we check veracity/bounds of this? */
bcopy(bp->b_data + DOSPARTOFF, dp,
memcpy(dp, bp->b_data + DOSPARTOFF,
NDOSPART * sizeof(*dp));
/* look for NetBSD partition */

View File

@ -1,4 +1,4 @@
/* $NetBSD: freebsd_machdep.c,v 1.17 1998/05/08 16:55:15 kleink Exp $ */
/* $NetBSD: freebsd_machdep.c,v 1.18 1998/08/05 02:45:08 perry Exp $ */
/*-
* Copyright (c) 1993, 1994, 1995, 1996 Charles M. Hannum. All rights reserved.
@ -292,7 +292,7 @@ netbsd_to_freebsd_ptrace_regs(nregs, nfpregs, fregs)
fregs->freebsd_ptrace_fpregs.sv_env =
*(struct freebsd_env87 *)&nframe->sv_env;
bcopy(nframe->sv_ac, fregs->freebsd_ptrace_fpregs.sv_ac,
memcpy(fregs->freebsd_ptrace_fpregs.sv_ac, nframe->sv_ac,
sizeof(fregs->freebsd_ptrace_fpregs.sv_ac));
fregs->freebsd_ptrace_fpregs.sv_ex_sw =
nframe->sv_ex_sw;
@ -306,14 +306,15 @@ netbsd_to_freebsd_ptrace_regs(nregs, nfpregs, fregs)
"sizeof(freebsd_save87) >= sizeof(save87)");
}
#endif
bcopy(&nframe->sv_ex_tw, fregs->freebsd_ptrace_fpregs.sv_pad,
memcpy(fregs->freebsd_ptrace_fpregs.sv_pad, &nframe->sv_ex_tw,
sizeof(nframe->sv_ex_tw));
bcopy(nframe->sv_pad,
(caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad +
memcpy((caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad +
sizeof(nframe->sv_ex_tw),
nframe->sv_pad,
sizeof(nframe->sv_pad));
bzero((caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad +
memset((caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad +
sizeof(nframe->sv_ex_tw) + sizeof(nframe->sv_pad),
0,
sizeof(fregs->freebsd_ptrace_fpregs.sv_pad) -
sizeof(nframe->sv_ex_tw) - sizeof(nframe->sv_pad));
}
@ -345,18 +346,19 @@ freebsd_to_netbsd_ptrace_regs(fregs, nregs, nfpregs)
nframe->sv_env =
*(struct env87 *)&fregs->freebsd_ptrace_fpregs.sv_env;
bcopy(fregs->freebsd_ptrace_fpregs.sv_ac, nframe->sv_ac,
memcpy(nframe->sv_ac, fregs->freebsd_ptrace_fpregs.sv_ac,
sizeof(nframe->sv_ac));
nframe->sv_ex_sw =
fregs->freebsd_ptrace_fpregs.sv_ex_sw;
/*
* fortunately, sizeof(freebsd_save87) >= sizeof(save87)
*/
bcopy(fregs->freebsd_ptrace_fpregs.sv_pad, &nframe->sv_ex_tw,
memcpy(&nframe->sv_ex_tw, fregs->freebsd_ptrace_fpregs.sv_pad,
sizeof(nframe->sv_ex_tw));
bcopy((caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad +
memcpy(nframe->sv_pad,
(caddr_t)fregs->freebsd_ptrace_fpregs.sv_pad +
sizeof(nframe->sv_ex_tw),
nframe->sv_pad, sizeof(nframe->sv_pad));
sizeof(nframe->sv_pad));
}
/* random value, except FREEBSD_U_AR0_OFFSET..., FREEBSD_U_SAVEFP_OFFSET... */

View File

@ -1,4 +1,4 @@
/* $NetBSD: gdt.c,v 1.13 1998/02/10 14:11:02 mrg Exp $ */
/* $NetBSD: gdt.c,v 1.14 1998/08/05 02:45:08 perry Exp $ */
/*-
* Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@ -184,7 +184,7 @@ gdt_init()
vm_map_pageable(kernel_map, (vm_offset_t)gdt,
(vm_offset_t)gdt + min_len, FALSE);
#endif
bcopy(old_gdt, gdt, NGDT * sizeof(gdt[0]));
memcpy(gdt, old_gdt, NGDT * sizeof(gdt[0]));
setregion(&region, gdt, max_len - 1);
lgdt(&region);

View File

@ -1,4 +1,4 @@
/* $NetBSD: machdep.c,v 1.312 1998/07/17 21:10:00 thorpej Exp $ */
/* $NetBSD: machdep.c,v 1.313 1998/08/05 02:45:08 perry Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@ -548,7 +548,7 @@ cpu_startup()
VM_PROT_ALL, /* protection */
TRUE); /* wired down */
#endif
bcopy(biostramp_image, (caddr_t)BIOSTRAMP_BASE, biostramp_image_size);
memcpy((caddr_t)BIOSTRAMP_BASE, biostramp_image, biostramp_image_size);
#ifdef DEBUG
printf("biostramp installed @ %x\n", BIOSTRAMP_BASE);
#endif
@ -1398,7 +1398,7 @@ cpu_dump()
dump = bdevsw[major(dumpdev)].d_dump;
bzero(buf, sizeof buf);
memset(buf, 0, sizeof buf);
segp = (kcore_seg_t *)buf;
cpuhdrp = (cpu_kcore_hdr_t *)&buf[ALIGN(sizeof(*segp))];
memsegp = (phys_ram_seg_t *)&buf[ ALIGN(sizeof(*segp)) +
@ -1812,7 +1812,7 @@ init386(first_avail)
#if NBIOSCALL > 0
/* install page 2 (reserved above) as PT page for first 4M */
pmap_enter(pmap_kernel(), (u_long)vtopte(0), 2*NBPG, VM_PROT_ALL, TRUE);
bzero(vtopte(0), NBPG); /* make sure it is clean before using */
memset(vtopte(0), 0, NBPG); /* make sure it is clean before using */
#endif
pmap_enter(pmap_kernel(), idt_vaddr, idt_paddr, VM_PROT_ALL, TRUE);
@ -2211,7 +2211,7 @@ cpu_reset()
* Try to cause a triple fault and watchdog reset by making the IDT
* invalid and causing a fault.
*/
bzero((caddr_t)idt, NIDT * sizeof(idt[0]));
memset((caddr_t)idt, 0, NIDT * sizeof(idt[0]));
__asm __volatile("divl %0,%1" : : "q" (0), "a" (0));
#if 0
@ -2219,7 +2219,7 @@ cpu_reset()
* Try to cause a triple fault and watchdog reset by unmapping the
* entire address space and doing a TLB flush.
*/
bzero((caddr_t)PTD, NBPG);
memset((caddr_t)PTD, 0, NBPG);
pmap_update();
#endif
@ -2556,7 +2556,7 @@ _bus_dmamap_create(t, size, nsegments, maxsegsz, boundary, flags, dmamp)
(flags & BUS_DMA_NOWAIT) ? M_NOWAIT : M_WAITOK)) == NULL)
return (ENOMEM);
bzero(mapstore, mapsize);
memset(mapstore, 0, mapsize);
map = (struct i386_bus_dmamap *)mapstore;
map->_dm_size = size;
map->_dm_segcnt = nsegments;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mainbus.c,v 1.26 1998/05/04 18:49:33 thorpej Exp $ */
/* $NetBSD: mainbus.c,v 1.27 1998/08/05 02:45:09 perry Exp $ */
/*
* Copyright (c) 1996 Christopher G. Demetriou. All rights reserved.
@ -126,7 +126,7 @@ mainbus_attach(parent, self, aux)
}
#endif
if (bcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN) == 0 &&
if (memcmp(ISA_HOLE_VADDR(EISA_ID_PADDR), EISA_ID, EISA_ID_LEN) == 0 &&
eisa_has_been_seen == 0) {
mba.mba_eba.eba_busname = "eisa";
mba.mba_eba.eba_iot = I386_BUS_SPACE_IO;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mem.c,v 1.35 1998/07/05 08:49:35 jonathan Exp $ */
/* $NetBSD: mem.c,v 1.36 1998/08/05 02:45:09 perry Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@ -194,7 +194,7 @@ mmrw(dev, uio, flags)
if (zeropage == NULL) {
zeropage = (caddr_t)
malloc(CLBYTES, M_TEMP, M_WAITOK);
bzero(zeropage, CLBYTES);
memset(zeropage, 0, CLBYTES);
}
c = min(iov->iov_len, CLBYTES);
error = uiomove(zeropage, c, uio);

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.c,v 1.58 1998/07/08 05:41:59 thorpej Exp $ */
/* $NetBSD: pmap.c,v 1.59 1998/08/05 02:45:09 perry Exp $ */
/*
* Copyright (c) 1993, 1994, 1995, 1997 Charles M. Hannum. All rights reserved.
@ -262,7 +262,7 @@ pmap_bootstrap(virtual_start)
* Create Kernel page directory table and page maps.
* [ currently done in locore. i have wild and crazy ideas -wfj ]
*/
bzero(firstaddr, (1+nkpde)*NBPG);
memset(firstaddr, 0, (1+nkpde)*NBPG);
pmap_kernel()->pm_pdir = firstaddr + VM_MIN_KERNEL_ADDRESS;
pmap_kernel()->pm_ptab = firstaddr + VM_MIN_KERNEL_ADDRESS + NBPG;
@ -742,7 +742,7 @@ pmap_create(size)
return NULL;
pmap = (pmap_t) malloc(sizeof *pmap, M_VMPMAP, M_WAITOK);
bzero(pmap, sizeof(*pmap));
memset(pmap, 0, sizeof(*pmap));
pmap_pinit(pmap);
return pmap;
}
@ -772,7 +772,7 @@ pmap_pinit(pmap)
#endif
/* wire in kernel global address entries */
bcopy(&PTD[KPTDI], &pmap->pm_pdir[KPTDI], nkpde * sizeof(pd_entry_t));
memcpy(&pmap->pm_pdir[KPTDI], &PTD[KPTDI], nkpde * sizeof(pd_entry_t));
/* install self-referential address mapping entry */
pmap->pm_pdir[PTDPTDI] =
@ -1618,7 +1618,7 @@ pmap_dump_pvlist(phys, m)
/*
* pmap_zero_page zeros the specified by mapping it into
* virtual memory and using bzero to clear its contents.
* virtual memory and using memset to clear its contents.
*/
void
pmap_zero_page(phys)
@ -1633,12 +1633,12 @@ pmap_zero_page(phys)
pmap_dump_pvlist(phys, "pmap_zero_page: phys");
*CMAP2 = (phys & PG_FRAME) | PG_V | PG_KW /*| PG_N*/;
pmap_update();
bzero(CADDR2, NBPG);
memset(CADDR2, 0, NBPG);
}
/*
* pmap_copy_page copies the specified page by mapping
* it into virtual memory and using bcopy to copy its
* it into virtual memory and using memcpy to copy its
* contents.
*/
void
@ -1656,7 +1656,7 @@ pmap_copy_page(src, dst)
*CMAP1 = (src & PG_FRAME) | PG_V | PG_KR;
*CMAP2 = (dst & PG_FRAME) | PG_V | PG_KW /*| PG_N*/;
pmap_update();
bcopy(CADDR1, CADDR2, NBPG);
memcpy(CADDR2, CADDR1, NBPG);
}
/*

View File

@ -1,4 +1,4 @@
/* $NetBSD: pmap.new.c,v 1.14 1998/07/08 04:37:43 thorpej Exp $ */
/* $NetBSD: pmap.new.c,v 1.15 1998/08/05 02:45:09 perry Exp $ */
/*
*
@ -796,7 +796,7 @@ vm_offset_t kva_start;
TAILQ_INIT(&kpm->pm_obj.memq);
kpm->pm_obj.uo_npages = 0;
kpm->pm_obj.uo_refs = 1;
bzero(&kpm->pm_list, sizeof(kpm->pm_list)); /* pm_list not used */
memset(&kpm->pm_list, 0, sizeof(kpm->pm_list)); /* pm_list not used */
kpm->pm_pdir = (pd_entry_t *)(proc0.p_addr->u_pcb.pcb_cr3 + KERNBASE);
kpm->pm_pdirpa = (u_int32_t) proc0.p_addr->u_pcb.pcb_cr3;
kpm->pm_stats.wired_count = kpm->pm_stats.resident_count =
@ -954,7 +954,7 @@ void pmap_init()
panic("pmap_init: unable to allocate pv_heads");
/*
* init all pv_head's and attrs in one bzero
* init all pv_head's and attrs in one memset
*/
/* allocate pv_head stuff first */
@ -1750,7 +1750,7 @@ struct pmap *pmap;
/* init PDP */
/* zero init area */
bzero(pmap->pm_pdir, PDSLOT_PTE * sizeof(pd_entry_t));
memset(pmap->pm_pdir, 0, PDSLOT_PTE * sizeof(pd_entry_t));
/* put in recursive PDE to map the PTEs */
pmap->pm_pdir[PDSLOT_PTE] = pmap->pm_pdirpa | PG_V | PG_KW;
@ -1762,10 +1762,10 @@ struct pmap *pmap;
*/
simple_lock(&pmaps_lock);
/* put in kernel VM PDEs */
bcopy(&PDP_BASE[PDSLOT_KERN], &pmap->pm_pdir[PDSLOT_KERN],
memcpy(&pmap->pm_pdir[PDSLOT_KERN], &PDP_BASE[PDSLOT_KERN],
nkpde * sizeof(pd_entry_t));
/* zero the rest */
bzero(&pmap->pm_pdir[PDSLOT_KERN + nkpde],
memset(&pmap->pm_pdir[PDSLOT_KERN + nkpde], 0,
NBPG - ((PDSLOT_KERN + nkpde) * sizeof(pd_entry_t)));
LIST_INSERT_HEAD(&pmaps, pmap, pm_list);
if (pmaps_hand == NULL)
@ -1989,7 +1989,7 @@ vm_offset_t pa;
#endif
*zero_pte = (pa & PG_FRAME) | PG_V | PG_RW; /* map in */
bzero(zerop, NBPG); /* zero */
memset(zerop, 0, NBPG); /* zero */
*zero_pte = 0; /* zap! */
pmap_update_pg((vm_offset_t)zerop); /* flush TLB */
simple_unlock(&pmap_zero_page_lock);
@ -2012,7 +2012,7 @@ vm_offset_t srcpa, dstpa;
*csrc_pte = (srcpa & PG_FRAME) | PG_V | PG_RW;
*cdst_pte = (dstpa & PG_FRAME) | PG_V | PG_RW;
bcopy(csrcp, cdstp, NBPG);
memcpy(cdstp, csrcp, NBPG);
*csrc_pte = *cdst_pte = 0; /* zap! */
pmap_update_2pg((vm_offset_t)csrcp, (vm_offset_t)cdstp);
simple_unlock(&pmap_copy_page_lock);

View File

@ -1,4 +1,4 @@
/* $NetBSD: process_machdep.c,v 1.27 1998/01/24 14:22:44 mycroft Exp $ */
/* $NetBSD: process_machdep.c,v 1.28 1998/08/05 02:45:09 perry Exp $ */
/*
* Copyright (c) 1995, 1996, 1997, 1998
@ -165,14 +165,14 @@ process_read_fpregs(p, regs)
* save it temporarily.
*/
cw = frame->sv_env.en_cw;
bzero(frame, sizeof(*regs));
memset(frame, 0, sizeof(*regs));
frame->sv_env.en_cw = cw;
frame->sv_env.en_sw = 0x0000;
frame->sv_env.en_tw = 0xffff;
p->p_md.md_flags |= MDP_USEDFPU;
}
bcopy(frame, regs, sizeof(*regs));
memcpy(regs, frame, sizeof(*regs));
return (0);
}
@ -259,7 +259,7 @@ process_write_fpregs(p, regs)
p->p_md.md_flags |= MDP_USEDFPU;
}
bcopy(regs, frame, sizeof(*regs));
memcpy(frame, regs, sizeof(*regs));
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: svr4_machdep.c,v 1.35 1998/05/08 16:55:16 kleink Exp $ */
/* $NetBSD: svr4_machdep.c,v 1.36 1998/08/05 02:45:09 perry Exp $ */
/*
* Copyright (c) 1994 Christos Zoulas
@ -88,7 +88,7 @@ svr4_getcontext(p, uc, mask, oonstack)
struct svr4_sigaltstack *s = &uc->uc_stack;
struct sigaltstack *sf = &psp->ps_sigstk;
bzero(uc, sizeof(struct svr4_ucontext));
memset(uc, 0, sizeof(struct svr4_ucontext));
/*
* Set the general purpose registers

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys_machdep.c,v 1.41 1998/02/25 21:41:56 perry Exp $ */
/* $NetBSD: sys_machdep.c,v 1.42 1998/08/05 02:45:09 perry Exp $ */
/*-
* Copyright (c) 1995, 1997
@ -261,8 +261,8 @@ i386_set_ldt(p, args, retval)
#else
new_ldt = (union descriptor *)kmem_alloc(kernel_map, new_len);
#endif
bcopy(old_ldt, new_ldt, old_len);
bzero((caddr_t)new_ldt + old_len, new_len - old_len);
memcpy(new_ldt, old_ldt, old_len);
memset((caddr_t)new_ldt + old_len, 0, new_len - old_len);
pcb->pcb_ldt = new_ldt;
if (pcb->pcb_flags & PCB_USER_LDT)

View File

@ -1,4 +1,4 @@
/* $NetBSD: vm_machdep.c,v 1.69 1998/07/28 18:34:54 thorpej Exp $ */
/* $NetBSD: vm_machdep.c,v 1.70 1998/08/05 02:45:10 perry Exp $ */
/*-
* Copyright (c) 1995 Charles M. Hannum. All rights reserved.
@ -140,7 +140,7 @@ cpu_fork(p1, p2)
#else
new_ldt = (union descriptor *)kmem_alloc(kernel_map, len);
#endif
bcopy(pcb->pcb_ldt, new_ldt, len);
memcpy(new_ldt, pcb->pcb_ldt, len);
pcb->pcb_ldt = new_ldt;
ldt_alloc(pcb, new_ldt, len);
}