summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog59
-rw-r--r--device/cirbuf.c5
-rw-r--r--device/cons.c3
-rw-r--r--device/dev_pager.c5
-rw-r--r--device/ds_routines.c8
-rw-r--r--device/kmsg.c2
-rw-r--r--device/net_io.c21
-rw-r--r--i386/i386/fpu.c32
-rw-r--r--i386/i386/iopb.c6
-rw-r--r--i386/i386/mp_desc.c16
-rw-r--r--i386/i386/pcb.c16
-rw-r--r--i386/i386/phys.c12
-rw-r--r--i386/i386/trap.c8
-rw-r--r--i386/i386/user_ldt.c22
-rw-r--r--i386/i386at/immc.c6
-rw-r--r--i386/i386at/kd_event.c6
-rw-r--r--i386/intel/pmap.c8
-rw-r--r--include/mach/mig_support.h12
-rw-r--r--include/string.h33
-rw-r--r--ipc/ipc_entry.c4
-rw-r--r--ipc/ipc_kmsg.c6
-rw-r--r--ipc/ipc_object.c10
-rw-r--r--ipc/ipc_port.c4
-rw-r--r--ipc/ipc_space.c2
-rw-r--r--ipc/mach_debug.c6
-rw-r--r--kern/act.c4
-rw-r--r--kern/boot_script.c2
-rw-r--r--kern/bootstrap.c5
-rw-r--r--kern/eventcount.c4
-rw-r--r--kern/host.c16
-rw-r--r--kern/lock.c4
-rw-r--r--kern/lock_mon.c6
-rw-r--r--kern/mach_clock.c4
-rw-r--r--kern/pc_sample.c20
-rw-r--r--kern/processor.c4
-rw-r--r--kern/syscall_emulation.c28
-rw-r--r--kern/task.c4
-rw-r--r--kern/xpr.c4
-rw-r--r--kern/zalloc.c6
-rw-r--r--vm/vm_debug.c6
-rw-r--r--vm/vm_kern.c8
-rw-r--r--vm/vm_object.c4
-rw-r--r--vm/vm_resident.c4
43 files changed, 299 insertions, 146 deletions
diff --git a/ChangeLog b/ChangeLog
index 941b972..387d4cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,62 @@
+2006-11-05 Barry deFreese <bddebian@comcast.net>
+
+ memcpy/memset cleanup.
+
+ * include/string.h: New file.
+ * include/mach/mig_support.h: Include `string.h'.
+ [MACH_KERNEL] (bcopy): Remove extern declaration.
+ [MACH_KERNEL] (memcpy): Remove macro.
+ * device/cirbuf.c: Include `string.h'.
+ (q_to_b, b_to_q): Replace bcopy() with memcpy() and bzero() with
+ memset(), clean memcpy() and memset() invocation.
+ * device/cons.c (cnputc): Likewise.
+ * device/dev_pager.c (device_pager_data_request_done): Likewise.
+ * device/ds_routines.c (device_write_get, ds_read_done): Likewise.
+ * device/kmsg.c: Likewise.
+ * device/net_io.c (net_filter, net_set_filter, net_getstat): Likewise.
+ * i386/i386/fpu.c (fpu_set_state, fpu_get_state) fp_load)
+ (fp_state_alloc): Likewise.
+ * i386/i386/iopb.c (io_tss_init, i386_io_port_list): Likewise.
+ * i386/i386/mp_desc.c (mp_desc_init): Likewise.
+ * i386/i386/pcb.c (pcb_init, thread_setstatus)
+ (thread_getstatus): Likewise.
+ * i386/i386/phys.c (pmap_zero_page, pmap_copy_page, copy_to_phys)
+ (copy_from_phys): Likewise.
+ * i386/i386/trap.c (v86_assist): Likewise.
+ * i386/i386/user_ldt.c (i386_set_ldt, i386_get_ldt): Likewise.
+ * i386/i386at/immc.c (immc_cnputc): Likewise.
+ * i386/i386at/kd_event.c (X_kdb_enter_init, X_kdb_exit_init): Likewise.
+ * i386/intel/pmap.c (pmap_init, pmap_page_table_page_alloc)
+ (pmap_create): Likewise.
+ * ipc/ipc_entry.c (ipc_entry_grow_table): Likewise.
+ * ipc/ipc_kmsg.c (ipc_kmsg_get_from_kernel)
+ (ipc_kmsg_put_to_kernel): Likewise.
+ * ipc/ipc_object.c (ipc_object_alloc, ipc_object_alloc_name): Likewise.
+ * ipc/ipc_port.c (ipc_port_dngrow): Likewise.
+ * ipc/ipc_space.c: Likewise.
+ * ipc/mach_debug.c (mach_port_space_info)
+ (mach_port_space_info): Likewise.
+ * kern/act.c (act_create): Likewise.
+ * kern/boot_script.c: Likewise.
+ * kern/bootstrap.c: Likewise.
+ * kern/eventcount.c (evc_init): Likewise.
+ * kern/host.c (host_info, host_processor_sets): Likewise.
+ * kern/lock.c (lock_init): Likewise.
+ * kern/lock_mon.c (lock_info_clear): Likewise.
+ * kern/mach_clock.c (mapable_time_init): Likewise.
+ * kern/pc_sample.c (get_sampled_pcs): Likewise.
+ * kern/processor.c (processor_set_things): Likewise.
+ * kern/syscall_emulation.c (task_set_emulation_vector_internal)
+ (task_get_emulation_vector, xxx_task_get_emulation_vector): Likewise.
+ * kern/task.c (task_threads): Likewise.
+ * kern/xpr.c (xprbootstrap): Likewise.
+ * kern/zalloc.c (host_zone_info): Likewise.
+ * vm/vm_debug.c (mach_vm_object_pages): Likewise.
+ * vm/vm_kern.c (projected_buffer_allocate, copyinmap)
+ (copyoutmap): Likewise.
+ * vm/vm_object.c (vm_object_bootstrap): Likewise.
+ * vm/vm_resident.c (vm_page_grab_contiguous_pages): Likewise.
+
2006-11-05 Samuel Thibault <samuel.thibault@ens-lyon.org>
* DEVELOPMENT: Document the following removals.
diff --git a/device/cirbuf.c b/device/cirbuf.c
index 9653168..c6ca196 100644
--- a/device/cirbuf.c
+++ b/device/cirbuf.c
@@ -30,6 +30,7 @@
* Circular buffers for TTY
*/
+#include <string.h>
#include <device/cirbuf.h>
#include <kern/kalloc.h>
@@ -143,7 +144,7 @@ q_to_b( register struct cirbuf *cb,
i = cb->c_cl - cb->c_cf;
if (i > count)
i = count;
- bcopy(cb->c_cf, cp, i);
+ memcpy(cp, cb->c_cf, i);
cp += i;
count -= i;
cb->c_cf += i;
@@ -184,7 +185,7 @@ b_to_q( register char * cp,
if (i > count)
i = count;
- bcopy(cp, cb->c_cl, i);
+ memcpy(cb->c_cl, cp, i);
cp += i;
count -= i;
cb->c_cc += i;
diff --git a/device/cons.c b/device/cons.c
index bbcb408..ded971e 100644
--- a/device/cons.c
+++ b/device/cons.c
@@ -20,6 +20,7 @@
* Utah $Hdr: cons.c 1.14 94/12/14$
*/
+#include <string.h>
#ifdef MACH_KERNEL
#include <sys/types.h>
#include <device/conf.h>
@@ -268,7 +269,7 @@ cnputc(c)
if (consbufused == 0) {
consbp = consbuf;
consbufused = 1;
- bzero(consbuf, CONSBUFSIZE);
+ memset(consbuf, 0, CONSBUFSIZE);
}
*consbp++ = c;
if (consbp >= &consbuf[CONSBUFSIZE])
diff --git a/device/dev_pager.c b/device/dev_pager.c
index 60e9f95..75b7451 100644
--- a/device/dev_pager.c
+++ b/device/dev_pager.c
@@ -30,6 +30,8 @@
* Device pager.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/port.h>
#include <mach/message.h>
@@ -424,8 +426,7 @@ boolean_t device_pager_data_request_done(register io_req_t ior)
if (ior->io_residual) {
if (device_pager_debug)
printf("(device_pager)data_request_done: r: 0x%x\n",ior->io_residual);
- bzero( (char *) (&ior->io_data[ior->io_count -
- ior->io_residual]),
+ memset((&ior->io_data[ior->io_count - ior->io_residual]), 0,
(unsigned) ior->io_residual);
}
} else {
diff --git a/device/ds_routines.c b/device/ds_routines.c
index dd2b7f5..f7ca4e6 100644
--- a/device/ds_routines.c
+++ b/device/ds_routines.c
@@ -28,6 +28,8 @@
* Date: 3/89
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/mig_errors.h>
@@ -618,7 +620,7 @@ device_write_get(ior, wait)
if (ior->io_op & IO_INBAND) {
assert(ior->io_count <= sizeof (io_buf_ptr_inband_t));
new_addr = zalloc(io_inband_zone);
- bcopy((void*)ior->io_data, (void*)new_addr, ior->io_count);
+ memcpy((void*)new_addr, ior->io_data, ior->io_count);
ior->io_data = (io_buf_ptr_t)new_addr;
ior->io_alloc_size = sizeof (io_buf_ptr_inband_t);
@@ -1083,9 +1085,9 @@ boolean_t ds_read_done(ior)
* Zero memory that the device did not fill.
*/
if (start_sent < start_data)
- bzero((char *)start_sent, start_data - start_sent);
+ memset((char *)start_sent, 0, start_data - start_sent);
if (end_sent > end_data)
- bzero((char *)end_data, end_sent - end_data);
+ memset((char *)end_data, 0, end_sent - end_data);
/*
diff --git a/device/kmsg.c b/device/kmsg.c
index 96f7d70..d1612ad 100644
--- a/device/kmsg.c
+++ b/device/kmsg.c
@@ -19,6 +19,8 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
/* Now kmsg provides stream interface, not random access methods. */
#include <sys/types.h>
+#include <string.h>
+
#include <device/conf.h>
#include <device/io_req.h>
#include <mach/boolean.h>
diff --git a/device/net_io.c b/device/net_io.c
index 25c75ae..6a08235 100644
--- a/device/net_io.c
+++ b/device/net_io.c
@@ -39,6 +39,8 @@
*/
#include <sys/types.h>
+#include <string.h>
+
#include <device/net_status.h>
#include <machine/machspl.h> /* spl definitions */
#include <device/net_io.h>
@@ -805,13 +807,13 @@ net_filter(kmsg, send_list)
break;
}
- bcopy(
- net_kmsg(kmsg)->packet,
+ memcpy(
net_kmsg(new_kmsg)->packet,
+ net_kmsg(kmsg)->packet,
ret_count);
- bcopy(
- net_kmsg(kmsg)->header,
+ memcpy(
net_kmsg(new_kmsg)->header,
+ net_kmsg(kmsg)->header,
NET_HDW_HDR_MAX);
}
net_kmsg(new_kmsg)->net_rcv_msg_packet_count = ret_count;
@@ -1297,8 +1299,7 @@ net_set_filter(ifp, rcv_port, priority, filter, filter_count)
my_infp->rcv_count = 0;
/* Copy filter program. */
- bcopy ((vm_offset_t)filter, (vm_offset_t)my_infp->filter,
- filter_bytes);
+ memcpy (my_infp->filter, filter, filter_bytes);
my_infp->filter_end =
(filter_t *)((char *)my_infp->filter + filter_bytes);
@@ -1410,12 +1411,10 @@ printf ("net_getstat: count: %d, addr_int_count: %d\n",
return (D_INVALID_OPERATION);
}
- bcopy((char *)ifp->if_address,
- (char *)status,
- (unsigned) addr_byte_count);
+ memcpy(status, ifp->if_address, addr_byte_count);
if (addr_byte_count < addr_int_count * sizeof(int))
- bzero((char *)status + addr_byte_count,
- (unsigned) (addr_int_count * sizeof(int)
+ memset((char *)status + addr_byte_count, 0,
+ (addr_int_count * sizeof(int)
- addr_byte_count));
for (i = 0; i < addr_int_count; i++) {
diff --git a/i386/i386/fpu.c b/i386/i386/fpu.c
index 9a82d01..350d172 100644
--- a/i386/i386/fpu.c
+++ b/i386/i386/fpu.c
@@ -27,6 +27,8 @@
* Support for 80387 floating point or FP emulator.
*/
+#include <string.h>
+
#include <mach/exception.h>
#include <mach/machine/thread_status.h>
#include <mach/machine/fp_reg.h>
@@ -262,7 +264,7 @@ ASSERT_IPL(SPL0);
/*
* Ensure that reserved parts of the environment are 0.
*/
- bzero((char *)&ifps->fp_save_state, sizeof(struct i386_fp_save));
+ memset(&ifps->fp_save_state, 0, sizeof(struct i386_fp_save));
ifps->fp_save_state.fp_control = user_fp_state->fp_control;
ifps->fp_save_state.fp_status = user_fp_state->fp_status;
@@ -290,13 +292,13 @@ ASSERT_IPL(SPL0);
>> FPS_TOS_SHIFT; /* physical register
for st(0) */
if (i == 0)
- bcopy(src, dst, 8 * 10);
+ memcpy(dst, src, 8 * 10);
else {
- bcopy(src,
- dst + 10 * i,
+ memcpy(dst + 10 * i,
+ src,
10 * (8 - i));
- bcopy(src + 10 * (8 - i),
- dst,
+ memcpy(dst,
+ src + 10 * (8 - i),
10 * i);
}
}
@@ -339,7 +341,7 @@ ASSERT_IPL(SPL0);
* No valid floating-point state.
*/
simple_unlock(&pcb->lock);
- bzero((char *)state, sizeof(struct i386_float_state));
+ memset(state, 0, sizeof(struct i386_float_state));
return KERN_SUCCESS;
}
@@ -372,7 +374,7 @@ ASSERT_IPL(SPL0);
/*
* Ensure that reserved parts of the environment are 0.
*/
- bzero((char *)user_fp_state, sizeof(struct i386_fp_save));
+ memset(user_fp_state, 0, sizeof(struct i386_fp_save));
user_fp_state->fp_control = ifps->fp_save_state.fp_control;
user_fp_state->fp_status = ifps->fp_save_state.fp_status;
@@ -400,13 +402,13 @@ ASSERT_IPL(SPL0);
>> FPS_TOS_SHIFT; /* physical register
for st(0) */
if (i == 0)
- bcopy(src, dst, 8 * 10);
+ memcpy(dst, src, 8 * 10);
else {
- bcopy(src + 10 * i,
- dst,
+ memcpy(dst,
+ src + 10 * i,
10 * (8 - i));
- bcopy(src,
- dst + 10 * (8 - i),
+ memcpy(dst + 10 * (8 - i),
+ src,
10 * i);
}
}
@@ -635,7 +637,7 @@ ASSERT_IPL(SPL0);
ifps = pcb->ims.ifps;
if (ifps == 0) {
ifps = (struct i386_fpsave_state *) zalloc(ifps_zone);
- bzero(ifps, sizeof *ifps);
+ memset(ifps, 0, sizeof *ifps);
pcb->ims.ifps = ifps;
fpinit();
#if 1
@@ -681,7 +683,7 @@ fp_state_alloc()
struct i386_fpsave_state *ifps;
ifps = (struct i386_fpsave_state *)zalloc(ifps_zone);
- bzero(ifps, sizeof *ifps);
+ memset(ifps, 0, sizeof *ifps);
pcb->ims.ifps = ifps;
ifps->fp_valid = TRUE;
diff --git a/i386/i386/iopb.c b/i386/i386/iopb.c
index 97e10c9..f1e859a 100644
--- a/i386/i386/iopb.c
+++ b/i386/i386/iopb.c
@@ -27,6 +27,8 @@
* Code to manipulate IO permission bitmaps.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/kern_return.h>
@@ -246,7 +248,7 @@ io_tss_init(
vm_offset_t addr = kvtolin (io_tss);
vm_size_t limit = (char *)&io_tss->barrier - (char *)io_tss;
- bzero(&io_tss->tss, sizeof(struct i386_tss));
+ memset(&io_tss->tss, 0, sizeof(struct i386_tss));
io_tss->tss.io_bit_map_offset
= (char *)&io_tss->bitmap - (char *)io_tss;
io_tss->tss.ss0 = KERNEL_DS;
@@ -560,7 +562,7 @@ i386_io_port_list(thread, list, list_count)
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((void *)addr, (void *)new_addr, size_needed);
+ memcpy((void *)new_addr, (void *)addr, size_needed);
kfree(addr, size);
devices = (mach_device_t *)new_addr;
}
diff --git a/i386/i386/mp_desc.c b/i386/i386/mp_desc.c
index 3a549a8..f5b07ab 100644
--- a/i386/i386/mp_desc.c
+++ b/i386/i386/mp_desc.c
@@ -26,6 +26,8 @@
#if NCPUS > 1
+#include <string.h>
+
#include <kern/cpu_number.h>
#include <mach/machine.h>
#include <vm/vm_kern.h>
@@ -127,16 +129,16 @@ mp_desc_init(mycpu)
/*
* Copy the tables
*/
- bcopy((char *)idt,
- (char *)mpt->idt,
+ memcpy(mpt->idt,
+ idt,
sizeof(idt));
- bcopy((char *)gdt,
- (char *)mpt->gdt,
+ memcpy(mpt->gdt,
+ gdt,
sizeof(gdt));
- bcopy((char *)ldt,
- (char *)mpt->ldt,
+ memcpy(mpt->ldt,
+ ldt,
sizeof(ldt));
- bzero((char *)&mpt->ktss,
+ memset(&mpt->ktss, 0,
sizeof(struct i386_tss));
/*
diff --git a/i386/i386/pcb.c b/i386/i386/pcb.c
index 5187a8b..9665caa 100644
--- a/i386/i386/pcb.c
+++ b/i386/i386/pcb.c
@@ -24,6 +24,8 @@
* the rights to redistribute these changes.
*/
+#include <string.h>
+
#include <mach/std_types.h>
#include <mach/kern_return.h>
#include <mach/thread_status.h>
@@ -324,7 +326,7 @@ void pcb_init(thread)
/*
* We can't let random values leak out to the user.
*/
- bzero((char *) pcb, sizeof *pcb);
+ memset(pcb, 0, sizeof *pcb);
simple_lock_init(&pcb->lock);
/*
@@ -523,9 +525,9 @@ kern_return_t thread_setstatus(thread, flavor, tstate, count)
thread->pcb->ims.io_tss = tss;
}
- bcopy((char *) state->pm,
- (char *) tss->bitmap,
- sizeof state->pm);
+ memcpy(tss->bitmap,
+ state->pm,
+ sizeof state->pm);
#endif
break;
}
@@ -684,9 +686,9 @@ kern_return_t thread_getstatus(thread, flavor, tstate, count)
* The thread has its own ktss.
*/
- bcopy((char *) tss->bitmap,
- (char *) state->pm,
- sizeof state->pm);
+ memcpy(state->pm,
+ tss->bitmap,
+ sizeof state->pm);
}
*count = i386_ISA_PORT_MAP_STATE_COUNT;
diff --git a/i386/i386/phys.c b/i386/i386/phys.c
index 518812d..0b25c68 100644
--- a/i386/i386/phys.c
+++ b/i386/i386/phys.c
@@ -23,7 +23,9 @@
* any improvements or extensions that they make and grant Carnegie Mellon
* the rights to redistribute these changes.
*/
-
+
+#include <string.h>
+
#include <mach/boolean.h>
#include <kern/task.h>
#include <kern/thread.h>
@@ -43,7 +45,7 @@ pmap_zero_page(p)
vm_offset_t p;
{
assert(p != vm_page_fictitious_addr);
- bzero(phystokv(p), PAGE_SIZE);
+ memset((void *)phystokv(p), 0, PAGE_SIZE);
}
/*
@@ -55,7 +57,7 @@ pmap_copy_page(src, dst)
assert(src != vm_page_fictitious_addr);
assert(dst != vm_page_fictitious_addr);
- bcopy(phystokv(src), phystokv(dst), PAGE_SIZE);
+ memcpy((void *)phystokv(dst), (void *)phystokv(src), PAGE_SIZE);
}
/*
@@ -68,7 +70,7 @@ copy_to_phys(src_addr_v, dst_addr_p, count)
int count;
{
assert(dst_addr_p != vm_page_fictitious_addr);
- bcopy(src_addr_v, phystokv(dst_addr_p), count);
+ memcpy((void *)phystokv(dst_addr_p), (void *)src_addr_v, count);
}
/*
@@ -82,7 +84,7 @@ copy_from_phys(src_addr_p, dst_addr_v, count)
int count;
{
assert(src_addr_p != vm_page_fictitious_addr);
- bcopy(phystokv(src_addr_p), dst_addr_v, count);
+ memcpy((void *)dst_addr_v, (void *)phystokv(src_addr_p), count);
}
/*
diff --git a/i386/i386/trap.c b/i386/i386/trap.c
index 4c09ee0..d57ce17 100644
--- a/i386/i386/trap.c
+++ b/i386/i386/trap.c
@@ -28,6 +28,8 @@
*/
#include <sys/types.h>
+#include <string.h>
+
#include <mach/machine/eflags.h>
#include <i386/trap.h>
#include <machine/machspl.h> /* for spl_t */
@@ -940,9 +942,9 @@ v86_assist(thread, regs)
#ifdef gcc_1_36_worked
int_vec = ((struct int_vec *)0)[vec];
#else
- bcopy((char *) (sizeof(struct int_vec) * vec),
- (char *)&int_vec,
- sizeof (struct int_vec));
+ memcpy(&int_vec,
+ (void *)(sizeof(struct int_vec) * vec),
+ sizeof (struct int_vec));
#endif
if (copyout((char *)&iret_16,
(char *)Addr8086(regs->ss,sp),
diff --git a/i386/i386/user_ldt.c b/i386/i386/user_ldt.c
index d259ea3..33724ec 100644
--- a/i386/i386/user_ldt.c
+++ b/i386/i386/user_ldt.c
@@ -28,6 +28,8 @@
* Each thread in a task may have its own LDT.
*/
+#include <string.h>
+
#include <kern/kalloc.h>
#include <kern/thread.h>
@@ -221,9 +223,9 @@ i386_set_ldt(thread, first_selector, desc_list, count, desc_list_inline)
* from old to new. Otherwise copy the default ldt.
*/
if (old_ldt) {
- bcopy((char *)&old_ldt->ldt[0],
- (char *)&new_ldt->ldt[0],
- old_ldt->desc.limit_low + 1);
+ memcpy(&new_ldt->ldt[0],
+ &old_ldt->ldt[0],
+ old_ldt->desc.limit_low + 1);
}
else {
struct real_descriptor template = {0, 0, 0, ACC_P, 0, 0 ,0};
@@ -253,9 +255,9 @@ i386_set_ldt(thread, first_selector, desc_list, count, desc_list_inline)
/*
* Install new descriptors.
*/
- bcopy((char *)desc_list,
- (char *)&old_ldt->ldt[first_desc],
- count * sizeof(struct real_descriptor));
+ memcpy(&old_ldt->ldt[first_desc],
+ desc_list,
+ count * sizeof(struct real_descriptor));
simple_unlock(&pcb->lock);
@@ -355,9 +357,9 @@ i386_get_ldt(thread, first_selector, selector_count, desc_list, count)
/*
* copy out the descriptors
*/
- bcopy((char *)&user_ldt->ldt[first_desc],
- (char *)*desc_list,
- ldt_size);
+ memcpy(*desc_list,
+ &user_ldt->ldt[first_desc],
+ ldt_size);
*count = ldt_count;
simple_unlock(&pcb->lock);
@@ -378,7 +380,7 @@ i386_get_ldt(thread, first_selector, selector_count, desc_list, count)
*/
size_left = size_used - ldt_size;
if (size_left > 0)
- bzero((char *)addr + ldt_size, size_left);
+ memset((char *)addr + ldt_size, 0, size_left);
/*
* Make memory into copyin form - this unwires it.
diff --git a/i386/i386at/immc.c b/i386/i386at/immc.c
index a59209e..e457162 100644
--- a/i386/i386at/immc.c
+++ b/i386/i386at/immc.c
@@ -23,6 +23,8 @@
#ifdef ENABLE_IMMEDIATE_CONSOLE
+#include <string.h>
+
/* This is a special "feature" (read: kludge)
intended for use only for kernel debugging.
It enables an extremely simple console output mechanism
@@ -47,8 +49,8 @@ immc_cnputc(unsigned char c)
}
else if (c == '\n')
{
- bcopy(0xb8000+80*2, 0xb8000, 80*2*24);
- bzero(0xb8000+80*2*24, 80*2);
+ memcpy(0xb8000, 0xb8000+80*2, 80*2*24);
+ memset(0xb8000+80*2*24, 0, 80*2);
ofs = 0;
}
else
diff --git a/i386/i386at/kd_event.c b/i386/i386at/kd_event.c
index 961d1b2..dbd1cbd 100644
--- a/i386/i386at/kd_event.c
+++ b/i386/i386at/kd_event.c
@@ -56,6 +56,8 @@ WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <mach/boolean.h>
#include <sys/types.h>
+#include <string.h>
+
#ifdef MACH_KERNEL
#include <device/errno.h>
#include <device/io_req.h>
@@ -532,7 +534,7 @@ X_kdb_enter_init(data, count)
if (count * sizeof X_kdb_enter_str[0] > sizeof X_kdb_enter_str)
return D_INVALID_OPERATION;
- bcopy(data, X_kdb_enter_str, count * sizeof X_kdb_enter_str[0]);
+ memcpy(X_kdb_enter_str, data, count * sizeof X_kdb_enter_str[0]);
X_kdb_enter_len = count;
return D_SUCCESS;
}
@@ -545,7 +547,7 @@ X_kdb_exit_init(data, count)
if (count * sizeof X_kdb_exit_str[0] > sizeof X_kdb_exit_str)
return D_INVALID_OPERATION;
- bcopy(data, X_kdb_exit_str, count * sizeof X_kdb_exit_str[0]);
+ memcpy(X_kdb_exit_str, data, count * sizeof X_kdb_exit_str[0]);
X_kdb_exit_len = count;
return D_SUCCESS;
}
diff --git a/i386/intel/pmap.c b/i386/intel/pmap.c
index 688406c..6827519 100644
--- a/i386/intel/pmap.c
+++ b/i386/intel/pmap.c
@@ -55,6 +55,8 @@
* and to when physical maps must be made correct.
*/
+#include <string.h>
+
#include <mach/machine/vm_types.h>
#include <mach/boolean.h>
@@ -715,7 +717,7 @@ void pmap_init()
s = round_page(s);
if (kmem_alloc_wired(kernel_map, &addr, s) != KERN_SUCCESS)
panic("pmap_init");
- bzero((char *) addr, s);
+ memset((char *) addr, 0, s);
/*
* Allocate the structures first to preserve word-alignment.
@@ -829,7 +831,7 @@ pmap_page_table_page_alloc()
/*
* Zero the page.
*/
- bzero(phystokv(pa), PAGE_SIZE);
+ memset((void *)phystokv(pa), 0, PAGE_SIZE);
return pa;
}
@@ -894,7 +896,7 @@ pmap_t pmap_create(size)
!= KERN_SUCCESS)
panic("pmap_create");
- bcopy(kernel_page_dir, p->dirbase, INTEL_PGBYTES);
+ memcpy(p->dirbase, kernel_page_dir, INTEL_PGBYTES);
p->ref_count = 1;
simple_lock_init(&p->lock);
diff --git a/include/mach/mig_support.h b/include/mach/mig_support.h
index e19de97..865bdc5 100644
--- a/include/mach/mig_support.h
+++ b/include/mach/mig_support.h
@@ -32,19 +32,11 @@
#ifndef _MACH_MIG_SUPPORT_H_
#define _MACH_MIG_SUPPORT_H_
+#include <string.h>
+
#include <mach/message.h>
#include <mach/mach_types.h>
-#if defined(MACH_KERNEL)
-
-#if defined(bcopy)
-#else /* not defined(bcopy) */
-extern void bcopy(const void *, void *, vm_size_t);
-#define memcpy(_dst,_src,_len) bcopy((_src),(_dst),(_len))
-#endif /* defined(bcopy) */
-
-#endif /* defined(MACH_KERNEL) */
-
extern void mig_init(void *_first);
extern void mig_allocate(vm_address_t *_addr_p, vm_size_t _size);
diff --git a/include/string.h b/include/string.h
new file mode 100644
index 0000000..0db1060
--- /dev/null
+++ b/include/string.h
@@ -0,0 +1,33 @@
+/*
+ * String Handling Functions.
+ * Copyright (C) 2006 Barry deFreese.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+/*
+ * String handling functions.
+ *
+ */
+
+#ifndef _MACH_SA_SYS_STRING_H_
+#define _MACH_SA_SYS_STRING_H_
+
+#include <sys/types.h>
+
+extern void *memcpy (void *dest, const void *src, size_t n);
+
+extern void *memset (void *s, int c, size_t n);
+
+#endif /* _MACH_SA_SYS_STRING_H_ */
diff --git a/ipc/ipc_entry.c b/ipc/ipc_entry.c
index 523f070..85404b6 100644
--- a/ipc/ipc_entry.c
+++ b/ipc/ipc_entry.c
@@ -34,6 +34,8 @@
* Primitive functions to manipulate translation entries.
*/
+#include <string.h>
+
#include <mach/kern_return.h>
#include <mach/port.h>
#include <kern/assert.h>
@@ -635,7 +637,7 @@ ipc_entry_grow_table(space)
*/
if (!it_entries_reallocable(oits))
- (void) memcpy((void *) table, (const void *) otable,
+ memcpy(table, otable,
osize * sizeof(struct ipc_entry));
for (i = 0; i < osize; i++)
diff --git a/ipc/ipc_kmsg.c b/ipc/ipc_kmsg.c
index 12bd0c7..100cc93 100644
--- a/ipc/ipc_kmsg.c
+++ b/ipc/ipc_kmsg.c
@@ -34,6 +34,8 @@
* Operations on kernel messages.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/message.h>
@@ -558,7 +560,7 @@ ipc_kmsg_get_from_kernel(msg, size, kmsgp)
return MACH_SEND_NO_BUFFER;
ikm_init(kmsg, size);
- bcopy((char *) msg, (char *) &kmsg->ikm_header, size);
+ memcpy(&kmsg->ikm_header, msg, size);
kmsg->ikm_header.msgh_size = size;
*kmsgp = kmsg;
@@ -623,7 +625,7 @@ ipc_kmsg_put_to_kernel(
assert(!KMSG_IN_DIPC(kmsg));
#endif /* DIPC */
- (void) memcpy((void *) msg, (const void *) &kmsg->ikm_header, size);
+ memcpy(msg, &kmsg->ikm_header, size);
ikm_free(kmsg);
}
diff --git a/ipc/ipc_object.c b/ipc/ipc_object.c
index e0cbbc3..713a581 100644
--- a/ipc/ipc_object.c
+++ b/ipc/ipc_object.c
@@ -31,6 +31,8 @@
* Functions to manipulate IPC objects.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/port.h>
@@ -239,11 +241,11 @@ ipc_object_alloc(
if (otype == IOT_PORT) {
ipc_port_t port = (ipc_port_t)object;
- bzero((char *)port, sizeof(*port));
+ memset(port, 0, sizeof(*port));
} else if (otype == IOT_PORT_SET) {
ipc_pset_t pset = (ipc_pset_t)object;
- bzero((char *)pset, sizeof(*pset));
+ memset(pset, 0, sizeof(*pset));
}
kr = ipc_entry_alloc(space, namep, &entry);
if (kr != KERN_SUCCESS) {
@@ -305,11 +307,11 @@ ipc_object_alloc_name(
if (otype == IOT_PORT) {
ipc_port_t port = (ipc_port_t)object;
- bzero((char *)port, sizeof(*port));
+ memset(port, 0, sizeof(*port));
} else if (otype == IOT_PORT_SET) {
ipc_pset_t pset = (ipc_pset_t)object;
- bzero((char *)pset, sizeof(*pset));
+ memset(pset, 0, sizeof(*pset));
}
kr = ipc_entry_alloc_name(space, name, &entry);
diff --git a/ipc/ipc_port.c b/ipc/ipc_port.c
index aaba82d..a23375c 100644
--- a/ipc/ipc_port.c
+++ b/ipc/ipc_port.c
@@ -34,6 +34,8 @@
* Functions to manipulate IPC ports.
*/
+#include <string.h>
+
#include <mach/port.h>
#include <mach/kern_return.h>
#include <kern/lock.h>
@@ -182,7 +184,7 @@ ipc_port_dngrow(port)
osize = oits->its_size;
free = otable->ipr_next;
- bcopy((char *)(otable + 1), (char *)(ntable + 1),
+ memcpy((ntable + 1), (otable + 1),
(osize - 1) * sizeof(struct ipc_port_request));
} else {
osize = 1;
diff --git a/ipc/ipc_space.c b/ipc/ipc_space.c
index e3817f5..444f400 100644
--- a/ipc/ipc_space.c
+++ b/ipc/ipc_space.c
@@ -36,6 +36,8 @@
* Functions to manipulate IPC capability spaces.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/kern_return.h>
#include <mach/port.h>
diff --git a/ipc/mach_debug.c b/ipc/mach_debug.c
index 04d0c74..acb9f97 100644
--- a/ipc/mach_debug.c
+++ b/ipc/mach_debug.c
@@ -33,6 +33,8 @@
* Exported kernel calls. See mach_debug/mach_debug.defs.
*/
+#include <string.h>
+
#include <mach/kern_return.h>
#include <mach/port.h>
#include <mach/machine/vm_types.h>
@@ -453,7 +455,7 @@ mach_port_space_info(
table_size - rsize_used);
if (size_used != rsize_used)
- bzero((char *) (table_addr + size_used),
+ memset((char *) (table_addr + size_used), 0,
rsize_used - size_used);
kr = vm_map_copyin(ipc_kernel_map, table_addr, rsize_used,
@@ -488,7 +490,7 @@ mach_port_space_info(
tree_size - rsize_used);
if (size_used != rsize_used)
- bzero((char *) (tree_addr + size_used),
+ memset((char *) (tree_addr + size_used), 0,
rsize_used - size_used);
kr = vm_map_copyin(ipc_kernel_map, tree_addr, rsize_used,
diff --git a/kern/act.c b/kern/act.c
index 0d0baea..a7a8ac9 100644
--- a/kern/act.c
+++ b/kern/act.c
@@ -26,6 +26,8 @@
#ifdef MIGRATING_THREADS
+#include <string.h>
+
#include <mach_ipc_compat.h> /* XXX */
#include <mach/kern_return.h>
#include <mach/alert.h>
@@ -113,7 +115,7 @@ kern_return_t act_create(task_t task, vm_offset_t user_stack,
/* XXX ipt_unlock(act_freelist); */
act->ipt_next = 0;
#endif
- bzero(act, sizeof(*act)); /*XXX shouldn't be needed */
+ memset(act, 0, sizeof(*act)); /*XXX shouldn't be needed */
#ifdef DEBUG
act->lower = act->higher = 0;
diff --git a/kern/boot_script.c b/kern/boot_script.c
index d031752..9349126 100644
--- a/kern/boot_script.c
+++ b/kern/boot_script.c
@@ -3,9 +3,7 @@
/* Written by Shantanu Goel (goel@cs.columbia.edu). */
#include <mach/mach_types.h>
-#if !KERNEL || OSKIT_MACH
#include <string.h>
-#endif
#include "boot_script.h"
diff --git a/kern/bootstrap.c b/kern/bootstrap.c
index 19e25ea..3613e38 100644
--- a/kern/bootstrap.c
+++ b/kern/bootstrap.c
@@ -30,6 +30,9 @@
* Bootstrap the various built-in servers.
*/
+#include <alloca.h>
+#include <string.h>
+
#include <mach/port.h>
#include <mach/message.h>
#include <machine/vm_param.h>
@@ -40,7 +43,6 @@
#include <kern/lock.h>
#include <vm/vm_kern.h>
#include <device/device_port.h>
-#include <alloca.h>
#if MACH_KDB
#include <machine/db_machdep.h>
@@ -49,7 +51,6 @@
#if OSKIT_MACH
#include <stddef.h>
-#include <string.h>
#include <oskit/machine/base_multiboot.h>
#include <oskit/exec/exec.h>
#include <oskit/c/stdio.h>
diff --git a/kern/eventcount.c b/kern/eventcount.c
index 1418c82..b562f1a 100644
--- a/kern/eventcount.c
+++ b/kern/eventcount.c
@@ -35,6 +35,8 @@
*
*/
+#include <string.h>
+
#include <mach/machine.h>
#include <kern/ast.h>
#include "cpu_number.h"
@@ -67,7 +69,7 @@ evc_init(evc_t ev)
{
int i;
- bzero((char*)ev, sizeof(*ev));
+ memset(ev, 0, sizeof(*ev));
/* keep track of who is who */
for (i = 0; i < MAX_EVCS; i++)
diff --git a/kern/host.c b/kern/host.c
index a757266..6e98c2c 100644
--- a/kern/host.c
+++ b/kern/host.c
@@ -29,6 +29,8 @@
* Non-ipc host functions.
*/
+#include <string.h>
+
#include <kern/assert.h>
#include <kern/kalloc.h>
#include <kern/host.h>
@@ -182,12 +184,12 @@ kern_return_t host_info(
load_info = (host_load_info_t) info;
- bcopy((char *) avenrun,
- (char *) load_info->avenrun,
- sizeof avenrun);
- bcopy((char *) mach_factor,
- (char *) load_info->mach_factor,
- sizeof mach_factor);
+ memcpy(load_info->avenrun,
+ avenrun,
+ sizeof avenrun);
+ memcpy(load_info->mach_factor,
+ mach_factor,
+ sizeof mach_factor);
*count = HOST_LOAD_INFO_COUNT;
return KERN_SUCCESS;
@@ -302,7 +304,7 @@ host_processor_sets(
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((char *) addr, (char *) newaddr, size_needed);
+ memcpy((char *) newaddr, (char *) addr, size_needed);
kfree(addr, size);
psets = (processor_set_t *) newaddr;
}
diff --git a/kern/lock.c b/kern/lock.c
index 15bc988..ba0f0c2 100644
--- a/kern/lock.c
+++ b/kern/lock.c
@@ -34,6 +34,8 @@
* Locking primitives implementation
*/
+#include <string.h>
+
#include <kern/lock.h>
#include <kern/thread.h>
#include <kern/sched_prim.h>
@@ -219,7 +221,7 @@ void lock_init(
lock_t l,
boolean_t can_sleep)
{
- bzero((char *)l, sizeof(lock_data_t));
+ memset(l, 0, sizeof(lock_data_t));
simple_lock_init(&l->interlock);
l->want_write = FALSE;
l->want_upgrade = FALSE;
diff --git a/kern/lock_mon.c b/kern/lock_mon.c
index 1d92ebf..a9a3989 100644
--- a/kern/lock_mon.c
+++ b/kern/lock_mon.c
@@ -39,6 +39,8 @@
*/
#include <sys/types.h>
+#include <string.h>
+
#include <mach/machine/vm_types.h>
#include <mach/boolean.h>
#include <kern/thread.h>
@@ -263,10 +265,10 @@ lock_info_clear()
for (bucket = 0; bucket < LOCK_INFO_HASH_COUNT; bucket++) {
li = &lock_info[bucket].info[0];
for (i= 0; i< LOCK_INFO_PER_BUCKET; i++, li++) {
- bzero(li, sizeof(struct lock_info));
+ memset(li, 0, sizeof(struct lock_info));
}
}
- bzero(&default_lock_info, sizeof(struct lock_info));
+ memset(&default_lock_info, 0, sizeof(struct lock_info));
}
print_lock_info(li)
diff --git a/kern/mach_clock.c b/kern/mach_clock.c
index 71cd583..d67897b 100644
--- a/kern/mach_clock.c
+++ b/kern/mach_clock.c
@@ -34,6 +34,8 @@
* Clock primitives.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/machine.h>
#include <mach/time_value.h>
@@ -491,7 +493,7 @@ void mapable_time_init()
if (kmem_alloc_wired(kernel_map, (vm_offset_t *) &mtime, PAGE_SIZE)
!= KERN_SUCCESS)
panic("mapable_time_init");
- bzero((char *)mtime, PAGE_SIZE);
+ memset(mtime, 0, PAGE_SIZE);
update_mapped_time(&time);
}
diff --git a/kern/pc_sample.c b/kern/pc_sample.c
index 87c7a6c..b414941 100644
--- a/kern/pc_sample.c
+++ b/kern/pc_sample.c
@@ -24,6 +24,8 @@
* the rights to redistribute these changes.
*/
+#include <string.h>
+
#include <mach/mach_types.h> /* vm_address_t */
#include <mach/std_types.h> /* pointer_t */
#include <mach/pc_sample.h>
@@ -174,19 +176,19 @@ get_sampled_pcs(
* Simple case: no wraparound.
* Copy from seqidx1 to seqidx2.
*/
- bcopy((sampled_pc_array_t)cp->buffer + seqidx1 + 1,
- sampled_pcs_out,
- nsamples * sizeof(sampled_pc_t));
+ memcpy(sampled_pcs_out,
+ (sampled_pc_array_t)cp->buffer + seqidx1 + 1,
+ nsamples * sizeof(sampled_pc_t));
} else {
/* seqidx1 > seqidx2 -- Handle wraparound. */
- bcopy((sampled_pc_array_t)cp->buffer + seqidx1 + 1,
- sampled_pcs_out,
- (MAX_PC_SAMPLES - seqidx1 - 1) * sizeof(sampled_pc_t));
+ memcpy(sampled_pcs_out,
+ (sampled_pc_array_t)cp->buffer + seqidx1 + 1,
+ (MAX_PC_SAMPLES - seqidx1 - 1) * sizeof(sampled_pc_t));
- bcopy((sampled_pc_array_t)cp->buffer,
- sampled_pcs_out + (MAX_PC_SAMPLES - seqidx1 - 1),
- (seqidx2 + 1) * sizeof(sampled_pc_t));
+ memcpy(sampled_pcs_out + (MAX_PC_SAMPLES - seqidx1 - 1),
+ (sampled_pc_array_t)cp->buffer,
+ (seqidx2 + 1) * sizeof(sampled_pc_t));
}
} else {
/* could either be zero because of overflow, or because
diff --git a/kern/processor.c b/kern/processor.c
index a6e65c8..df9cb2e 100644
--- a/kern/processor.c
+++ b/kern/processor.c
@@ -27,6 +27,8 @@
* processor.c: processor and processor_set manipulation routines.
*/
+#include <string.h>
+
#include <mach/boolean.h>
#include <mach/policy.h>
#include <mach/processor_info.h>
@@ -971,7 +973,7 @@ processor_set_things(
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((char *) addr, (char *) newaddr, size_needed);
+ memcpy((void *) newaddr, (void *) addr, size_needed);
kfree(addr, size);
addr = newaddr;
}
diff --git a/kern/syscall_emulation.c b/kern/syscall_emulation.c
index 5443a33..06781d5 100644
--- a/kern/syscall_emulation.c
+++ b/kern/syscall_emulation.c
@@ -24,6 +24,8 @@
* the rights to redistribute these changes.
*/
+#include <string.h>
+
#include <mach/error.h>
#include <mach/vm_param.h>
#include <kern/syscall_emulation.h>
@@ -198,9 +200,9 @@ task_set_emulation_vector_internal(task, vector_start, emulation_vector,
* Copy the entries to the new emulation vector,
* deallocate the current one, and use the new one.
*/
- bcopy((char *)&cur_eml->disp_vector[0],
- (char *)&new_eml->disp_vector[cur_start-new_start],
- cur_eml->disp_count * sizeof(vm_offset_t));
+ memcpy(&new_eml->disp_vector[cur_start-new_start],
+ &cur_eml->disp_vector[0],
+ cur_eml->disp_count * sizeof(vm_offset_t));
if (--cur_eml->ref_count == 0)
old_eml = cur_eml; /* discard old vector */
@@ -258,7 +260,7 @@ task_set_emulation_vector_internal(task, vector_start, emulation_vector,
new_size = count_to_size(new_end - new_start);
new_eml = (eml_dispatch_t) kalloc(new_size);
- bzero((char *)new_eml, new_size);
+ memset(new_eml, 0, new_size);
simple_lock_init(&new_eml->lock);
new_eml->ref_count = 1;
new_eml->disp_min = new_start;
@@ -271,9 +273,9 @@ task_set_emulation_vector_internal(task, vector_start, emulation_vector,
* We have the emulation vector.
* Install the new emulation entries.
*/
- bcopy((char *)&emulation_vector[0],
- (char *)&cur_eml->disp_vector[vector_start - cur_eml->disp_min],
- emulation_vector_count * sizeof(vm_offset_t));
+ memcpy(&cur_eml->disp_vector[vector_start - cur_eml->disp_min],
+ &emulation_vector[0],
+ emulation_vector_count * sizeof(vm_offset_t));
task_unlock(task);
@@ -417,9 +419,9 @@ task_get_emulation_vector(task, vector_start, emulation_vector,
*/
*vector_start = eml->disp_min;
*emulation_vector_count = eml->disp_count;
- bcopy((char *)eml->disp_vector,
- (char *)addr,
- vector_size);
+ memcpy((void *)addr,
+ eml->disp_vector,
+ vector_size);
/*
* Unlock the task and free any memory we did not need
@@ -444,7 +446,7 @@ task_get_emulation_vector(task, vector_start, emulation_vector,
*/
size_left = size_used - vector_size;
if (size_left > 0)
- bzero((char *)addr + vector_size, size_left);
+ memset((char *)addr + vector_size, 0, size_left);
/*
* Make memory into copyin form - this unwires it.
@@ -495,8 +497,8 @@ xxx_task_get_emulation_vector(task, vector_start, emulation_vector,
*vector_start = eml->disp_min;
*emulation_vector_count = eml->disp_count;
- bcopy((char *)eml->disp_vector, (char *)emulation_vector,
- *emulation_vector_count * sizeof(vm_offset_t));
+ memcpy(emulation_vector, eml->disp_vector,
+ *emulation_vector_count * sizeof(vm_offset_t));
simple_unlock(&eml->lock);
task_unlock(task);
diff --git a/kern/task.c b/kern/task.c
index c7633c1..f620bdf 100644
--- a/kern/task.c
+++ b/kern/task.c
@@ -31,6 +31,8 @@
* Task management primitives implementation.
*/
+#include <string.h>
+
#include <mach/machine/vm_types.h>
#include <mach/vm_param.h>
#include <mach/task_info.h>
@@ -625,7 +627,7 @@ kern_return_t task_threads(
return KERN_RESOURCE_SHORTAGE;
}
- bcopy((char *) addr, (char *) newaddr, size_needed);
+ memcpy((void *) newaddr, (void *) addr, size_needed);
kfree(addr, size);
threads = (thread_t *) newaddr;
}
diff --git a/kern/xpr.c b/kern/xpr.c
index e3e5377..b5f6e71 100644
--- a/kern/xpr.c
+++ b/kern/xpr.c
@@ -27,6 +27,8 @@
/*
* xpr silent tracing circular buffer.
*/
+#include <string.h>
+
#include <kern/xpr.h>
#include <kern/lock.h>
#include "cpu_number.h"
@@ -112,7 +114,7 @@ void xprbootstrap()
* the previous buffer contents.
*/
- bzero((char *) addr, size);
+ memset((char *) addr, 0, size);
}
xprbase = (struct xprbuf *) addr;
diff --git a/kern/zalloc.c b/kern/zalloc.c
index 18239be..48fbb32 100644
--- a/kern/zalloc.c
+++ b/kern/zalloc.c
@@ -34,6 +34,8 @@
* data blocks for which quick allocation/deallocation is possible.
*/
+#include <string.h>
+
#include <kern/macro_help.h>
#include <kern/sched.h>
#include <kern/time_out.h>
@@ -942,7 +944,7 @@ kern_return_t host_zone_info(host, namesp, namesCntp, infop, infoCntp)
used = max_zones * sizeof *names;
if (used != names_size)
- bzero((char *) (names_addr + used), names_size - used);
+ memset((char *) (names_addr + used), 0, names_size - used);
kr = vm_map_copyin(ipc_kernel_map, names_addr, names_size,
TRUE, &copy);
@@ -959,7 +961,7 @@ kern_return_t host_zone_info(host, namesp, namesCntp, infop, infoCntp)
used = max_zones * sizeof *info;
if (used != info_size)
- bzero((char *) (info_addr + used), info_size - used);
+ memset((char *) (info_addr + used), 0, info_size - used);
kr = vm_map_copyin(ipc_kernel_map, info_addr, info_size,
TRUE, &copy);
diff --git a/vm/vm_debug.c b/vm/vm_debug.c
index a6e9347..29ec8da 100644
--- a/vm/vm_debug.c
+++ b/vm/vm_debug.c
@@ -33,6 +33,8 @@
#if MACH_VM_DEBUG
+#include <string.h>
+
#include <kern/thread.h>
#include <mach/kern_return.h>
#include <mach/machine/vm_types.h>
@@ -402,8 +404,8 @@ mach_vm_object_pages(object, pagesp, countp)
addr + rsize_used, size - rsize_used);
if (size_used != rsize_used)
- bzero((char *) (addr + size_used),
- rsize_used - size_used);
+ memset((char *) (addr + size_used), 0,
+ rsize_used - size_used);
kr = vm_map_copyin(ipc_kernel_map, addr, rsize_used,
TRUE, &copy);
diff --git a/vm/vm_kern.c b/vm/vm_kern.c
index b83c058..ed81f0a 100644
--- a/vm/vm_kern.c
+++ b/vm/vm_kern.c
@@ -34,6 +34,8 @@
* Kernel memory management.
*/
+#include <string.h>
+
#include <mach/kern_return.h>
#include <machine/vm_param.h>
#include <kern/assert.h>
@@ -149,7 +151,7 @@ projected_buffer_allocate(map, size, persistence, kernel_p,
kmem_alloc_pages(object, 0,
*kernel_p, *kernel_p + size,
VM_PROT_READ | VM_PROT_WRITE);
- bzero(*kernel_p, size); /*Zero fill*/
+ memset((void*) *kernel_p, 0, size); /*Zero fill*/
/* Set up physical mappings for user pmap */
@@ -1035,7 +1037,7 @@ int copyinmap(map, fromaddr, toaddr, length)
{
if (vm_map_pmap(map) == kernel_pmap) {
/* assume a correct copy */
- bcopy(fromaddr, toaddr, length);
+ memcpy(toaddr, fromaddr, length);
return 0;
}
@@ -1061,7 +1063,7 @@ int copyoutmap(map, fromaddr, toaddr, length)
{
if (vm_map_pmap(map) == kernel_pmap) {
/* assume a correct copy */
- bcopy(fromaddr, toaddr, length);
+ memcpy(toaddr, fromaddr, length);
return 0;
}
diff --git a/vm/vm_object.c b/vm/vm_object.c
index e2a5f43..7d00fbe 100644
--- a/vm/vm_object.c
+++ b/vm/vm_object.c
@@ -33,6 +33,8 @@
* Virtual memory object module.
*/
+#include <string.h>
+
#include <mach/memory_object.h>
#include <vm/memory_object_default.user.h>
#include <vm/memory_object_user.user.h>
@@ -253,7 +255,7 @@ void vm_object_bootstrap(void)
*/
vm_object_template = (vm_object_t) zalloc(vm_object_zone);
- bzero((char *) vm_object_template, sizeof *vm_object_template);
+ memset(vm_object_template, 0, sizeof *vm_object_template);
vm_object_template->ref_count = 1;
vm_object_template->size = 0;
diff --git a/vm/vm_resident.c b/vm/vm_resident.c
index b939b1d..2c99ab5 100644
--- a/vm/vm_resident.c
+++ b/vm/vm_resident.c
@@ -33,6 +33,8 @@
* Resident memory management module.
*/
+#include <string.h>
+
#include <mach/vm_prot.h>
#include <kern/counters.h>
#include <kern/sched_prim.h>
@@ -959,7 +961,7 @@ vm_page_grab_contiguous_pages(
} else
alloc_size = 0;
- bzero(bits, size);
+ memset(bits, 0, size);
/*
* A very large granularity call, its rare so that is ok