2006-10-30 16:53:38 +01:00
|
|
|
/* The kernel call that is implemented in this file:
|
|
|
|
* m_type: SYS_PROFBUF
|
|
|
|
*
|
|
|
|
* The parameters for this kernel call are:
|
|
|
|
* m7_p1: PROF_CTL_PTR (location of control struct)
|
|
|
|
* m7_p2: PROF_MEM_PTR (location of profiling table)
|
|
|
|
*
|
|
|
|
* Changes:
|
|
|
|
* 14 Aug, 2006 Created (Rogier Meurs)
|
|
|
|
*/
|
|
|
|
|
2010-04-02 00:22:33 +02:00
|
|
|
#include "kernel/system.h"
|
2006-10-30 16:53:38 +01:00
|
|
|
|
|
|
|
/*===========================================================================*
|
|
|
|
* do_profbuf *
|
|
|
|
*===========================================================================*/
|
2010-02-03 10:04:48 +01:00
|
|
|
PUBLIC int do_profbuf(struct proc * caller, message * m_ptr)
|
2006-10-30 16:53:38 +01:00
|
|
|
{
|
|
|
|
/* This kernel call is used by profiled system processes when Call
|
|
|
|
* Profiling is enabled. It is called on the first execution of procentry.
|
|
|
|
* By means of this kernel call, the profiled processes inform the kernel
|
|
|
|
* about the location of their profiling table and the control structure
|
|
|
|
* which is used to enable the kernel to have the tables cleared.
|
|
|
|
*/
|
2008-11-19 13:26:10 +01:00
|
|
|
int proc_nr;
|
2006-10-30 16:53:38 +01:00
|
|
|
struct proc *rp;
|
|
|
|
|
|
|
|
/* Store process name, control struct, table locations. */
|
2008-11-19 13:26:10 +01:00
|
|
|
if(!isokendpt(m_ptr->m_source, &proc_nr))
|
|
|
|
return EDEADSRCDST;
|
|
|
|
|
|
|
|
if(cprof_procs_no >= NR_SYS_PROCS)
|
|
|
|
return ENOSPC;
|
|
|
|
|
2006-10-30 16:53:38 +01:00
|
|
|
rp = proc_addr(proc_nr);
|
|
|
|
|
2010-02-03 10:04:48 +01:00
|
|
|
cprof_proc_info[cprof_procs_no].endpt = caller->p_endpoint;
|
2006-10-30 16:53:38 +01:00
|
|
|
cprof_proc_info[cprof_procs_no].name = rp->p_name;
|
|
|
|
|
2008-11-19 13:26:10 +01:00
|
|
|
cprof_proc_info[cprof_procs_no].ctl_v = (vir_bytes) m_ptr->PROF_CTL_PTR;
|
|
|
|
cprof_proc_info[cprof_procs_no].buf_v = (vir_bytes) m_ptr->PROF_MEM_PTR;
|
2006-10-30 16:53:38 +01:00
|
|
|
|
|
|
|
cprof_procs_no++;
|
|
|
|
|
|
|
|
return OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
|