/* The kernel call that is implemented in this file: * m_type: SYS_CPROFILE * * 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) * * Changes: * 14 Aug, 2006 Created (Rogier Meurs) */ #include "../system.h" #if CPROFILE #include /*===========================================================================* * do_cprofile * *===========================================================================*/ PUBLIC int do_cprofile(m_ptr) register message *m_ptr; /* pointer to request message */ { int proc_nr, i, err = 0, k = 0; vir_bytes vir_dst; phys_bytes phys_src, phys_dst, len; switch (m_ptr->PROF_ACTION) { case PROF_RESET: /* Reset profiling tables. */ cprof_ctl_inst.reset = 1; kprintf("CPROFILE notice: resetting tables:"); for (i=0; iPROF_ENDPT, &proc_nr)) return EINVAL; vir_dst = (vir_bytes) m_ptr->PROF_CTL_PTR; len = (phys_bytes) sizeof (int *); cprof_info_addr = numap_local(proc_nr, vir_dst, len); vir_dst = (vir_bytes) m_ptr->PROF_MEM_PTR; len = (phys_bytes) sizeof (char *); cprof_data_addr = numap_local(proc_nr, vir_dst, len); cprof_mem_size = m_ptr->PROF_MEM_SIZE; kprintf("CPROFILE notice: getting tables:"); /* Copy control structs of profiled processes to calculate total * nr of bytes to be copied to user program and find out if any * errors happened. */ cprof_info.mem_used = 0; cprof_info.err = 0; for (i=0; i