summaryrefslogtreecommitdiff
path: root/kern/syscall_emulation.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2006-11-05 18:54:52 +0000
committerThomas Schwinge <tschwinge@gnu.org>2009-06-18 00:26:50 +0200
commitffc607f8a4c1c6f1c63a7b61b54f185ada87a9a5 (patch)
tree35fb5835c103b647de4de4a53ba94e4b1b5cb563 /kern/syscall_emulation.c
parent7e8b31e61e4bd9207bde37662e757a5988c556df (diff)
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.
Diffstat (limited to 'kern/syscall_emulation.c')
-rw-r--r--kern/syscall_emulation.c28
1 files changed, 15 insertions, 13 deletions
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);