/*
* Copyright (c) 2000 Apple Computer, Inc. All rights reserved.
*
- * @APPLE_LICENSE_HEADER_START@
- *
- * Copyright (c) 1999-2003 Apple Computer, Inc. All Rights Reserved.
+ * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
*
* 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. Please obtain a copy of the License at
- * http://www.opensource.apple.com/apsl/ and read it before using this
- * file.
+ * 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.
+ *
+ * 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
* 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@
#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>
#include <ddb/db_output.h>
extern jmp_buf_t *db_recover;
-extern struct savearea *saved_state[];
struct savearea ddb_null_kregs;
#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)))
+#define INFIXEDSTACK(va) 0 \
#define INKERNELSTACK(va, th) 1
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 (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()) {
+ if (thr_act == THR_ACT_NULL || thr_act == current_thread()) {
dp = vp->valuep;
}
else {
- if (thr_act->thread &&
- !(thr_act->thread->state & TH_STACK_HANDOFF) &&
- thr_act->thread->kernel_stack) {
+ if (thr_act->kernel_stack) {
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)->active_thread == thr_act->thread && saved_state[cpu]) {
+ cpu_to_processor(cpu)->active_thread == thr_act &&
+ PerProcTable[cpu].ppe_vaddr->db_saved_state) {
- dp = (db_expr_t)(((uint32_t)saved_state[cpu]) +
+ 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 if (thr_act->thread && (thr_act->thread->state & TH_STACK_HANDOFF)){
+ else {
/* only PC is valid */
if (vp->valuep == (int *) &ddb_regs.save_srr0) {
- dp = (int *)(&thr_act->thread->continuation);
+ dp = (int *)(&thr_act->continuation);
}
else {
dp = &null_reg;
if (dp == 0) {
if (!db_option(ap->modif, 'u')) {
- 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)->active_thread == thr_act->thread && saved_state[cpu]) {
- dp = (int *) (((int)saved_state[cpu]) +
+ 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));
}
}
int inst;
char *name;
-#if XXX_BS
+#if 0
db_find_task_sym_and_offset(calleepc, &name, &offset, task);
calleep = calleepc-offset;
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 */
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;
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) {
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;
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) {
+ if (th->kernel_stack == 0) {
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) {
- 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);
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)->active_thread == th->thread &&
- saved_state[cpu]) {
+ cpu_to_processor(cpu)->active_thread == th &&
+ PerProcTable[cpu].ppe_vaddr->db_saved_state) {
break;
}
}
*/
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);
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
goto next_act;
}
}
- } else {
+ } else {
frame_type = 0;
prev = db_recover;
if ((r = _setjmp(db_recover = &db_jmp_buf)) == 0) {
}
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("(");
};
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;
}