From: Lionel Sambuc Date: Wed, 21 May 2014 15:54:35 +0000 (+0200) Subject: Message type for SYS_UMAP{,_REMOTE} X-Git-Tag: v3.3.0~223 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/nslookup.html?a=commitdiff_plain;h=dc823abec2f40e239a26f1182bdc2c7689e5ddad;p=minix.git Message type for SYS_UMAP{,_REMOTE} Change-Id: Id46df10aee6189a0d3673013b498c7cc79edcc7e --- diff --git a/include/minix/com.h b/include/minix/com.h index 12b01271f..c2823b693 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -310,18 +310,8 @@ # define IRQ_WORD 0x200 /* word values */ # define IRQ_LONG 0x400 /* long values */ -/* Field names for _UMAP, _VIRCOPY, _PHYSCOPY. */ -#define CP_SRC_ENDPT m5_i1 /* process to copy from */ -#define CP_SRC_ADDR m5_l1 /* address where data come from */ -#define CP_DST_ENDPT m5_i2 /* process to copy to */ -#define CP_DST_ADDR m5_l2 /* address where data go to */ -#define CP_NR_BYTES m5_l3 /* number of bytes to copy */ -#define CP_FLAGS m5_s2 /* number of bytes to copy */ - #define CP_FLAG_TRY 0x01 /* do not transparently map */ -#define UMAP_SEG m5_s1 - /* Field names for SYS_VUMAP. */ #define VUMAP_ENDPT m10_i1 /* grant owner, or SELF for local addresses */ #define VUMAP_VADDR m10_l1 /* address of virtual (input) vector */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 5978b4eed..edaa36bd1 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -764,6 +764,24 @@ typedef struct { } mess_lsys_krn_sys_setalarm; _ASSERT_MSG_SIZE(mess_lsys_krn_sys_setalarm); +typedef struct { + endpoint_t src_endpt; + int segment; + vir_bytes src_addr; + endpoint_t dst_endpt; + int nr_bytes; + + uint8_t padding[36]; +} mess_lsys_krn_sys_umap; +_ASSERT_MSG_SIZE(mess_lsys_krn_sys_umap); + +typedef struct { + phys_bytes dst_addr; + + uint8_t padding[52]; +} mess_krn_lsys_sys_umap; +_ASSERT_MSG_SIZE(mess_krn_lsys_sys_umap); + typedef struct { int request; int vec_size; @@ -1431,6 +1449,7 @@ typedef struct { mess_krn_lsys_schedule m_krn_lsys_schedule; mess_krn_lsys_sys_irqctl m_krn_lsys_sys_irqctl; + mess_krn_lsys_sys_umap m_krn_lsys_sys_umap; mess_fs_vfs_breadwrite m_fs_vfs_breadwrite; mess_fs_vfs_chmod m_fs_vfs_chmod; @@ -1514,6 +1533,7 @@ typedef struct { mess_lsys_krn_sys_memset m_lsys_krn_sys_memset; mess_lsys_krn_sys_sdevio m_lsys_krn_sys_sdevio; mess_lsys_krn_sys_setalarm m_lsys_krn_sys_setalarm; + mess_lsys_krn_sys_umap m_lsys_krn_sys_umap; mess_lsys_krn_sys_vdevio m_lsys_krn_sys_vdevio; mess_lsys_pci_busc_get_bar m_lsys_pci_busc_get_bar; diff --git a/kernel/system/do_umap.c b/kernel/system/do_umap.c index 32c1ff3a8..9c0128bf9 100755 --- a/kernel/system/do_umap.c +++ b/kernel/system/do_umap.c @@ -2,11 +2,11 @@ * m_type: SYS_UMAP * * The parameters for this kernel call are: - * m5_i1: CP_SRC_PROC_NR (process number) - * m5_s1: UMAP_SEG (segment where address is: T, D, or S) - * m5_l1: CP_SRC_ADDR (virtual address) - * m5_l2: CP_DST_ADDR (returns physical address) - * m5_l3: CP_NR_BYTES (size of datastructure) + * m_lsys_krn_sys_umap.src_endpt (process number) + * m_lsys_krn_sys_umap.segment (segment where address is: T, D, or S) + * m_lsys_krn_sys_umap.src_addr (virtual address) + * m_krn_lsys_sys_umap.dst_addr (returns physical address) + * m_lsys_krn_sys_umap.nr_bytes (size of datastructure) */ #include "kernel/system.h" @@ -24,15 +24,15 @@ *==========================================================================*/ int do_umap(struct proc * caller, message * m_ptr) { - int seg_index = m_ptr->UMAP_SEG & SEGMENT_INDEX; - int endpt = (int) m_ptr->CP_SRC_ENDPT; + int seg_index = m_ptr->m_lsys_krn_sys_umap.segment & SEGMENT_INDEX; + int endpt = m_ptr->m_lsys_krn_sys_umap.src_endpt; /* This call is a subset of umap_remote, it allows mapping virtual addresses * in the caller's address space and grants where the caller is specified as * grantee; after the security check we simply invoke do_umap_remote */ if (seg_index != MEM_GRANT && endpt != SELF) return EPERM; - m_ptr->CP_DST_ENDPT = SELF; + m_ptr->m_lsys_krn_sys_umap.dst_endpt = SELF; return do_umap_remote(caller, m_ptr); } diff --git a/kernel/system/do_umap_remote.c b/kernel/system/do_umap_remote.c index 7e9c10fc1..8ebe78d28 100644 --- a/kernel/system/do_umap_remote.c +++ b/kernel/system/do_umap_remote.c @@ -2,12 +2,12 @@ * m_type: SYS_UMAP_REMOTE * * The parameters for this kernel call are: - * m5_i1: CP_SRC_PROC_NR (process number) - * m5_s1: UMAP_SEG (segment where address is: T, D, or S) - * m5_l1: CP_SRC_ADDR (virtual address) - * m5_i2: CP_DST_ENDPT (process number of grantee to check access for) - * m5_l2: CP_DST_ADDR (returns physical address) - * m5_l3: CP_NR_BYTES (size of datastructure) + * m_lsys_krn_sys_umap.src_endpt (process number) + * m_lsys_krn_sys_umap.segment (segment where address is: T, D, or S) + * m_lsys_krn_sys_umap.src_addr (virtual address) + * m_lsys_krn_sys_umap.dst_endpt (process number of grantee to check access for) + * m_krn_lsys_sys_umap.dst_addr (returns physical address) + * m_lsys_krn_sys_umap.nr_bytes (size of datastructure) */ #include "kernel/system.h" @@ -26,12 +26,12 @@ int do_umap_remote(struct proc * caller, message * m_ptr) { /* Map virtual address to physical, for non-kernel processes. */ - int seg_type = m_ptr->UMAP_SEG & SEGMENT_TYPE; - int seg_index = m_ptr->UMAP_SEG & SEGMENT_INDEX; - vir_bytes offset = m_ptr->CP_SRC_ADDR; - int count = m_ptr->CP_NR_BYTES; - int endpt = (int) m_ptr->CP_SRC_ENDPT; - endpoint_t grantee = (endpoint_t) m_ptr->CP_DST_ENDPT; + int seg_type = m_ptr->m_lsys_krn_sys_umap.segment & SEGMENT_TYPE; + int seg_index = m_ptr->m_lsys_krn_sys_umap.segment & SEGMENT_INDEX; + vir_bytes offset = m_ptr->m_lsys_krn_sys_umap.src_addr; + int count = m_ptr->m_lsys_krn_sys_umap.nr_bytes; + endpoint_t endpt = m_ptr->m_lsys_krn_sys_umap.src_endpt; + endpoint_t grantee = m_ptr->m_lsys_krn_sys_umap.dst_endpt; int proc_nr, proc_nr_grantee; phys_bytes phys_addr = 0, lin_addr = 0; struct proc *targetpr; @@ -108,7 +108,7 @@ int do_umap_remote(struct proc * caller, message * m_ptr) return EFAULT; } - m_ptr->CP_DST_ADDR = phys_addr; + m_ptr->m_krn_lsys_sys_umap.dst_addr = phys_addr; if(phys_addr == 0) { printf("kernel: umap 0x%x done by %d / %s, pc 0x%lx, 0x%lx -> 0x%lx\n", seg_type, caller->p_endpoint, caller->p_name, diff --git a/lib/libsys/arch/i386/sys_umap_remote.c b/lib/libsys/arch/i386/sys_umap_remote.c index 2adda8ec4..06f8d8259 100644 --- a/lib/libsys/arch/i386/sys_umap_remote.c +++ b/lib/libsys/arch/i386/sys_umap_remote.c @@ -22,14 +22,14 @@ phys_bytes *phys_addr; /* placeholder for result */ * - In all other cases, should be a valid endpoint (neither ANY nor NONE). */ - m.CP_SRC_ENDPT = proc_ep; - m.CP_DST_ENDPT = grantee; - m.UMAP_SEG = seg; - m.CP_SRC_ADDR = vir_addr; - m.CP_NR_BYTES = bytes; + m.m_lsys_krn_sys_umap.src_endpt = proc_ep; + m.m_lsys_krn_sys_umap.dst_endpt = grantee; + m.m_lsys_krn_sys_umap.segment = seg; + m.m_lsys_krn_sys_umap.src_addr = vir_addr; + m.m_lsys_krn_sys_umap.nr_bytes = bytes; result = _kernel_call(SYS_UMAP_REMOTE, &m); - *phys_addr = m.CP_DST_ADDR; + *phys_addr = m.m_krn_lsys_sys_umap.dst_addr; return(result); } diff --git a/lib/libsys/sys_umap.c b/lib/libsys/sys_umap.c index e2e3ce467..c970ed0ec 100644 --- a/lib/libsys/sys_umap.c +++ b/lib/libsys/sys_umap.c @@ -13,13 +13,13 @@ phys_bytes *phys_addr; /* placeholder for result */ message m; int result; - m.CP_SRC_ENDPT = proc_ep; - m.UMAP_SEG = seg; - m.CP_SRC_ADDR = vir_addr; - m.CP_NR_BYTES = bytes; + m.m_lsys_krn_sys_umap.src_endpt = proc_ep; + m.m_lsys_krn_sys_umap.segment = seg; + m.m_lsys_krn_sys_umap.src_addr = vir_addr; + m.m_lsys_krn_sys_umap.nr_bytes = bytes; result = _kernel_call(SYS_UMAP, &m); - *phys_addr = m.CP_DST_ADDR; + *phys_addr = m.m_krn_lsys_sys_umap.dst_addr; return(result); }