- s = splstatclock();
- PROFILE_LOCK(&upp->pr_lock);
- upp->pr_base = (caddr_t)uap->bufbase;
- upp->pr_size = uap->bufsize;
- upp->pr_off = uap->pcoffset;
- upp->pr_scale = uap->pcscale;
-
- /* remove buffers previously allocated with add_profil() */
- for (upc = upp->pr_next; upc; upc = nupc) {
- nupc = upc->pr_next;
- kfree(upc, sizeof (struct uprof));
+ s = ml_set_interrupts_enabled(FALSE);
+
+ if (proc_is64bit(p)) {
+ struct user_uprof *user_upp = &p->p_stats->user_p_prof;
+ struct user_uprof *upc, *nupc;
+
+ PROFILE_LOCK(&user_upp->pr_lock);
+ user_upp->pr_base = uap->bufbase;
+ user_upp->pr_size = uap->bufsize;
+ user_upp->pr_off = uap->pcoffset;
+ user_upp->pr_scale = uap->pcscale;
+ upp->pr_base = NULL;
+ upp->pr_size = 0;
+ upp->pr_scale = 0;
+
+ /* remove buffers previously allocated with add_profil() */
+ for (upc = user_upp->pr_next; upc; upc = nupc) {
+ nupc = upc->pr_next;
+ kfree(upc, sizeof (*upc));
+ }
+ user_upp->pr_next = 0;
+ PROFILE_UNLOCK(&user_upp->pr_lock);
+ }
+ else {
+ struct uprof *upc, *nupc;
+
+ PROFILE_LOCK(&upp->pr_lock);
+ upp->pr_base = CAST_DOWN(caddr_t, uap->bufbase);
+ upp->pr_size = uap->bufsize;
+ upp->pr_off = uap->pcoffset;
+ upp->pr_scale = uap->pcscale;
+
+ /* remove buffers previously allocated with add_profil() */
+ for (upc = upp->pr_next; upc; upc = nupc) {
+ nupc = upc->pr_next;
+ kfree(upc, sizeof (struct uprof));
+ }
+ upp->pr_next = 0;
+ PROFILE_UNLOCK(&upp->pr_lock);