minix/lib/syslib/sys_physcopy.c
Tomas Hruby 728f0f0c49 Removal of the system task
* Userspace change to use the new kernel calls

	- _taskcall(SYSTASK...) changed to _kernel_call(...)

	- int 32 reused for the kernel calls

	- _do_kernel_call() to make the trap to kernel

	- kernel_call() to make the actuall kernel call from C using
	  _do_kernel_call()

	- unlike ipc call the kernel call always succeeds as kernel is
	  always available, however, kernel may return an error

* Kernel side implementation of kernel calls

	- the SYSTEm task does not run, only the proc table entry is
	  preserved

	- every data_copy(SYSTEM is no data_copy(KERNEL

	- "locking" is an empty operation now as everything runs in
	  kernel

	- sys_task() is replaced by kernel_call() which copies the
	  message into kernel, dispatches the call to its handler and
	  finishes by either copying the results back to userspace (if
	  need be) or by suspending the process because of VM

	- suspended processes are later made runnable once the memory
	  issue is resolved, picked up by the scheduler and only at
	  this time the call is resumed (in fact restarted) which does
	  not need to copy the message from userspace as the message
	  is already saved in the process structure.

	- no ned for the vmrestart queue, the scheduler will restart
	  the system calls

	- no special case in do_vmctl(), all requests remove the
	  RTS_VMREQUEST flag
2010-02-09 15:20:09 +00:00

31 lines
1.1 KiB
C

#include "syslib.h"
PUBLIC int sys_physcopy(src_proc, src_seg, src_vir,
dst_proc, dst_seg, dst_vir, bytes)
endpoint_t src_proc; /* source process */
int src_seg; /* source memory segment */
vir_bytes src_vir; /* source virtual address */
endpoint_t dst_proc; /* destination process */
int dst_seg; /* destination memory segment */
vir_bytes dst_vir; /* destination virtual address */
phys_bytes bytes; /* how many bytes */
{
/* Transfer a block of data. The source and destination can each either be a
* process number or SELF (to indicate own process number). Virtual addresses
* are offsets within LOCAL_SEG (text, stack, data), REMOTE_SEG, or BIOS_SEG.
* Physicall addressing is also possible with PHYS_SEG.
*/
message copy_mess;
if (bytes == 0L) return(OK);
copy_mess.CP_SRC_ENDPT = src_proc;
copy_mess.CP_SRC_SPACE = src_seg;
copy_mess.CP_SRC_ADDR = (long) src_vir;
copy_mess.CP_DST_ENDPT = dst_proc;
copy_mess.CP_DST_SPACE = dst_seg;
copy_mess.CP_DST_ADDR = (long) dst_vir;
copy_mess.CP_NR_BYTES = (long) bytes;
return(_kernel_call(SYS_PHYSCOPY, &copy_mess));
}