Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_exec.c
Show First 20 Lines • Show All 913 Lines • ▼ Show 20 Lines | #ifdef HWPMC_HOOKS | ||||
* Check if system-wide sampling is in effect or if the | * Check if system-wide sampling is in effect or if the | ||||
* current process is using PMCs. If so, do exec() time | * current process is using PMCs. If so, do exec() time | ||||
* processing. This processing needs to happen AFTER the | * processing. This processing needs to happen AFTER the | ||||
* P_INEXEC flag is cleared. | * P_INEXEC flag is cleared. | ||||
*/ | */ | ||||
if (PMC_SYSTEM_SAMPLING_ACTIVE() || PMC_PROC_IS_USING_PMCS(p)) { | if (PMC_SYSTEM_SAMPLING_ACTIVE() || PMC_PROC_IS_USING_PMCS(p)) { | ||||
VOP_UNLOCK(imgp->vp); | VOP_UNLOCK(imgp->vp); | ||||
pe.pm_credentialschanged = credential_changing; | pe.pm_credentialschanged = credential_changing; | ||||
pe.pm_entryaddr = imgp->entry_addr; | pe.pm_baseaddr = imgp->reloc_base; | ||||
pe.pm_dynaddr = imgp->et_dyn_addr; | |||||
jhb: I realize these names are derived from the imgp field names, but it doesn't quite read… | |||||
Done Inline ActionsHm, I could change the names in PMC land... it's not just that this is the imgp name, it's also that it matches AT_BASE in the auxargs. And if you have a statically-linked binary then there is no interpreter and reloc_base will correspond to the executable. And yes, et_dyn_addr is 0 for PDEs. jrtc27: Hm, I could change the names in PMC land... it's not just that this is the imgp name, it's also… | |||||
Not Done Inline ActionsYes, the weird nature of reloc_base being the executable has been confusing to me in the kernel code as well. :) Matching AT_BASE is a decent argument though. Might be good to document what these fields are (even '/* AT_BASE */' would be a good pointer) in the header for the structure shared with userland. jhb: Yes, the weird nature of reloc_base being the executable has been confusing to me in the kernel… | |||||
PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC, (void *) &pe); | PMC_CALL_HOOK_X(td, PMC_FN_PROCESS_EXEC, (void *) &pe); | ||||
vn_lock(imgp->vp, LK_SHARED | LK_RETRY); | vn_lock(imgp->vp, LK_SHARED | LK_RETRY); | ||||
} | } | ||||
#endif | #endif | ||||
/* Set values passed into the program in registers. */ | /* Set values passed into the program in registers. */ | ||||
(*p->p_sysent->sv_setregs)(td, imgp, stack_base); | (*p->p_sysent->sv_setregs)(td, imgp, stack_base); | ||||
▲ Show 20 Lines • Show All 1,161 Lines • Show Last 20 Lines |
I realize these names are derived from the imgp field names, but it doesn't quite read intuitive that 'baseaddr' is 'base address of interpreter' vs if it was named something like 'interpaddr'. Even 'dynaddr' isn't fully intuitive either. Given how the variables are used in libpmc I would maybe call them 'pm_interpaddr' and 'pm_execaddr' (exec for executable). Perhaps though that doesn't quite DTRT for PDEs (or would exposing the true pm_execaddr mean you would drop the image->pi_vaddr + in libpmc)?