- for (prof = &p->p_stats->p_prof; prof; prof = prof->pr_next) {
- off = PC_TO_INDEX(pc,prof);
- cell = (short *)(prof->pr_base + off);
- if (cell >= (short *)prof->pr_base &&
- cell < (short*)(prof->pr_size + (int) prof->pr_base)) {
- if (copyin((caddr_t)cell, (caddr_t) &count, sizeof(count)) == 0) {
- count += ticks;
- if(copyout((caddr_t) &count, (caddr_t)cell, sizeof(count)) == 0)
- return;
- }
- p->p_stats->p_prof.pr_scale = 0;
- stopprofclock(p);
- break;
- }
+ if (proc_is64bit(p)) {
+ struct user_uprof *prof;
+ user_addr_t cell;
+
+ for (prof = &p->p_stats->user_p_prof; prof; prof = prof->pr_next) {
+ off = PC_TO_INDEX(pc, prof);
+ cell = (prof->pr_base + off);
+ if (cell >= prof->pr_base &&
+ cell < (prof->pr_size + prof->pr_base)) {
+ if (copyin(cell, (caddr_t) &count, sizeof(count)) == 0) {
+ count += ticks;
+ if(copyout((caddr_t) &count, cell, sizeof(count)) == 0)
+ return;
+ }
+ p->p_stats->user_p_prof.pr_scale = 0;
+ stopprofclock(p);
+ break;
+ }
+ }
+ }
+ else {
+ struct uprof *prof;
+ short *cell;
+
+ for (prof = &p->p_stats->p_prof; prof; prof = prof->pr_next) {
+ off = PC_TO_INDEX(pc,prof);
+ cell = (short *)(prof->pr_base + off);
+ if (cell >= (short *)prof->pr_base &&
+ cell < (short*)(prof->pr_size + prof->pr_base)) {
+ if (copyin(CAST_USER_ADDR_T(cell), (caddr_t) &count, sizeof(count)) == 0) {
+ count += ticks;
+ if(copyout((caddr_t) &count, CAST_USER_ADDR_T(cell), sizeof(count)) == 0)
+ return;
+ }
+ p->p_stats->p_prof.pr_scale = 0;
+ stopprofclock(p);
+ break;
+ }
+ }