From: Lionel Sambuc Date: Wed, 21 May 2014 15:21:26 +0000 (+0200) Subject: Message type for SYS_{VIR,PHYS}COPY X-Git-Tag: v3.3.0~224 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/doc/syslog.3.html?a=commitdiff_plain;h=5735105bc891c18e435afa5dbaa31d9ec1c0ea40;p=minix.git Message type for SYS_{VIR,PHYS}COPY Change-Id: I15d1acf9992d1b799f5687adffb186875fcd0c84 --- diff --git a/include/minix/ipc.h b/include/minix/ipc.h index c5c823e85..5978b4eed 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -707,6 +707,18 @@ typedef struct { } mess_lsys_krn_sys_abort; _ASSERT_MSG_SIZE(mess_lsys_krn_sys_abort); +typedef struct { + endpoint_t src_endpt; + vir_bytes src_addr; + endpoint_t dst_endpt; + vir_bytes dst_addr; + phys_bytes nr_bytes; + int flags; + + uint8_t padding[32]; +} mess_lsys_krn_sys_copy; +_ASSERT_MSG_SIZE(mess_lsys_krn_sys_copy); + typedef struct { endpoint_t endpt; @@ -1496,6 +1508,7 @@ typedef struct { mess_lsys_krn_schedctl m_lsys_krn_schedctl; mess_lsys_krn_schedule m_lsys_krn_schedule; mess_lsys_krn_sys_abort m_lsys_krn_sys_abort; + mess_lsys_krn_sys_copy m_lsys_krn_sys_copy; mess_lsys_krn_sys_iopenable m_lsys_krn_sys_iopenable; mess_lsys_krn_sys_irqctl m_lsys_krn_sys_irqctl; mess_lsys_krn_sys_memset m_lsys_krn_sys_memset; diff --git a/kernel/system/do_copy.c b/kernel/system/do_copy.c index 2fb61a2a4..fb037368b 100644 --- a/kernel/system/do_copy.c +++ b/kernel/system/do_copy.c @@ -2,11 +2,12 @@ * m_type: SYS_VIRCOPY, SYS_PHYSCOPY * * The parameters for this kernel call are: - * m5_l1: CP_SRC_ADDR source offset within segment - * m5_i1: CP_SRC_ENDPT source process number - * m5_l2: CP_DST_ADDR destination offset within segment - * m5_i2: CP_DST_ENDPT destination process number - * m5_l3: CP_NR_BYTES number of bytes to copy + * m_lsys_krn_sys_copy.src_addr source offset within segment + * m_lsys_krn_sys_copy.src_endpt source process number + * m_lsys_krn_sys_copy.dst_addr destination offset within segment + * m_lsys_krn_sys_copy.dst_endpt destination process number + * m_lsys_krn_sys_copy.nr_bytes number of bytes to copy + * m_lsys_krn_sys_copy.flags */ #include "kernel/system.h" @@ -41,19 +42,19 @@ int do_copy(struct proc * caller, message * m_ptr) printf( "do_copy: got request from %d (source %d, destination %d)\n", caller->p_endpoint, - m_ptr->CP_SRC_ENDPT, - m_ptr->CP_DST_ENDPT); + m_ptr->m_lsys_krn_sys_copy.src_endpt, + m_ptr->m_lsys_krn_sys_copy.dst_endpt); } } #endif /* Dismember the command message. */ - vir_addr[_SRC_].proc_nr_e = m_ptr->CP_SRC_ENDPT; - vir_addr[_DST_].proc_nr_e = m_ptr->CP_DST_ENDPT; + vir_addr[_SRC_].proc_nr_e = m_ptr->m_lsys_krn_sys_copy.src_endpt; + vir_addr[_DST_].proc_nr_e = m_ptr->m_lsys_krn_sys_copy.dst_endpt; - vir_addr[_SRC_].offset = (vir_bytes) m_ptr->CP_SRC_ADDR; - vir_addr[_DST_].offset = (vir_bytes) m_ptr->CP_DST_ADDR; - bytes = (phys_bytes) m_ptr->CP_NR_BYTES; + vir_addr[_SRC_].offset = m_ptr->m_lsys_krn_sys_copy.src_addr; + vir_addr[_DST_].offset = m_ptr->m_lsys_krn_sys_copy.dst_addr; + bytes = m_ptr->m_lsys_krn_sys_copy.nr_bytes; /* Now do some checks for both the source and destination virtual address. * This is done once for _SRC_, then once for _DST_. @@ -77,7 +78,7 @@ int do_copy(struct proc * caller, message * m_ptr) if (bytes != (phys_bytes) (vir_bytes) bytes) return(E2BIG); /* Now try to make the actual virtual copy. */ - if(m_ptr->CP_FLAGS & CP_FLAG_TRY) { + if(m_ptr->m_lsys_krn_sys_copy.flags & CP_FLAG_TRY) { int r; assert(caller->p_endpoint == VFS_PROC_NR); r = virtual_copy(&vir_addr[_SRC_], &vir_addr[_DST_], bytes); @@ -89,4 +90,3 @@ int do_copy(struct proc * caller, message * m_ptr) } } #endif /* (USE_VIRCOPY || USE_PHYSCOPY) */ - diff --git a/lib/libsys/sys_physcopy.c b/lib/libsys/sys_physcopy.c index 28fc890a8..c052ed284 100644 --- a/lib/libsys/sys_physcopy.c +++ b/lib/libsys/sys_physcopy.c @@ -17,12 +17,12 @@ int flags; /* copy flags */ message copy_mess; if (bytes == 0L) return(OK); - copy_mess.CP_SRC_ENDPT = src_proc; - copy_mess.CP_SRC_ADDR = (long) src_vir; - copy_mess.CP_DST_ENDPT = dst_proc; - copy_mess.CP_DST_ADDR = (long) dst_vir; - copy_mess.CP_NR_BYTES = (long) bytes; - copy_mess.CP_FLAGS = flags; + copy_mess.m_lsys_krn_sys_copy.src_endpt = src_proc; + copy_mess.m_lsys_krn_sys_copy.src_addr = src_vir; + copy_mess.m_lsys_krn_sys_copy.dst_endpt = dst_proc; + copy_mess.m_lsys_krn_sys_copy.dst_addr = dst_vir; + copy_mess.m_lsys_krn_sys_copy.nr_bytes = bytes; + copy_mess.m_lsys_krn_sys_copy.flags = flags; return(_kernel_call(SYS_PHYSCOPY, ©_mess)); } diff --git a/lib/libsys/sys_vircopy.c b/lib/libsys/sys_vircopy.c index 55a6b4a55..28492950a 100644 --- a/lib/libsys/sys_vircopy.c +++ b/lib/libsys/sys_vircopy.c @@ -17,12 +17,12 @@ int flags; /* copy flags */ if (bytes == 0L) return(OK); memset(©_mess, 0, sizeof(copy_mess)); - copy_mess.CP_SRC_ENDPT = src_proc; - copy_mess.CP_SRC_ADDR = (long) src_vir; - copy_mess.CP_DST_ENDPT = dst_proc; - copy_mess.CP_DST_ADDR = (long) dst_vir; - copy_mess.CP_NR_BYTES = (long) bytes; - copy_mess.CP_FLAGS = flags; + copy_mess.m_lsys_krn_sys_copy.src_endpt = src_proc; + copy_mess.m_lsys_krn_sys_copy.src_addr = src_vir; + copy_mess.m_lsys_krn_sys_copy.dst_endpt = dst_proc; + copy_mess.m_lsys_krn_sys_copy.dst_addr = dst_vir; + copy_mess.m_lsys_krn_sys_copy.nr_bytes = bytes; + copy_mess.m_lsys_krn_sys_copy.flags = flags; return(_kernel_call(SYS_VIRCOPY, ©_mess)); }