minix/kernel/system/do_memset.c
Ben Gras 769af57274 further libexec generalization
. new mode for sys_memset: include process so memset can be
	  done in physical or virtual address space.
	. add a mode to mmap() that lets a process allocate uninitialized
	  memory.
	. this allows an exec()er (RS, VFS, etc.) to request uninitialized
	  memory from VM and selectively clear the ranges that don't come
	  from a file, leaving no uninitialized memory left for the process
	  to see.
	. use callbacks for clearing the process, clearing memory in the
	  process, and copying into the process; so that the libexec code
	  can be used from rs, vfs, and in the future, kernel (to load vm)
	  and vm (to load boot-time processes)
2012-06-07 15:15:02 +02:00

27 lines
810 B
C

/* The kernel call implemented in this file:
* m_type: SYS_MEMSET
*
* The parameters for this kernel call are:
* m2_p1: MEM_PTR (virtual address)
* m2_l1: MEM_COUNT (returns physical address)
* m2_l2: MEM_PATTERN (pattern byte to be written)
*/
#include "kernel/system.h"
#if USE_MEMSET
/*===========================================================================*
* do_memset *
*===========================================================================*/
int do_memset(struct proc * caller, message * m_ptr)
{
/* Handle sys_memset(). This writes a pattern into the specified memory. */
unsigned char c = m_ptr->MEM_PATTERN;
vm_memset(m_ptr->MEM_PROCESS, (phys_bytes) m_ptr->MEM_PTR,
c, (phys_bytes) m_ptr->MEM_COUNT);
return(OK);
}
#endif /* USE_MEMSET */