]> git.saurik.com Git - apple/xnu.git/blobdiff - osfmk/ppc/db_trace.c
xnu-792.21.3.tar.gz
[apple/xnu.git] / osfmk / ppc / db_trace.c
index f7129ff9fdb4802c58cb25002f03c37ced56ad61..2bbc5a48a6b672f34bd473a7fb93a0acbfe19a29 100644 (file)
@@ -1,23 +1,29 @@
 /*
  * Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
  *
- * @APPLE_LICENSE_HEADER_START@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
  * 
- * The contents of this file constitute Original Code as defined in and
- * are subject to the Apple Public Source License Version 1.1 (the
- * "License").  You may not use this file except in compliance with the
- * License.  Please obtain a copy of the License at
- * http://www.apple.com/publicsource and read it before using this file.
+ * This file contains Original Code and/or Modifications of Original Code
+ * as defined in and that are subject to the Apple Public Source License
+ * Version 2.0 (the 'License'). You may not use this file except in
+ * compliance with the License. The rights granted to you under the License
+ * may not be used to create, or enable the creation or redistribution of,
+ * unlawful or unlicensed copies of an Apple operating system, or to
+ * circumvent, violate, or enable the circumvention or violation of, any
+ * terms of an Apple operating system software license agreement.
  * 
- * This Original Code and all software distributed under the License are
- * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
+ * Please obtain a copy of the License at
+ * http://www.opensource.apple.com/apsl/ and read it before using this file.
+ * 
+ * The Original Code and all software distributed under the License are
+ * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
- * License for the specific language governing rights and limitations
- * under the License.
+ * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
+ * Please see the License for the specific language governing rights and
+ * limitations under the License.
  * 
- * @APPLE_LICENSE_HEADER_END@
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
  */
 /*
  * @OSF_COPYRIGHT@
@@ -31,6 +37,8 @@
 #include <kern/processor.h>
 #include <kern/task.h>
 
+#include <ppc/cpu_internal.h>
+#include <ppc/exception.h>
 #include <machine/asm.h>
 #include <machine/db_machdep.h>
 #include <machine/setjmp.h>
@@ -44,7 +52,6 @@
 #include <ddb/db_output.h>
 
 extern jmp_buf_t *db_recover;
-extern struct savearea *saved_state[];
 
 struct savearea ddb_null_kregs;
 
@@ -53,35 +60,19 @@ extern vm_offset_t vm_min_inks_addr;        /* set by db_clone_symtabXXX */
 #define DB_NUMARGS_MAX 5
 
 
-extern  char FixedStackStart[], FixedStackEnd[];
-#define        INFIXEDSTACK(va)                                                        \
-       ((((vm_offset_t)(va)) >= (vm_offset_t)&FixedStackStart) &&      \
-       (((vm_offset_t)(va)) < ((vm_offset_t)&FixedStackEnd)))
-
-#if 0
+#define        INFIXEDSTACK(va)        0                                                       \
 
-#define        INKERNELSTACK(va, th)                                   \
-       (th == THR_ACT_NULL ||                          \
-        (((vm_offset_t)(va)) >= th->thread->kernel_stack &&    \
-         (((vm_offset_t)(va)) < th->thread->kernel_stack +     \
-                                KERNEL_STACK_SIZE)) ||         \
-         INFIXEDSTACK(va))
-#else
 #define INKERNELSTACK(va, th) 1
 
-#endif
-
-#ifdef __MACHO__
 struct db_ppc_frame {
        struct db_ppc_frame     *f_frame;
        int                     pad1;
-       db_addr_t               f_retaddr;
+       uint32_t        f_retaddr;
        int                     pad3;
        int                     pad4;
        int                     pad5;
-       db_addr_t               f_arg[DB_NUMARGS_MAX];
+       uint32_t        f_arg[DB_NUMARGS_MAX];
 };
-#endif
 
 #define        TRAP            1
 #define        INTERRUPT       2
@@ -124,45 +115,45 @@ extern int        _setjmp(
  */
 struct db_variable db_regs[] = {
        /* XXX "pc" is an alias to "srr0"... */
-  { "pc",      (int *)&ddb_regs.save_srr0,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "srr0",    (int *)&ddb_regs.save_srr0,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "srr1",    (int *)&ddb_regs.save_srr1,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r0",      (int *)&ddb_regs.save_r0,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r1",      (int *)&ddb_regs.save_r1,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r2",      (int *)&ddb_regs.save_r2,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r3",      (int *)&ddb_regs.save_r3,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r4",      (int *)&ddb_regs.save_r4,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r5",      (int *)&ddb_regs.save_r5,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r6",      (int *)&ddb_regs.save_r6,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r7",      (int *)&ddb_regs.save_r7,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r8",      (int *)&ddb_regs.save_r8,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r9",      (int *)&ddb_regs.save_r9,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r10",     (int *)&ddb_regs.save_r10,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r11",     (int *)&ddb_regs.save_r11,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r12",     (int *)&ddb_regs.save_r12,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r13",     (int *)&ddb_regs.save_r13,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r14",     (int *)&ddb_regs.save_r14,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r15",     (int *)&ddb_regs.save_r15,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r16",     (int *)&ddb_regs.save_r16,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r17",     (int *)&ddb_regs.save_r17,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r18",     (int *)&ddb_regs.save_r18,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r19",     (int *)&ddb_regs.save_r19,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r20",     (int *)&ddb_regs.save_r20,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r21",     (int *)&ddb_regs.save_r21,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r22",     (int *)&ddb_regs.save_r22,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r23",     (int *)&ddb_regs.save_r23,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r24",     (int *)&ddb_regs.save_r24,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r25",     (int *)&ddb_regs.save_r25,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r26",     (int *)&ddb_regs.save_r26,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r27",     (int *)&ddb_regs.save_r27,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r28",     (int *)&ddb_regs.save_r28,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r29",     (int *)&ddb_regs.save_r29,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r30",     (int *)&ddb_regs.save_r30,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "r31",     (int *)&ddb_regs.save_r31,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "cr",      (int *)&ddb_regs.save_cr,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "xer",     (int *)&ddb_regs.save_xer,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "lr",      (int *)&ddb_regs.save_lr,       db_ppc_reg_value, 0, 0, 0, 0, TRUE },
-  { "ctr",     (int *)&ddb_regs.save_ctr,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "pc",      &ddb_regs.save_srr0,    db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "srr0",    &ddb_regs.save_srr0,    db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "srr1",    &ddb_regs.save_srr1,    db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r0",      &ddb_regs.save_r0,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r1",      &ddb_regs.save_r1,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r2",      &ddb_regs.save_r2,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r3",      &ddb_regs.save_r3,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r4",      &ddb_regs.save_r4,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r5",      &ddb_regs.save_r5,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r6",      &ddb_regs.save_r6,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r7",      &ddb_regs.save_r7,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r8",      &ddb_regs.save_r8,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r9",      &ddb_regs.save_r9,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r10",     &ddb_regs.save_r10,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r11",     &ddb_regs.save_r11,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r12",     &ddb_regs.save_r12,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r13",     &ddb_regs.save_r13,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r14",     &ddb_regs.save_r14,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r15",     &ddb_regs.save_r15,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r16",     &ddb_regs.save_r16,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r17",     &ddb_regs.save_r17,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r18",     &ddb_regs.save_r18,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r19",     &ddb_regs.save_r19,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r20",     &ddb_regs.save_r20,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r21",     &ddb_regs.save_r21,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r22",     &ddb_regs.save_r22,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r23",     &ddb_regs.save_r23,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r24",     &ddb_regs.save_r24,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r25",     &ddb_regs.save_r25,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r26",     &ddb_regs.save_r26,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r27",     &ddb_regs.save_r27,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r28",     &ddb_regs.save_r28,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r29",     &ddb_regs.save_r29,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r30",     &ddb_regs.save_r30,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "r31",     &ddb_regs.save_r31,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "cr",      &ddb_regs.save_cr,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "xer",     &ddb_regs.save_xer,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "lr",      &ddb_regs.save_lr,      db_ppc_reg_value, 0, 0, 0, 0, TRUE },
+  { "ctr",     &ddb_regs.save_ctr,     db_ppc_reg_value, 0, 0, 0, 0, TRUE },
 };
 struct db_variable *db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
 
@@ -173,82 +164,91 @@ db_ppc_reg_value(
        int                     flag,
        db_var_aux_param_t      ap)
 {
-       int                     *dp = 0;
-       db_expr_t               null_reg = 0;
+       db_expr_t *dp = 0;
+       db_expr_t null_reg = 0;
+       uint32_t *dp32;
+       
        register thread_act_t   thr_act = ap->thr_act;
        int                     cpu;
 
        if (db_option(ap->modif, 'u')) {
            if (thr_act == THR_ACT_NULL) {
-               if ((thr_act = current_act()) == THR_ACT_NULL)
+               if ((thr_act = current_thread()) == THR_ACT_NULL)
                    db_error("no user registers\n");
            }
-           if (thr_act == current_act()) {
-               if (IS_USER_TRAP((&ddb_regs)))
-                   dp = vp->valuep;
-               else if (INFIXEDSTACK(ddb_regs.save_r1))
-                   db_error("cannot get/set user registers in nested interrupt\n");
+           if (thr_act == current_thread()) {
+                       if (IS_USER_TRAP((&ddb_regs))) dp = vp->valuep;
+                       else if (INFIXEDSTACK(ddb_regs.save_r1))
+                               db_error("cannot get/set user registers in nested interrupt\n");
            }
-       } else {
-           if (thr_act == THR_ACT_NULL || thr_act == current_act()) {
-               dp = vp->valuep;
-           } else {
-             if (thr_act->thread &&
-                 !(thr_act->thread->state & TH_STACK_HANDOFF) && 
-                       thr_act->thread->kernel_stack) {
-               int cpu;
-
-               for (cpu = 0; cpu < NCPUS; cpu++) {
-                   if (cpu_to_processor(cpu)->state == PROCESSOR_RUNNING &&
-                       cpu_to_processor(cpu)->cpu_data->active_thread == thr_act->thread && saved_state[cpu]) {
-                       dp = (int *) (((int)saved_state[cpu]) +
-                                     (((int) vp->valuep) -
-                                      (int) &ddb_regs));
-                       break;
-                   }
-               }
+       } 
+       else {
+               if (thr_act == THR_ACT_NULL || thr_act == current_thread()) {
+                       dp = vp->valuep;
+               } 
+               else {
+                       if (thr_act->kernel_stack) {
+                               
+                               int cpu;
 
-               if (dp == 0)
-                   dp = &null_reg;
-             } else if (thr_act->thread &&
-                        (thr_act->thread->state&TH_STACK_HANDOFF)){
-               /* only PC is valid */
-               if (vp->valuep == (int *) &ddb_regs.save_srr0) {
-                   dp = (int *)(&thr_act->thread->continuation);
-               } else {
-                   dp = &null_reg;
-               }
-             }
+                               for (cpu = 0; cpu < real_ncpus; cpu++) {
+                                       if (cpu_to_processor(cpu)->state == PROCESSOR_RUNNING &&
+                                               cpu_to_processor(cpu)->active_thread == thr_act &&
+                                           PerProcTable[cpu].ppe_vaddr->db_saved_state) {
+                                               
+                                               dp = (db_expr_t)(((uint32_t)(PerProcTable[cpu].ppe_vaddr->db_saved_state)) +
+                                                                 (((uint32_t) vp->valuep) -
+                                                                  (uint32_t) &ddb_regs));
+                                               break;
+                                       }
+                               }
+
+                               if (dp == 0) dp = &null_reg;
+                       } 
+                       else {
+                               /* only PC is valid */
+                               if (vp->valuep == (int *) &ddb_regs.save_srr0) {
+                                       dp = (int *)(&thr_act->continuation);
+                               } 
+                               else {
+                                       dp = &null_reg;
+                               }
+                       }
            }
        }
        if (dp == 0) {
-           int cpu;
 
            if (!db_option(ap->modif, 'u')) {
-               for (cpu = 0; cpu < NCPUS; cpu++) {
-                   if (cpu_to_processor(cpu)->state == PROCESSOR_RUNNING &&
-                       cpu_to_processor(cpu)->cpu_data->active_thread == thr_act->thread && saved_state[cpu]) {
-                           dp = (int *) (((int)saved_state[cpu]) +
-                                         (((int) vp->valuep) -
-                                          (int) &ddb_regs));
-                           break;
-                   }
-               }
+                       for (cpu = 0; cpu < real_ncpus; cpu++) {
+                           if (cpu_to_processor(cpu)->state == PROCESSOR_RUNNING &&
+                               cpu_to_processor(cpu)->active_thread == thr_act &&
+                                   PerProcTable[cpu].ppe_vaddr->db_saved_state) {
+                                   dp = (int *) (((int)(PerProcTable[cpu].ppe_vaddr->db_saved_state)) +
+                                                 (((int) vp->valuep) - (int) &ddb_regs));
+                                       break;
+                               }
+                       }
            }
            if (dp == 0) {
-               if (!thr_act || thr_act->mact.pcb == 0)
-                   db_error("no pcb\n");
-               dp = (int *)((int)thr_act->mact.pcb + 
-                            ((int)vp->valuep - (int)&ddb_regs));
+                       if (!thr_act || thr_act->machine.pcb == 0) db_error("no pcb\n");
+                       dp = (int *)((int)thr_act->machine.pcb + ((int)vp->valuep - (int)&ddb_regs));
            }
        }
-       if (flag == DB_VAR_SET)
-           *dp = *valuep;
-       else
-           *valuep = *dp;
+
+       if(vp->valuep == (int *) &ddb_regs.save_cr) {   /* Is this the CR we are doing? */
+               dp32 = (uint32_t *)dp;                                          /* Make this easier */
+               if (flag == DB_VAR_SET) *dp32 = *valuep;
+               else *valuep = *dp32;
+       }
+       else {                                                                                  /* Normal 64-bit registers */
+               if (flag == DB_VAR_SET) *dp = *valuep;
+               else *valuep = *(unsigned long long *)dp;
+       }
+       
        return(0);
 }
 
+
 void
 db_find_trace_symbols(void)
 {
@@ -305,7 +305,7 @@ db_find_arg(
        int             inst;
        char            *name;
 
-#if    XXX_BS
+#if    0
        db_find_task_sym_and_offset(calleepc, &name, &offset, task);
        calleep = calleepc-offset;
 
@@ -366,14 +366,21 @@ db_nextframe(
            goto miss_frame;
            break;
        case SYSCALL:
-           if (thr_act != THR_ACT_NULL && thr_act->mact.pcb) {
-               *ip = (db_addr_t) thr_act->mact.pcb->save_srr0;
-               *fp = (struct db_ppc_frame *) (thr_act->mact.pcb->save_r1);
+           if (thr_act != THR_ACT_NULL && thr_act->machine.pcb) {
+               *ip = (db_addr_t) thr_act->machine.pcb->save_srr0;
+               *fp = (struct db_ppc_frame *) (thr_act->machine.pcb->save_r1);
                break;
            }
            /* falling down for unknown case */
        default:
        miss_frame:
+               
+               if(!pmap_find_phys(kernel_pmap, (addr64_t)*fp)) {       /* Check if this is valid */
+                       db_printf("Frame not mapped %08X\n",*fp);               /* Say not found */
+                       *fp = 0;                                                                                /* Show not found */
+                       break;                                                                                  /* Out of here */
+               }
+               
                if ((*fp)->f_frame)
                    *ip = (db_addr_t)
                            db_get_task_value((int)&(*fp)->f_frame->f_retaddr,
@@ -436,7 +443,7 @@ db_stack_trace_cmd(
            if (!have_addr && !trace_thread) {
                        have_addr = TRUE;
                        trace_thread = TRUE;
-                       act_list = &(current_task()->thr_acts);
+                       act_list = &(current_task()->threads);
                        addr = (db_expr_t) queue_first(act_list);
            } 
                else if (trace_thread) {
@@ -444,11 +451,11 @@ db_stack_trace_cmd(
                                if (!db_check_act_address_valid((thread_act_t)addr)) {
                                        if (db_lookup_task((task_t)addr) == -1)
                                                return;
-                                       act_list = &(((task_t)addr)->thr_acts);
+                                       act_list = &(((task_t)addr)->threads);
                                        addr = (db_expr_t) queue_first(act_list);
                                } 
                                else {
-                                       act_list = &(((thread_act_t)addr)->task->thr_acts);
+                                       act_list = &(((thread_act_t)addr)->task->threads);
                                        thcount = db_lookup_task_act(((thread_act_t)addr)->task,
                                                                        (thread_act_t)addr);
                                }
@@ -456,13 +463,13 @@ db_stack_trace_cmd(
                        else {
                                th = db_default_act;
                                if (th == THR_ACT_NULL)
-                                       th = current_act();
+                                       th = current_thread();
                                if (th == THR_ACT_NULL) {
                                        db_printf("no active thr_act\n");
                                        return;
                                }
                                have_addr = TRUE;
-                               act_list = &th->task->thr_acts;
+                               act_list = &th->task->threads;
                                addr = (db_expr_t) queue_first(act_list);
                        }
            }
@@ -481,7 +488,7 @@ next_thread:
            frame = (struct db_ppc_frame *)(ddb_regs.save_r1);
            callpc = (db_addr_t)ddb_regs.save_srr0;
            linkpc = (db_addr_t)ddb_regs.save_lr;
-           th = current_act();
+           th = current_thread();
            task = (th != THR_ACT_NULL)? th->task: TASK_NULL;
        } 
        else if (trace_thread) {
@@ -493,7 +500,7 @@ next_thread:
                else {
                        th = db_default_act;
                        if (th == THR_ACT_NULL)
-                          th = current_act();
+                          th = current_thread();
                        if (th == THR_ACT_NULL) {
                           db_printf("no active thread\n");
                           return;
@@ -501,37 +508,29 @@ next_thread:
            }
            if (trace_all_threads)
                db_printf("---------- Thread 0x%x (#%d of %d) ----------\n",
-                         addr, thcount, th->task->thr_act_count);
+                         addr, thcount, th->task->thread_count);
 
 next_activation:
 
            user_frame = 0;
 
            task = th->task;
-           if (th == current_act()) {
+           if (th == current_thread()) {
                frame = (struct db_ppc_frame *)(ddb_regs.save_r1);
                callpc = (db_addr_t)ddb_regs.save_srr0;
                        linkpc = (db_addr_t)ddb_regs.save_lr;
            } 
                else {
-                       if (th->mact.pcb == 0) {
+                       if (th->machine.pcb == 0) {
                        db_printf("thread has no pcb\n");
                                goto thread_done;
                        }
-                       if (!th->thread) {
-                               register struct savearea *pss =
-                                                       th->mact.pcb;
-       
-                               db_printf("thread has no shuttle\n");
-                               goto thread_done;
-                       }
-                       else if ((th->thread->state & TH_STACK_HANDOFF) ||
-                                 th->thread->kernel_stack == 0) {
+                       if (th->kernel_stack == 0) {
                                register struct savearea *pss =
-                                                       th->mact.pcb;
+                                                       th->machine.pcb;
        
                                db_printf("Continuation ");
-                               db_task_printsym((db_expr_t)th->thread->continuation,
+                               db_task_printsym((db_expr_t)th->continuation,
                                                                DB_STGY_PROC, task);
                                db_printf("\n");
                                frame = (struct db_ppc_frame *) (pss->save_r1);
@@ -541,10 +540,10 @@ next_activation:
                        else {
                                int cpu;
        
-                               for (cpu = 0; cpu < NCPUS; cpu++) {
+                               for (cpu = 0; cpu < real_ncpus; cpu++) {
                                        if (cpu_to_processor(cpu)->state == PROCESSOR_RUNNING &&
-                                               cpu_to_processor(cpu)->cpu_data->active_thread == th->thread &&
-                                               saved_state[cpu]) {
+                                               cpu_to_processor(cpu)->active_thread == th &&
+                                               PerProcTable[cpu].ppe_vaddr->db_saved_state) {
                                                break;
                                        }
                                }
@@ -556,16 +555,16 @@ next_activation:
                                         */
                                        struct savearea *pss;
        
-                                       pss = th->mact.pcb;
+                                       pss = th->machine.pcb;
                                        frame = (struct db_ppc_frame *) (pss->save_r1);
                                        callpc = (db_addr_t) (pss->save_srr0);
                                        linkpc = (db_addr_t) (pss->save_lr);
                                        } else {
-                                               if (cpu == NCPUS) {
+                                               if (cpu == real_ncpus) {
                                                        register struct savearea *iks;
                                                        int r;
                        
-                                                       iks = th->mact.pcb;
+                                                       iks = th->machine.pcb;
                                                        prev = db_recover;
                                                        if ((r = _setjmp(db_recover = &db_jmp_buf)) == 0) {
                                                                frame = (struct db_ppc_frame *) (iks->save_r1);
@@ -589,16 +588,16 @@ next_activation:
                                                        db_printf(">>>>> active on cpu %d <<<<<\n",
                                                                  cpu);
                                                        frame = (struct db_ppc_frame *)
-                                                       (saved_state[cpu]->save_r1);
-                                                       callpc = (db_addr_t) saved_state[cpu]->save_srr0;
-                                                       linkpc = (db_addr_t) saved_state[cpu]->save_lr;
+                                                       (PerProcTable[cpu].ppe_vaddr->db_saved_state->save_r1);
+                                                       callpc = (db_addr_t) PerProcTable[cpu].ppe_vaddr->db_saved_state->save_srr0;
+                                                       linkpc = (db_addr_t) PerProcTable[cpu].ppe_vaddr->db_saved_state->save_lr;
                                                }
                                        }
                                }
            }
        } else {
            frame = (struct db_ppc_frame *)addr;
-           th = (db_default_act)? db_default_act: current_act();
+           th = (db_default_act)? db_default_act: current_thread();
            task = (th != THR_ACT_NULL)? th->task: TASK_NULL;
            if (frame->f_frame) {
              callpc = (db_addr_t)db_get_task_value
@@ -667,7 +666,7 @@ next_activation:
                                        goto next_act;
                                }
                        }
-               } else {
+           } else {
                        frame_type = 0;
                        prev = db_recover;
                        if ((r = _setjmp(db_recover = &db_jmp_buf)) == 0) {
@@ -682,11 +681,11 @@ next_activation:
                }
 
            if (name == 0 || offset > db_maxoff) {
-               db_printf("[%08X]0x%08X(", frame, callpc);
+                       db_printf("[%08X]0x%08X(", frame, callpc);
            } else {
                db_printf("[%08X]%s", frame, name);
-               if (offset)
-                        db_printf("+%x", offset);
+                       if (offset)
+                               db_printf("+%llx", offset);
                db_printf("(");
           };
 
@@ -744,16 +743,6 @@ next_activation:
 
            if (frame == 0) {
        next_act:
-               if (th->lower != THR_ACT_NULL) {
-                   if (top_act == THR_ACT_NULL)
-                       top_act = th;
-                   th = th->lower;
-                   db_printf(">>>>> next activation 0x%x ($task%d.%d) <<<<<\n",
-                             th,
-                             db_lookup_task(th->task),
-                             db_lookup_task_act(th->task, th));
-                   goto next_activation;
-               }
                /* end of chain */
                break;
            }
@@ -777,7 +766,7 @@ next_activation:
        if (trace_all_threads) {
            if (top_act != THR_ACT_NULL)
                th = top_act;
-           th = (thread_act_t) queue_next(&th->thr_acts);
+           th = (thread_act_t) queue_next(&th->task_threads);
            if (! queue_end(act_list, (queue_entry_t) th)) {
                db_printf("\n");
                addr = (db_expr_t) th;