Message type for SYS_CPROF and PM_CPROF.

Change-Id: I2dc3d9d95c2a2b4c5fdbceae359b0be2bbdf9fb5
This commit is contained in:
Lionel Sambuc 2014-07-25 19:34:11 +02:00
parent 8ad307eeed
commit 64fb3a184c
6 changed files with 50 additions and 30 deletions

View file

@ -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 */

View file

@ -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;

View file

@ -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; i<cprof_procs_no; i++) {
len = (phys_bytes) strlen(cprof_proc_info[i].name);
data_copy(KERNEL, (vir_bytes) cprof_proc_info[i].name,
m_ptr->PROF_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;
}

View file

@ -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);
}

View file

@ -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));
}

View file

@ -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);