 9df1183b94
			
		
	
	
		9df1183b94
		
	
	
	
	
		
			
			. added safecopies.c: these are library functions to maintain grant tables in own address space . sys_safecopy.c: interfaces to kernel calls to perform safe copy functions in from or to foreign process . changes in i/o fields (type merged with request) reflected in library functions (sys_out.c, sys_vinb.c, sys_vinl.c, sys_vinw.c, sys_voutb.c, sys_voutl.c, sys_voutw.c) . type merged with request in sys_sdevio, also now accepts offset which is used when a grant is specified (the _DIO_SAFE subtype) . system printf() function changed to send DIAGNOSTICS_S messages, which specify a grant id instead of a direct address for the buffer to be printed; tty and log can then safecopy the buffer
		
			
				
	
	
		
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			49 lines
		
	
	
		
			1.1 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
 | |
| #include "syslib.h"
 | |
| 
 | |
| #include <minix/safecopies.h>
 | |
| 
 | |
| PUBLIC int sys_safecopyfrom(endpoint_t src_e,
 | |
| 	cp_grant_id_t gr_id, vir_bytes offset,
 | |
| 	vir_bytes address, size_t bytes,
 | |
| 	int my_seg)
 | |
| {
 | |
| /* 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_INFO = SCP_MAKEINFO(my_seg);
 | |
|   copy_mess.SCP_GID = gr_id;
 | |
|   copy_mess.SCP_OFFSET = (long) offset;
 | |
|   copy_mess.SCP_ADDRESS = (char *) address;
 | |
|   copy_mess.SCP_BYTES = (long) bytes;
 | |
| 
 | |
|   return(_taskcall(SYSTASK, SYS_SAFECOPYFROM, ©_mess));
 | |
| 
 | |
| }
 | |
| 
 | |
| PUBLIC int sys_safecopyto(endpoint_t dst_e,
 | |
| 	cp_grant_id_t gr_id, vir_bytes offset,
 | |
| 	vir_bytes address, size_t bytes,
 | |
| 	int my_seg)
 | |
| {
 | |
| /* 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_INFO = SCP_MAKEINFO(my_seg);
 | |
|   copy_mess.SCP_GID = gr_id;
 | |
|   copy_mess.SCP_OFFSET = (long) offset;
 | |
|   copy_mess.SCP_ADDRESS = (char *) address;
 | |
|   copy_mess.SCP_BYTES = (long) bytes;
 | |
| 
 | |
|   return(_taskcall(SYSTASK, SYS_SAFECOPYTO, ©_mess));
 | |
| 
 | |
| }
 |