2001-11-26 23:26:17

by Alex Buell

[permalink] [raw]
Subject: [PATCH] show_trace_task() sparc32

Since show_trace_task() has not been implemented in traps.c in the sparc32
tree, here's a quick and dirty patch to get the kernel to link properly.

--- linux-2.4.16/arch/sparc/kernel/traps.c.orig Mon Nov 26 23:13:32 2001
+++ linux-2.4.16/arch/sparc/kernel/traps.c Mon Nov 26 23:14:21 2001
@@ -84,6 +84,14 @@
printk("\n");
}

+void show_trace_task (struct task_struct *tsk)
+{
+ if (!tsk)
+ return;
+
+ printk("show_trace_task() - not implemented yet.\n");
+}
+
#define __SAVE __asm__ __volatile__("save %sp, -0x40, %sp\n\t")
#define __RESTORE __asm__ __volatile__("restore %g0, %g0, %g0\n\t")

I don't know enough about the task stuff to implement this properly. I did
this patch for 2.4.15-pre9 but just noticed that 2.4.16 doesn't have it in
place.

--
Broken hearted, but not down.

http://www.tahallah.demon.co.uk


2001-11-26 23:46:50

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] show_trace_task() sparc32

From: Alex Buell <[email protected]>
Date: Mon, 26 Nov 2001 23:13:45 +0000 (GMT)

I don't know enough about the task stuff to implement this properly. I did
this patch for 2.4.15-pre9 but just noticed that 2.4.16 doesn't have it in
place.

Thanks for pointing this out, the following is in CVS and was
passed on to Marcelo for 2.4.17-preX...

--- arch/sparc/kernel/process.c.~1~ Mon Nov 12 16:57:05 2001
+++ arch/sparc/kernel/process.c Mon Nov 26 15:45:00 2001
@@ -1,4 +1,4 @@
-/* $Id: process.c,v 1.157 2001/11/13 00:57:05 davem Exp $
+/* $Id: process.c,v 1.158 2001/11/26 23:45:00 davem Exp $
* linux/arch/sparc/kernel/process.c
*
* Copyright (C) 1995 David S. Miller ([email protected])
@@ -285,37 +285,29 @@
show_regwindow((struct reg_window *)regs->u_regs[14]);
}

-#if NOTUSED
-void show_thread(struct thread_struct *thread)
+void show_trace_task(struct task_struct *tsk)
{
- int i;
-
- printk("uwinmask: 0x%08lx kregs: 0x%08lx\n", thread->uwinmask, (unsigned long)thread->kregs);
- show_regs(thread->kregs);
- printk("ksp: 0x%08lx kpc: 0x%08lx\n", thread->ksp, thread->kpc);
- printk("kpsr: 0x%08lx kwim: 0x%08lx\n", thread->kpsr, thread->kwim);
- printk("fork_kpsr: 0x%08lx fork_kwim: 0x%08lx\n", thread->fork_kpsr, thread->fork_kwim);
-
- for (i = 0; i < NSWINS; i++) {
- if (!thread->rwbuf_stkptrs[i])
- continue;
- printk("reg_window[%d]:\n", i);
- printk("stack ptr: 0x%08lx\n", thread->rwbuf_stkptrs[i]);
- show_regwindow(&thread->reg_window[i]);
- }
- printk("w_saved: 0x%08lx\n", thread->w_saved);
-
- /* XXX missing: float_regs */
- printk("fsr: 0x%08lx fpqdepth: 0x%08lx\n", thread->fsr, thread->fpqdepth);
- /* XXX missing: fpqueue */
+ unsigned long pc, fp;
+ unsigned long task_base = (unsigned long) tsk;
+ struct reg_window *rw;
+ int count = 0;

- printk("flags: 0x%08lx current_ds: 0x%08lx\n", thread->flags, thread->current_ds.seg);
-
- show_regwindow((struct reg_window *)thread->ksp);
+ if (!tsk)
+ return;

- /* XXX missing: core_exec */
+ fp = tsk->thread.ksp;
+ do {
+ /* Bogus frame pointer? */
+ if (fp < (task_base + sizeof(struct task_struct)) ||
+ fp >= (task_base + (PAGE_SIZE << 1)))
+ break;
+ rw = (struct reg_window *) fp;
+ pc = rw->ins[7];
+ printk("[%08lx] ", pc);
+ fp = rw->ins[6];
+ } while (++count < 16);
+ printk("\n");
}
-#endif

/*
* Free current thread data structures etc..

2001-11-27 00:54:14

by Alex Buell

[permalink] [raw]
Subject: Re: [PATCH] show_trace_task() sparc32

On Mon, 26 Nov 2001, David S. Miller wrote:

> Thanks for pointing this out, the following is in CVS and was passed
> on to Marcelo for 2.4.17-preX...

Glad to oblige. I didn't realise I had patched the wrong file (traps.c)
instead of process.c as I followed the i386 tree and it was implemented in
traps.c.

--
Broken hearted, but not down.

http://www.tahallah.demon.co.uk

2001-11-27 01:09:34

by David Miller

[permalink] [raw]
Subject: Re: [PATCH] show_trace_task() sparc32

From: Alex Buell <[email protected]>
Date: Tue, 27 Nov 2001 00:47:52 +0000 (GMT)

Glad to oblige. I didn't realise I had patched the wrong file (traps.c)
instead of process.c as I followed the i386 tree and it was implemented in
traps.c.

It doesn't matter what file it goes into, the choice was
arbitrary.