Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch Don't define pcb_* register macros.
details: https://anonhg.NetBSD.org/src/rev/86141585285c
branches: trunk
changeset: 514709:86141585285c
user: toshii <toshii%NetBSD.org@localhost>
date: Sun Sep 09 10:33:42 2001 +0000
description:
Don't define pcb_* register macros.
pcb_sp macro conflicts with sys/netinet6/ipsec.c.
diffstat:
sys/arch/arm/arm/db_trace.c | 6 +-
sys/arch/arm/arm32/arm32_machdep.c | 10 +-
sys/arch/arm/arm32/db_trace.c | 149 +++++++++++++++++++++++++++++++++++++
sys/arch/arm/arm32/genassym.cf | 20 ++--
sys/arch/arm/arm32/vm_machdep.c | 12 +-
sys/arch/arm/include/pcb.h | 11 +--
sys/arch/evbarm/evbarm/genassym.cf | 20 ++--
sys/arch/hpcarm/hpcarm/genassym.cf | 20 ++--
8 files changed, 196 insertions(+), 52 deletions(-)
diffs (truncated from 374 to 300 lines):
diff -r ac662c87fa2f -r 86141585285c sys/arch/arm/arm/db_trace.c
--- a/sys/arch/arm/arm/db_trace.c Sun Sep 09 10:33:28 2001 +0000
+++ b/sys/arch/arm/arm/db_trace.c Sun Sep 09 10:33:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: db_trace.c,v 1.1 2001/06/05 09:25:05 bjh21 Exp $ */
+/* $NetBSD: db_trace.c,v 1.2 2001/09/09 10:33:42 toshii Exp $ */
/*
* Copyright (c) 2000, 2001 Ben Harris
@@ -31,7 +31,7 @@
#include <sys/param.h>
-__RCSID("$NetBSD: db_trace.c,v 1.1 2001/06/05 09:25:05 bjh21 Exp $");
+__RCSID("$NetBSD: db_trace.c,v 1.2 2001/09/09 10:33:42 toshii Exp $");
#include <sys/proc.h>
#include <sys/user.h>
@@ -122,7 +122,7 @@
#ifdef arm26
frame = (u_int32_t *)(u->u_pcb.pcb_sf->sf_r11);
#else
- frame = (u_int32_t *)(u->u_pcb.pcb_r11);
+ frame = (u_int32_t *)(u->u_pcb.pcb_un.un_32.pcb32_r11);
#endif
(*pr)("at %p\n", frame);
} else
diff -r ac662c87fa2f -r 86141585285c sys/arch/arm/arm32/arm32_machdep.c
--- a/sys/arch/arm/arm32/arm32_machdep.c Sun Sep 09 10:33:28 2001 +0000
+++ b/sys/arch/arm/arm32/arm32_machdep.c Sun Sep 09 10:33:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: arm32_machdep.c,v 1.3 2001/08/11 13:00:48 chris Exp $ */
+/* $NetBSD: arm32_machdep.c,v 1.4 2001/09/09 10:33:43 toshii Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -449,12 +449,14 @@
curpcb = &proc0.p_addr->u_pcb;
curpcb->pcb_flags = 0;
- curpcb->pcb_und_sp = (u_int)proc0.p_addr + USPACE_UNDEF_STACK_TOP;
- curpcb->pcb_sp = (u_int)proc0.p_addr + USPACE_SVC_STACK_TOP;
+ curpcb->pcb_un.un_32.pcb32_und_sp = (u_int)proc0.p_addr +
+ USPACE_UNDEF_STACK_TOP;
+ curpcb->pcb_un.un_32.pcb32_sp = (u_int)proc0.p_addr +
+ USPACE_SVC_STACK_TOP;
(void) pmap_extract(pmap_kernel(), (vaddr_t)(pmap_kernel())->pm_pdir,
(paddr_t *)&curpcb->pcb_pagedir);
- curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_sp - 1;
+ curpcb->pcb_tf = (struct trapframe *)curpcb->pcb_un.un_32.pcb32_sp - 1;
}
/*
diff -r ac662c87fa2f -r 86141585285c sys/arch/arm/arm32/db_trace.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sys/arch/arm/arm32/db_trace.c Sun Sep 09 10:33:42 2001 +0000
@@ -0,0 +1,149 @@
+/* $NetBSD: db_trace.c,v 1.3 2001/09/09 10:33:43 toshii Exp $ */
+
+/*
+ * Copyright (c) 1996 Scott K. Stevens
+ *
+ * Mach Operating System
+ * Copyright (c) 1991,1990 Carnegie Mellon University
+ * All Rights Reserved.
+ *
+ * Permission to use, copy, modify and distribute this software and its
+ * documentation is hereby granted, provided that both the copyright
+ * notice and this permission notice appear in all copies of the
+ * software, derivative works or modified versions, and any portions
+ * thereof, and that both notices appear in supporting documentation.
+ *
+ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
+ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
+ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
+ *
+ * Carnegie Mellon requests users of this software to return to
+ *
+ * Software Distribution Coordinator or Software.Distribution%CS.CMU.EDU@localhost
+ * School of Computer Science
+ * Carnegie Mellon University
+ * Pittsburgh PA 15213-3890
+ *
+ * any improvements or extensions that they make and grant Carnegie the
+ * rights to redistribute these changes.
+ */
+
+#include <sys/param.h>
+#include <sys/proc.h>
+#include <sys/user.h>
+#include <machine/db_machdep.h>
+
+#include <ddb/db_access.h>
+#include <ddb/db_sym.h>
+#include <ddb/db_output.h>
+
+#define INKERNEL(va) (((vm_offset_t)(va)) >= VM_MIN_KERNEL_ADDRESS)
+
+void
+db_stack_trace_print(addr, have_addr, count, modif, pr)
+ db_expr_t addr;
+ int have_addr;
+ db_expr_t count;
+ char *modif;
+ void (*pr) __P((const char *, ...));
+{
+ struct frame *frame, *lastframe;
+ char c, *cp = modif;
+ boolean_t kernel_only = TRUE;
+ boolean_t trace_thread = FALSE;
+
+ while ((c = *cp++) != 0) {
+ if (c == 'u')
+ kernel_only = FALSE;
+ if (c == 't')
+ trace_thread = TRUE;
+ }
+
+ /*
+ * The frame pointer points to the top word of the stack frame so we
+ * need to adjust it by sizeof(struct frame) - sizeof(u_int))
+ * to get the address of the start of the frame structure.
+ */
+
+ if (!have_addr)
+ frame = (struct frame *)(DDB_REGS->tf_r11
+ - (sizeof(struct frame) - sizeof(u_int)));
+ else {
+ if (trace_thread) {
+ struct proc *p;
+ struct user *u;
+ (*pr)("trace: pid %d ", (int)addr);
+ p = pfind(addr);
+ if (p == NULL) {
+ (*pr)("not found\n");
+ return;
+ }
+ if (!(p->p_flag & P_INMEM)) {
+ (*pr)("swapped out\n");
+ return;
+ }
+ u = p->p_addr;
+ frame = (struct frame *) (u->u_pcb.pcb_r11
+ - (sizeof(struct frame) - sizeof(u_int)));
+ (*pr)("at %p\n", frame);
+ } else
+ frame = (struct frame *)(addr - (sizeof(struct frame)
+ - sizeof(u_int)));
+ }
+ lastframe = NULL;
+
+ while (count--) {
+ db_expr_t offset;
+ char *name;
+ db_addr_t pc;
+
+/* (*pr)("fp=%08x: fp=%08x sp=%08x lr=%08x pc=%08x\n",
+ (u_int)frame, frame->fr_fp, frame->fr_sp, frame->fr_lr,
+ frame->fr_pc);*/
+
+ pc = frame->fr_pc;
+ /* Adjust the PC so the same address is printed no matter what CPU */
+ if (cputype == CPU_ID_SA110 || cputype == CPU_ID_ARM810)
+ pc += 4;
+ if (!INKERNEL(pc))
+ break;
+
+ db_find_sym_and_offset(pc, &name, &offset);
+ if (name == NULL)
+ name = "?";
+
+ (*pr)("%s(", name);
+ db_printsym(pc, DB_STGY_PROC, pr);
+ (*pr)(")");
+ (*pr)("\n");
+
+ /*
+ * Switch to next frame up
+ */
+ lastframe = frame;
+ if (frame->fr_fp == NULL)
+ break;
+
+ frame = (struct frame *)(frame->fr_fp - (sizeof(struct frame)
+ - sizeof(u_int)));
+
+ if (INKERNEL((int)frame)) {
+ /* staying in kernel */
+ if (frame <= lastframe) {
+ (*pr)("Bad frame pointer: %p\n", frame);
+ break;
+ }
+ } else if (INKERNEL((int)lastframe)) {
+ /* switch from user to kernel */
+ if (kernel_only)
+ break; /* kernel stack only */
+ } else {
+ /* in user */
+ if (frame <= lastframe) {
+ (*pr)("Bad user frame pointer: %p\n",
+ frame);
+ break;
+ }
+ }
+ }
+}
diff -r ac662c87fa2f -r 86141585285c sys/arch/arm/arm32/genassym.cf
--- a/sys/arch/arm/arm32/genassym.cf Sun Sep 09 10:33:28 2001 +0000
+++ b/sys/arch/arm/arm32/genassym.cf Sun Sep 09 10:33:42 2001 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: genassym.cf,v 1.4 2001/09/05 17:08:41 matt Exp $
+# $NetBSD: genassym.cf,v 1.5 2001/09/09 10:33:43 toshii Exp $
# Copyright (c) 1982, 1990 The Regents of the University of California.
# All rights reserved.
@@ -76,15 +76,15 @@
define PCB_PAGEDIR offsetof(struct pcb, pcb_pagedir)
define PCB_FLAGS offsetof(struct pcb, pcb_flags)
-define PCB_R8 offsetof(struct pcb, pcb_r8)
-define PCB_R9 offsetof(struct pcb, pcb_r9)
-define PCB_R10 offsetof(struct pcb, pcb_r10)
-define PCB_R11 offsetof(struct pcb, pcb_r11)
-define PCB_R12 offsetof(struct pcb, pcb_r12)
-define PCB_SP offsetof(struct pcb, pcb_sp)
-define PCB_LR offsetof(struct pcb, pcb_lr)
-define PCB_PC offsetof(struct pcb, pcb_pc)
-define PCB_UND_SP offsetof(struct pcb, pcb_und_sp)
+define PCB_R8 offsetof(struct pcb, pcb_un.un_32.pcb32_r8)
+define PCB_R9 offsetof(struct pcb, pcb_un.un_32.pcb32_r9)
+define PCB_R10 offsetof(struct pcb, pcb_un.un_32.pcb32_r10)
+define PCB_R11 offsetof(struct pcb, pcb_un.un_32.pcb32_r11)
+define PCB_R12 offsetof(struct pcb, pcb_un.un_32.pcb32_r12)
+define PCB_SP offsetof(struct pcb, pcb_un.un_32.pcb32_sp)
+define PCB_LR offsetof(struct pcb, pcb_un.un_32.pcb32_lr)
+define PCB_PC offsetof(struct pcb, pcb_un.un_32.pcb32_pc)
+define PCB_UND_SP offsetof(struct pcb, pcb_un.un_32.pcb32_und_sp)
define PCB_ONFAULT offsetof(struct pcb, pcb_onfault)
define USER_SIZE sizeof(struct user)
diff -r ac662c87fa2f -r 86141585285c sys/arch/arm/arm32/vm_machdep.c
--- a/sys/arch/arm/arm32/vm_machdep.c Sun Sep 09 10:33:28 2001 +0000
+++ b/sys/arch/arm/arm32/vm_machdep.c Sun Sep 09 10:33:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: vm_machdep.c,v 1.4 2001/08/20 21:52:09 chris Exp $ */
+/* $NetBSD: vm_machdep.c,v 1.5 2001/09/09 10:33:43 toshii Exp $ */
/*
* Copyright (c) 1994-1998 Mark Brinicombe.
@@ -133,8 +133,9 @@
* Set up the undefined stack for the process.
* Note: this stack is not in use if we are forking from p1
*/
- pcb->pcb_und_sp = (u_int)p2->p_addr + USPACE_UNDEF_STACK_TOP;
- pcb->pcb_sp = (u_int)p2->p_addr + USPACE_SVC_STACK_TOP;
+ pcb->pcb_un.un_32.pcb32_und_sp = (u_int)p2->p_addr +
+ USPACE_UNDEF_STACK_TOP;
+ pcb->pcb_un.un_32.pcb32_sp = (u_int)p2->p_addr + USPACE_SVC_STACK_TOP;
#ifdef STACKCHECKS
/* Fill the undefined stack with a known pattern */
@@ -164,7 +165,8 @@
arm_fpe_copycontext(FP_CONTEXT(p1), FP_CONTEXT(p2));
#endif /* ARMFPE */
- p2->p_addr->u_pcb.pcb_tf = tf = (struct trapframe *)pcb->pcb_sp - 1;
+ p2->p_addr->u_pcb.pcb_tf = tf =
+ (struct trapframe *)pcb->pcb_un.un_32.pcb32_sp - 1;
*tf = *p1->p_addr->u_pcb.pcb_tf;
/*
@@ -178,7 +180,7 @@
sf->sf_r4 = (u_int)func;
sf->sf_r5 = (u_int)arg;
sf->sf_pc = (u_int)proc_trampoline;
- pcb->pcb_sp = (u_int)sf;
+ pcb->pcb_un.un_32.pcb32_sp = (u_int)sf;
}
/*
diff -r ac662c87fa2f -r 86141585285c sys/arch/arm/include/pcb.h
--- a/sys/arch/arm/include/pcb.h Sun Sep 09 10:33:28 2001 +0000
+++ b/sys/arch/arm/include/pcb.h Sun Sep 09 10:33:42 2001 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pcb.h,v 1.1 2001/09/03 19:20:27 matt Exp $ */
+/* $NetBSD: pcb.h,v 1.2 2001/09/09 10:33:43 toshii Exp $ */
/*
* Copyright (c) 2001 Matt Thomas <matt%3am-software.com@localhost>.
@@ -55,15 +55,6 @@
u_int pcb32_und_sp;
};
#define pcb_pagedir pcb_un.un_32.pcb32_pagedir
-#define pcb_r8 pcb_un.un_32.pcb32_r8
-#define pcb_r9 pcb_un.un_32.pcb32_r9
-#define pcb_r10 pcb_un.un_32.pcb32_r10
-#define pcb_r11 pcb_un.un_32.pcb32_r11
-#define pcb_r12 pcb_un.un_32.pcb32_r12
-#define pcb_sp pcb_un.un_32.pcb32_sp
Home |
Main Index |
Thread Index |
Old Index