Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/sparc64 Trapframes only have locals or ins if the k...
details: https://anonhg.NetBSD.org/src/rev/8d34484e26a2
branches: trunk
changeset: 526921:8d34484e26a2
user: eeh <eeh%NetBSD.org@localhost>
date: Tue May 14 02:34:14 2002 +0000
description:
Trapframes only have locals or ins if the kernel is compiled DEBUG.
diffstat:
sys/arch/sparc64/include/pcb.h | 6 ++-
sys/arch/sparc64/include/reg.h | 37 +++++++++++++++++++----
sys/arch/sparc64/sparc64/db_interface.c | 19 ++++++-----
sys/arch/sparc64/sparc64/db_trace.c | 10 +++--
sys/arch/sparc64/sparc64/genassym.c | 11 ++----
sys/arch/sparc64/sparc64/genassym.cf | 10 +----
sys/arch/sparc64/sparc64/trap.c | 10 +++--
sys/arch/sparc64/sparc64/vm_machdep.c | 50 +++++++++++++++++++++++++++++++-
8 files changed, 111 insertions(+), 42 deletions(-)
diffs (truncated from 337 to 300 lines):
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/include/pcb.h
--- a/sys/arch/sparc64/include/pcb.h Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/include/pcb.h Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: pcb.h,v 1.7 2000/12/29 17:12:05 eeh Exp $ */
+/* $NetBSD: pcb.h,v 1.8 2002/05/14 02:34:15 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -152,7 +153,8 @@
};
struct md_coredump {
- struct trapframe64 md_tf;
+ /* We'll retain the larger structure for backwards compat. */
+ struct trapframe64_15 md_tf;
struct fpstate64 md_fpstate;
};
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/include/reg.h
--- a/sys/arch/sparc64/include/reg.h Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/include/reg.h Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: reg.h,v 1.8 2001/06/19 12:59:16 wiz Exp $ */
+/* $NetBSD: reg.h,v 1.9 2002/05/14 02:34:15 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -66,14 +67,12 @@
/*
* The v9 trapframe is a bit more complex. Since we don't get a free
* register window with each trap we need some way to keep track of
- * pending traps. We use tf_fault to save the faulting address for
- * memory faults and tf_kstack to thread trapframes on the kernel
- * stack(s). If tf_kstack == 0 then this is the lowest level trap;
- * we came from user mode.
+ * pending traps.
* (The slot tf_global[0] is used to store the %fp when this is used
* as a clockframe. This is known as `cheating'.)
*/
-struct trapframe64 {
+/* The 1.5 version had lots of extra goodies in it. */
+struct trapframe64_15 {
int64_t tf_tstate; /* tstate register */
int64_t tf_pc; /* return pc */
int64_t tf_npc; /* return npc */
@@ -86,10 +85,34 @@
int64_t tf_global[8]; /* global registers in trap's caller */
/* n.b. tf_global[0] is used for fp when this is a clockframe */
int64_t tf_out[8]; /* output registers in trap's caller */
- int64_t tf_local[8]; /* local registers in trap's caller */
+ int64_t tf_local[8]; /* local registers in trap's caller (for debug) */
int64_t tf_in[8]; /* in registers in trap's caller (for debug) */
};
+/*
+ * The following version does not have the locals or outs so is almost
+ * half the size of the 1.5 trapframe (160 bytes vs 304 bytes).
+ */
+struct trapframe64 {
+ int64_t tf_tstate; /* tstate register */
+ int64_t tf_pc; /* return pc */
+ int64_t tf_npc; /* return npc */
+/* XXX -- next two fields are unused and should be removed. */
+ int64_t tf_fault; /* faulting addr -- need somewhere to save it */
+ int64_t tf_kstack; /* kernel stack of prev tf */
+ int tf_y; /* %y register -- 32-bits */
+ short tf_tt; /* What type of trap this was */
+ char tf_pil; /* What IRQ we're handling */
+ char tf_oldpil; /* What our old SPL was */
+ int64_t tf_global[8]; /* global registers in trap's caller */
+ /* n.b. tf_global[0] is used for fp when this is a clockframe */
+ int64_t tf_out[8]; /* output registers in trap's caller */
+#ifdef DEBUG
+ int64_t tf_local[8]; /* local registers in trap's caller (for debug) */
+ int64_t tf_in[8]; /* in registers in trap's caller (for debug) */
+#endif
+};
+
/*
* Register windows. Each stack pointer (%o6 aka %sp) in each window
* must ALWAYS point to some place at which it is safe to scribble on
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/sparc64/db_interface.c
--- a/sys/arch/sparc64/sparc64/db_interface.c Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/sparc64/db_interface.c Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: db_interface.c,v 1.63 2002/05/13 20:30:11 matt Exp $ */
+/* $NetBSD: db_interface.c,v 1.64 2002/05/14 02:34:15 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
@@ -163,14 +164,14 @@
{ "o5", (long *)&DDB_TF->tf_out[5], FCN_NULL, },
{ "o6", (long *)&DDB_TF->tf_out[6], FCN_NULL, },
{ "o7", (long *)&DDB_TF->tf_out[7], FCN_NULL, },
- { "l0", (long *)&DDB_TF->tf_local[0], FCN_NULL, },
- { "l1", (long *)&DDB_TF->tf_local[1], FCN_NULL, },
- { "l2", (long *)&DDB_TF->tf_local[2], FCN_NULL, },
- { "l3", (long *)&DDB_TF->tf_local[3], FCN_NULL, },
- { "l4", (long *)&DDB_TF->tf_local[4], FCN_NULL, },
- { "l5", (long *)&DDB_TF->tf_local[5], FCN_NULL, },
- { "l6", (long *)&DDB_TF->tf_local[6], FCN_NULL, },
- { "l7", (long *)&DDB_TF->tf_local[7], FCN_NULL, },
+ { "l0", (long *)&DDB_FR->fr_local[0], FCN_NULL, },
+ { "l1", (long *)&DDB_FR->fr_local[1], FCN_NULL, },
+ { "l2", (long *)&DDB_FR->fr_local[2], FCN_NULL, },
+ { "l3", (long *)&DDB_FR->fr_local[3], FCN_NULL, },
+ { "l4", (long *)&DDB_FR->fr_local[4], FCN_NULL, },
+ { "l5", (long *)&DDB_FR->fr_local[5], FCN_NULL, },
+ { "l6", (long *)&DDB_FR->fr_local[6], FCN_NULL, },
+ { "l7", (long *)&DDB_FR->fr_local[7], FCN_NULL, },
{ "i0", (long *)&DDB_FR->fr_arg[0], FCN_NULL, },
{ "i1", (long *)&DDB_FR->fr_arg[1], FCN_NULL, },
{ "i2", (long *)&DDB_FR->fr_arg[2], FCN_NULL, },
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/sparc64/db_trace.c
--- a/sys/arch/sparc64/sparc64/db_trace.c Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/sparc64/db_trace.c Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: db_trace.c,v 1.23 2001/07/10 06:06:16 eeh Exp $ */
+/* $NetBSD: db_trace.c,v 1.24 2002/05/14 02:34:15 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
* Mach Operating System
* Copyright (c) 1991,1990 Carnegie Mellon University
* All Rights Reserved.
@@ -358,10 +359,9 @@
tf, (unsigned long long)tf->tf_tstate,
(unsigned long long)tf->tf_pc,
(unsigned long long)tf->tf_npc);
- db_printf("y: %x\tpil: %d\toldpil: %d\tfault: %llx\tkstack: %llx\ttt: %x\tGlobals:\n",
+ db_printf("y: %x\tpil: %d\toldpil: %d\tfault: %llx\ttt: %x\tGlobals:\n",
(int)tf->tf_y, (int)tf->tf_pil, (int)tf->tf_oldpil,
- (unsigned long long)tf->tf_fault,
- (unsigned long long)tf->tf_kstack, (int)tf->tf_tt);
+ (unsigned long long)tf->tf_fault, (int)tf->tf_tt);
db_printf("%016llx %016llx %016llx %016llx\n",
(unsigned long long)tf->tf_global[0],
(unsigned long long)tf->tf_global[1],
@@ -377,6 +377,7 @@
(unsigned long long)tf->tf_out[1],
(unsigned long long)tf->tf_out[2],
(unsigned long long)tf->tf_out[3]);
+#ifdef DEBUG
db_printf("%016llx %016llx %016llx %016llx\nlocals:\n",
(unsigned long long)tf->tf_out[4],
(unsigned long long)tf->tf_out[5],
@@ -402,6 +403,7 @@
(unsigned long long)tf->tf_in[5],
(unsigned long long)tf->tf_in[6],
(unsigned long long)tf->tf_in[7]);
+#endif
#if 0
if (tf == curproc->p_md.md_tf) {
struct rwindow32 *kstack = (struct rwindow32 *)(((caddr_t)tf)+CCFSZ);
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/sparc64/genassym.c
--- a/sys/arch/sparc64/sparc64/genassym.c Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/sparc64/genassym.c Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: genassym.c,v 1.22 2001/10/22 15:19:55 mrg Exp $ */
+/* $NetBSD: genassym.c,v 1.23 2002/05/14 02:34:15 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
*
@@ -196,20 +197,16 @@
off("TF_PC", struct trapframe64, tf_pc);
off("TF_NPC", struct trapframe64, tf_npc);
off("TF_FAULT", struct trapframe64, tf_fault);
- off("TF_KSTACK", struct trapframe64, tf_kstack);
off("TF_Y", struct trapframe64, tf_y);
off("TF_PIL", struct trapframe64, tf_pil);
off("TF_OLDPIL", struct trapframe64, tf_oldpil);
off("TF_TT", struct trapframe64, tf_tt);
off("TF_GLOBAL", struct trapframe64, tf_global);
off("TF_OUT", struct trapframe64, tf_out);
+#ifdef DEBUG
off("TF_LOCAL", struct trapframe64, tf_local);
off("TF_IN", struct trapframe64, tf_in);
- /* shortened versions */
- off("TF_G", struct trapframe64, tf_global);
- off("TF_O", struct trapframe64, tf_out);
- off("TF_L", struct trapframe64, tf_local);
- off("TF_I", struct trapframe64, tf_in);
+#endif
siz("TF_SIZE", struct trapframe64);
#if 0
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/sparc64/genassym.cf
--- a/sys/arch/sparc64/sparc64/genassym.cf Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/sparc64/genassym.cf Tue May 14 02:34:14 2002 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.25 2001/10/22 15:19:55 mrg Exp $
+# $NetBSD: genassym.cf,v 1.26 2002/05/14 02:34:15 eeh Exp $
#
# Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -198,20 +198,16 @@
define TF_PC offsetof(struct trapframe64, tf_pc)
define TF_NPC offsetof(struct trapframe64, tf_npc)
define TF_FAULT offsetof(struct trapframe64, tf_fault)
-define TF_KSTACK offsetof(struct trapframe64, tf_kstack)
define TF_Y offsetof(struct trapframe64, tf_y)
define TF_PIL offsetof(struct trapframe64, tf_pil)
define TF_OLDPIL offsetof(struct trapframe64, tf_oldpil)
define TF_TT offsetof(struct trapframe64, tf_tt)
define TF_GLOBAL offsetof(struct trapframe64, tf_global)
define TF_OUT offsetof(struct trapframe64, tf_out)
+ifdef DEBUG
define TF_LOCAL offsetof(struct trapframe64, tf_local)
define TF_IN offsetof(struct trapframe64, tf_in)
-# shortened versions
-define TF_G offsetof(struct trapframe64, tf_global)
-define TF_O offsetof(struct trapframe64, tf_out)
-define TF_L offsetof(struct trapframe64, tf_local)
-define TF_I offsetof(struct trapframe64, tf_in)
+endif
define TF_SIZE sizeof(struct trapframe64)
ifdef notyet
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/sparc64/trap.c
--- a/sys/arch/sparc64/sparc64/trap.c Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/sparc64/trap.c Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: trap.c,v 1.76 2002/02/14 07:08:16 chs Exp $ */
+/* $NetBSD: trap.c,v 1.77 2002/05/14 02:34:14 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
* Copyright (c) 1996
* The President and Fellows of Harvard College. All rights reserved.
* Copyright (c) 1992, 1993
@@ -389,9 +390,8 @@
printf("Trapframe %p:\ttstate: %lx\tpc: %lx\tnpc: %lx\n",
tf, (u_long)tf->tf_tstate, (u_long)tf->tf_pc, (u_long)tf->tf_npc);
- printf("fault: %p\tkstack: %p\ty: %x\t",
- (void *)(u_long)tf->tf_fault, (void *)(u_long)tf->tf_kstack,
- (int)tf->tf_y);
+ printf("fault: %p\ty: %x\t",
+ (void *)(u_long)tf->tf_fault, (int)tf->tf_y);
printf("pil: %d\toldpil: %d\ttt: %x\tGlobals:\n",
(int)tf->tf_pil, (int)tf->tf_oldpil, (int)tf->tf_tt);
printf("%08x%08x %08x%08x %08x%08x %08x%08x\n",
@@ -404,6 +404,7 @@
(u_int)(tf->tf_global[5]>>32), (u_int)tf->tf_global[5],
(u_int)(tf->tf_global[6]>>32), (u_int)tf->tf_global[6],
(u_int)(tf->tf_global[7]>>32), (u_int)tf->tf_global[7]);
+#ifdef DEBUG
printf("%08x%08x %08x%08x %08x%08x %08x%08x\n",
(u_int)(tf->tf_out[0]>>32), (u_int)tf->tf_out[0],
(u_int)(tf->tf_out[1]>>32), (u_int)tf->tf_out[1],
@@ -414,6 +415,7 @@
(u_int)(tf->tf_out[5]>>32), (u_int)tf->tf_out[5],
(u_int)(tf->tf_out[6]>>32), (u_int)tf->tf_out[6],
(u_int)(tf->tf_out[7]>>32), (u_int)tf->tf_out[7]);
+#endif
}
#endif
diff -r 1a5dad7f1ae9 -r 8d34484e26a2 sys/arch/sparc64/sparc64/vm_machdep.c
--- a/sys/arch/sparc64/sparc64/vm_machdep.c Tue May 14 02:23:07 2002 +0000
+++ b/sys/arch/sparc64/sparc64/vm_machdep.c Tue May 14 02:34:14 2002 +0000
@@ -1,6 +1,7 @@
-/* $NetBSD: vm_machdep.c,v 1.41 2001/09/10 21:19:27 chris Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.42 2002/05/14 02:34:15 eeh Exp $ */
/*
+ * Copyright (c) 1996-2002 Eduardo Horvath. All rights reserved.
* Copyright (c) 1996
* The President and Fellows of Harvard College. All rights reserved.
* Copyright (c) 1992, 1993
@@ -385,7 +386,52 @@
chdr->c_seghdrsize = ALIGN(sizeof(cseg));
chdr->c_cpusize = sizeof(md_core);
- md_core.md_tf = *p->p_md.md_tf;
+ /* Copy important fields over. */
+ md_core.md_tf.tf_tstate = p->p_md.md_tf->tf_tstate;
+ md_core.md_tf.tf_pc = p->p_md.md_tf->tf_pc;
+ md_core.md_tf.tf_npc = p->p_md.md_tf->tf_npc;
+ md_core.md_tf.tf_y = p->p_md.md_tf->tf_y;
+ md_core.md_tf.tf_tt = p->p_md.md_tf->tf_tt;
+ md_core.md_tf.tf_pil = p->p_md.md_tf->tf_pil;
+ md_core.md_tf.tf_oldpil = p->p_md.md_tf->tf_oldpil;
+
+ md_core.md_tf.tf_global[0] = p->p_md.md_tf->tf_global[0];
+ md_core.md_tf.tf_global[1] = p->p_md.md_tf->tf_global[1];
+ md_core.md_tf.tf_global[2] = p->p_md.md_tf->tf_global[2];
Home |
Main Index |
Thread Index |
Old Index