 2bfeeed885
			
		
	
	
		2bfeeed885
		
	
	
	
	
		
			
			. all invocations were S or D, so can safely be dropped to prepare for the segmentless world . still assign D to the SCP_SEG field in the message to make previous kernels usable
		
			
				
	
	
		
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			55 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
 | |
| #include "syslib.h"
 | |
| 
 | |
| #include <minix/safecopies.h>
 | |
| 
 | |
| int sys_safecopyfrom(endpoint_t src_e,
 | |
| 	cp_grant_id_t gr_id, vir_bytes offset,
 | |
| 	vir_bytes address, size_t bytes)
 | |
| {
 | |
| /* Transfer a block of data for which the other process has previously
 | |
|  * given permission. 
 | |
|  */
 | |
| 
 | |
|   message copy_mess;
 | |
| 
 | |
|   copy_mess.SCP_FROM_TO = src_e;
 | |
|   copy_mess.SCP_GID = gr_id;
 | |
|   copy_mess.SCP_OFFSET = (long) offset;
 | |
|   copy_mess.SCP_ADDRESS = (char *) address;
 | |
|   copy_mess.SCP_BYTES = (long) bytes;
 | |
| 
 | |
|   /* for older kernels that still need the 'seg' field
 | |
|    * provide the right value.
 | |
|    */
 | |
|   copy_mess.SCP_SEG_OBSOLETE = D;
 | |
| 
 | |
|   return(_kernel_call(SYS_SAFECOPYFROM, ©_mess));
 | |
| 
 | |
| }
 | |
| 
 | |
| int sys_safecopyto(endpoint_t dst_e,
 | |
| 	cp_grant_id_t gr_id, vir_bytes offset,
 | |
| 	vir_bytes address, size_t bytes)
 | |
| {
 | |
| /* Transfer a block of data for which the other process has previously
 | |
|  * given permission. 
 | |
|  */
 | |
| 
 | |
|   message copy_mess;
 | |
| 
 | |
|   copy_mess.SCP_FROM_TO = dst_e;
 | |
|   copy_mess.SCP_GID = gr_id;
 | |
|   copy_mess.SCP_OFFSET = (long) offset;
 | |
|   copy_mess.SCP_ADDRESS = (char *) address;
 | |
|   copy_mess.SCP_BYTES = (long) bytes;
 | |
| 
 | |
|   /* for older kernels that still need the 'seg' field
 | |
|    * provide the right value.
 | |
|    */
 | |
|   copy_mess.SCP_SEG_OBSOLETE = D;
 | |
| 
 | |
|   return(_kernel_call(SYS_SAFECOPYTO, ©_mess));
 | |
| 
 | |
| }
 |