From: Lionel Sambuc Date: Fri, 25 Jul 2014 17:34:11 +0000 (+0200) Subject: Message type for SYS_CPROF and PM_CPROF. X-Git-Tag: v3.3.0~104 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/static/doc/zpipe.c?a=commitdiff_plain;h=64fb3a184ccecf5af818aa22137ef0ec1099094e;p=minix.git Message type for SYS_CPROF and PM_CPROF. Change-Id: I2dc3d9d95c2a2b4c5fdbceae359b0be2bbdf9fb5 --- diff --git a/include/minix/com.h b/include/minix/com.h index c21a04313..513880e9e 100644 --- a/include/minix/com.h +++ b/include/minix/com.h @@ -363,9 +363,6 @@ #define SMS_PATTERN m2_i2 /* memset() pattern */ /* Field names for SYS_SPROF, _CPROF, _PROFBUF. */ -#define PROF_ACTION m7_i1 /* start/stop/reset/get */ -#define PROF_MEM_SIZE m7_i2 /* available memory for data */ -#define PROF_ENDPT m7_i4 /* endpoint of caller */ #define PROF_CTL_PTR m7_p1 /* location of info struct */ #define PROF_MEM_PTR m7_p2 /* location of profiling data */ diff --git a/include/minix/ipc.h b/include/minix/ipc.h index 306117433..6a8240588 100644 --- a/include/minix/ipc.h +++ b/include/minix/ipc.h @@ -136,6 +136,27 @@ typedef struct { } mess_lc_pm_sprof; _ASSERT_MSG_SIZE(mess_lc_pm_sprof); +typedef struct { + int action; + vir_bytes ctl_ptr; + vir_bytes mem_ptr; + size_t mem_size; + + uint8_t padding[40]; +} mess_lc_pm_cprof; +_ASSERT_MSG_SIZE(mess_lc_pm_cprof); + +typedef struct { + endpoint_t endpt; + int action; + vir_bytes ctl_ptr; + vir_bytes mem_ptr; + size_t mem_size; + + uint8_t padding[36]; +} mess_lsys_krn_sys_cprof; +_ASSERT_MSG_SIZE(mess_lsys_krn_sys_cprof); + typedef struct { int num; @@ -2003,8 +2024,10 @@ typedef struct { mess_notify m_notify; mess_sigcalls m_sigcalls; + mess_lc_pm_cprof m_lc_pm_cprof; mess_lc_pm_sprof m_lc_pm_sprof; mess_lsys_krn_sys_diagctl m_lsys_krn_sys_diagctl; + mess_lsys_krn_sys_cprof m_lsys_krn_sys_cprof; mess_lsys_krn_sys_sprof m_lsys_krn_sys_sprof; mess_lsys_krn_readbios m_lsys_krn_readbios; mess_pm_lsys_sigs_signal m_pm_lsys_sigs_signal; diff --git a/kernel/system/do_cprofile.c b/kernel/system/do_cprofile.c index b9f01d9f3..a9ba62222 100644 --- a/kernel/system/do_cprofile.c +++ b/kernel/system/do_cprofile.c @@ -1,12 +1,12 @@ /* The kernel call that is implemented in this file: - * m_type: SYS_CPROFILE + * m_type: SYS_CPROF * * The parameters for this kernel call are: - * m7_i1: PROF_ACTION (get/reset profiling data) - * m7_i2: PROF_MEM_SIZE (available memory for data) - * m7_i4: PROF_ENDPT (endpoint of caller) - * m7_p1: PROF_CTL_PTR (location of info struct) - * m7_p2: PROF_MEM_PTR (location of memory for data) + * m_lsys_krn_cprof.action (get/reset profiling data) + * m_lsys_krn_cprof.mem_size (available memory for data) + * m_lsys_krn_cprof.endpt (endpoint of caller) + * m_lsys_krn_cprof.ctl_ptr (location of info struct) + * m_lsys_krn_cprof.mem_ptr (location of memory for data) * * Changes: * 14 Aug, 2006 Created (Rogier Meurs) @@ -30,7 +30,7 @@ int do_cprofile(struct proc * caller, message * m_ptr) phys_bytes len; vir_bytes vir_dst; - switch (m_ptr->PROF_ACTION) { + switch (m_ptr->m_lsys_krn_cprof.action) { case PROF_RESET: @@ -69,10 +69,10 @@ int do_cprofile(struct proc * caller, message * m_ptr) * tables of the profiled processes. */ - if(!isokendpt(m_ptr->PROF_ENDPT, &proc_nr)) + if(!isokendpt(m_ptr->m_lsys_krn_cprof.endpt, &proc_nr)) return EINVAL; - cprof_mem_size = m_ptr->PROF_MEM_SIZE; + cprof_mem_size = m_ptr->m_lsys_krn_cprof.mem_size; printf("CPROFILE notice: getting tables:"); @@ -114,7 +114,7 @@ int do_cprofile(struct proc * caller, message * m_ptr) /* Copy the info struct to the user process. */ data_copy(KERNEL, (vir_bytes) &cprof_info, - m_ptr->PROF_ENDPT, (vir_bytes) m_ptr->PROF_CTL_PTR, + m_ptr->m_lsys_krn_cprof.endpt, m_ptr->m_lsys_krn_cprof.ctl_ptr, sizeof(cprof_info)); /* If there is no space or errors occurred, don't bother copying. */ @@ -122,23 +122,23 @@ int do_cprofile(struct proc * caller, message * m_ptr) /* For each profiled process, copy its name, slots_used and profiling * table to the user process. */ - vir_dst = (vir_bytes) m_ptr->PROF_MEM_PTR; + vir_dst = m_ptr->m_lsys_krn_cprof.mem_ptr; for (i=0; iPROF_ENDPT, vir_dst, len); + m_ptr->m_lsys_krn_cprof.endpt, vir_dst, len); vir_dst += CPROF_PROCNAME_LEN; len = (phys_bytes) sizeof(cprof_ctl_inst.slots_used); data_copy(cprof_proc_info[i].endpt, cprof_proc_info[i].ctl_v + sizeof(cprof_ctl_inst.reset), - m_ptr->PROF_ENDPT, vir_dst, len); + m_ptr->m_lsys_krn_cprof.endpt, vir_dst, len); vir_dst += len; len = (phys_bytes) (sizeof(cprof_tbl_inst) * cprof_proc_info[i].slots_used); data_copy(cprof_proc_info[i].endpt, cprof_proc_info[i].buf_v, - m_ptr->PROF_ENDPT, vir_dst, len); + m_ptr->m_lsys_krn_cprof.endpt, vir_dst, len); vir_dst += len; } diff --git a/lib/libc/sys-minix/cprofile.c b/lib/libc/sys-minix/cprofile.c index 512d42405..26be2d869 100644 --- a/lib/libc/sys-minix/cprofile.c +++ b/lib/libc/sys-minix/cprofile.c @@ -14,10 +14,10 @@ int cprofile(int action, int size, void *ctl_ptr, void *mem_ptr) message m; memset(&m, 0, sizeof(m)); - m.PROF_ACTION = action; - m.PROF_MEM_SIZE = size; - m.PROF_CTL_PTR = (void *) ctl_ptr; - m.PROF_MEM_PTR = (void *) mem_ptr; + m.m_lc_pm_cprof.action = action; + m.m_lc_pm_cprof.mem_size = size; + m.m_lc_pm_cprof.ctl_ptr = ctl_ptr; + m.m_lc_pm_cprof.mem_ptr = mem_ptr; return _syscall(PM_PROC_NR, PM_CPROF, &m); } diff --git a/lib/libsys/sys_cprof.c b/lib/libsys/sys_cprof.c index 397b32960..34d476000 100644 --- a/lib/libsys/sys_cprof.c +++ b/lib/libsys/sys_cprof.c @@ -6,17 +6,17 @@ int sys_cprof(action, size, endpt, ctl_ptr, mem_ptr) int action; /* get/reset profiling tables */ int size; /* size of allocated memory */ -endpoint_t endpt; /* caller endpoint */ +endpoint_t endpt; /* caller endpoint */ void *ctl_ptr; /* location of info struct */ void *mem_ptr; /* location of allocated memory */ { message m; - m.PROF_ACTION = action; - m.PROF_MEM_SIZE = size; - m.PROF_ENDPT = endpt; - m.PROF_CTL_PTR = ctl_ptr; - m.PROF_MEM_PTR = mem_ptr; + m.m_lsys_krn_sys_cprof.action = action; + m.m_lsys_krn_sys_cprof.mem_size = size; + m.m_lsys_krn_sys_cprof.endpt = endpt; + m.m_lsys_krn_sys_cprof.ctl_ptr = (vir_bytes)ctl_ptr; + m.m_lsys_krn_sys_cprof.mem_ptr = (vir_bytes)mem_ptr; return(_kernel_call(SYS_CPROF, &m)); } diff --git a/servers/pm/profile.c b/servers/pm/profile.c index 67c1337f8..b266e790c 100644 --- a/servers/pm/profile.c +++ b/servers/pm/profile.c @@ -55,11 +55,11 @@ int do_cprofile(void) int r; - switch(m_in.PROF_ACTION) { + switch(m_in.m_lc_pm_cprof.action) { case PROF_GET: - return sys_cprof(PROF_GET, m_in.PROF_MEM_SIZE, who_e, - m_in.PROF_CTL_PTR, m_in.PROF_MEM_PTR); + return sys_cprof(PROF_GET, m_in.m_lc_pm_cprof.mem_size, who_e, + m_in.m_lc_pm_cprof.ctl_ptr, m_in.m_lc_pm_cprof.mem_ptr); case PROF_RESET: return sys_cprof(PROF_RESET,0,0,0,0);