Module Name: src Committed By: matt Date: Mon Sep 7 21:54:39 UTC 2009
Modified Files: src/sys/arch/mips/mips [matt-nb5-mips64]: db_interface.c db_trace.c genassym.cf vm_machdep.c Log Message: Use the new symbolic constants for label_t. Use label_t where appropriate. Add some LP64 KASSERTs To generate a diff of this commit: cvs rdiff -u -r1.64.16.3 -r1.64.16.4 src/sys/arch/mips/mips/db_interface.c cvs rdiff -u -r1.35.38.2 -r1.35.38.3 src/sys/arch/mips/mips/db_trace.c cvs rdiff -u -r1.44.12.5 -r1.44.12.6 src/sys/arch/mips/mips/genassym.cf cvs rdiff -u -r1.121.6.1.2.3 -r1.121.6.1.2.4 \ src/sys/arch/mips/mips/vm_machdep.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/arch/mips/mips/db_interface.c diff -u src/sys/arch/mips/mips/db_interface.c:1.64.16.3 src/sys/arch/mips/mips/db_interface.c:1.64.16.4 --- src/sys/arch/mips/mips/db_interface.c:1.64.16.3 Sun Sep 6 23:01:59 2009 +++ src/sys/arch/mips/mips/db_interface.c Mon Sep 7 21:54:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.64.16.3 2009/09/06 23:01:59 matt Exp $ */ +/* $NetBSD: db_interface.c,v 1.64.16.4 2009/09/07 21:54:39 matt Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64.16.3 2009/09/06 23:01:59 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.64.16.4 2009/09/07 21:54:39 matt Exp $"); #include "opt_cputype.h" /* which mips CPUs do we support? */ #include "opt_ddb.h" @@ -62,7 +62,7 @@ int db_active = 0; db_regs_t ddb_regs; -mips_reg_t kdbaux[11]; /* XXX struct switchframe: better inside curpcb? XXX */ +label_t kdbaux; /* XXX struct switchframe: better inside curpcb? XXX */ void db_tlbdump_cmd(db_expr_t, bool, db_expr_t, const char *); void db_kvtophys_cmd(db_expr_t, bool, db_expr_t, const char *); @@ -201,17 +201,18 @@ tfp[TF_MULLO] = f->f_regs[_R_MULLO]; tfp[TF_MULHI] = f->f_regs[_R_MULHI]; tfp[TF_EPC] = f->f_regs[_R_PC]; - kdbaux[0] = f->f_regs[_R_S0]; - kdbaux[1] = f->f_regs[_R_S1]; - kdbaux[2] = f->f_regs[_R_S2]; - kdbaux[3] = f->f_regs[_R_S3]; - kdbaux[4] = f->f_regs[_R_S4]; - kdbaux[5] = f->f_regs[_R_S5]; - kdbaux[6] = f->f_regs[_R_S6]; - kdbaux[7] = f->f_regs[_R_S7]; - kdbaux[8] = f->f_regs[_R_SP]; - kdbaux[9] = f->f_regs[_R_S8]; - kdbaux[10] = f->f_regs[_R_GP]; + kdbaux.val[_L_S0] = f->f_regs[_R_S0]; + kdbaux.val[_L_S1] = f->f_regs[_R_S1]; + kdbaux.val[_L_S2] = f->f_regs[_R_S2]; + kdbaux.val[_L_S3] = f->f_regs[_R_S3]; + kdbaux.val[_L_S4] = f->f_regs[_R_S4]; + kdbaux.val[_L_S5] = f->f_regs[_R_S5]; + kdbaux.val[_L_S6] = f->f_regs[_R_S6]; + kdbaux.val[_L_S7] = f->f_regs[_R_S7]; + kdbaux.val[_L_GP] = f->f_regs[_R_GP]; + kdbaux.val[_L_SP] = f->f_regs[_R_SP]; + kdbaux.val[_L_S8] = f->f_regs[_R_S8]; + kdbaux.val[_L_SR] = f->f_regs[_R_SR]; } return (1); @@ -258,17 +259,17 @@ f->f_regs[_R_MULLO] = tfp[TF_MULLO]; f->f_regs[_R_MULHI] = tfp[TF_MULHI]; f->f_regs[_R_PC] = tfp[TF_EPC]; - f->f_regs[_R_S0] = kdbaux[0]; - f->f_regs[_R_S1] = kdbaux[1]; - f->f_regs[_R_S2] = kdbaux[2]; - f->f_regs[_R_S3] = kdbaux[3]; - f->f_regs[_R_S4] = kdbaux[4]; - f->f_regs[_R_S5] = kdbaux[5]; - f->f_regs[_R_S6] = kdbaux[6]; - f->f_regs[_R_S7] = kdbaux[7]; - f->f_regs[_R_SP] = kdbaux[8]; - f->f_regs[_R_S8] = kdbaux[9]; - f->f_regs[_R_GP] = kdbaux[10]; + f->f_regs[_R_S0] = kdbaux.val[_L_S0]; + f->f_regs[_R_S1] = kdbaux.val[_L_S1]; + f->f_regs[_R_S2] = kdbaux.val[_L_S2]; + f->f_regs[_R_S3] = kdbaux.val[_L_S3]; + f->f_regs[_R_S4] = kdbaux.val[_L_S4]; + f->f_regs[_R_S5] = kdbaux.val[_L_S5]; + f->f_regs[_R_S6] = kdbaux.val[_L_S6]; + f->f_regs[_R_S7] = kdbaux.val[_L_S7]; + f->f_regs[_R_GP] = kdbaux.val[_L_GP]; + f->f_regs[_R_SP] = kdbaux.val[_L_SP]; + f->f_regs[_R_S8] = kdbaux.val[_L_S8]; } } Index: src/sys/arch/mips/mips/db_trace.c diff -u src/sys/arch/mips/mips/db_trace.c:1.35.38.2 src/sys/arch/mips/mips/db_trace.c:1.35.38.3 --- src/sys/arch/mips/mips/db_trace.c:1.35.38.2 Sun Aug 23 04:38:34 2009 +++ src/sys/arch/mips/mips/db_trace.c Mon Sep 7 21:54:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: db_trace.c,v 1.35.38.2 2009/08/23 04:38:34 uebayasi Exp $ */ +/* $NetBSD: db_trace.c,v 1.35.38.3 2009/09/07 21:54:39 matt Exp $ */ /* * Mach Operating System @@ -27,7 +27,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35.38.2 2009/08/23 04:38:34 uebayasi Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_trace.c,v 1.35.38.3 2009/09/07 21:54:39 matt Exp $"); #include "opt_ddb.h" @@ -177,9 +177,9 @@ stacktrace_subr(0,0,0,0, /* no args known */ (vaddr_t)cpu_switchto, - pcb->pcb_context[8], - pcb->pcb_context[9], - pcb->pcb_context[10], + pcb->pcb_context.val[_L_SP], + pcb->pcb_context.val[_L_S8], + pcb->pcb_context.val[_L_RA], pr); #else /* Index: src/sys/arch/mips/mips/genassym.cf diff -u src/sys/arch/mips/mips/genassym.cf:1.44.12.5 src/sys/arch/mips/mips/genassym.cf:1.44.12.6 --- src/sys/arch/mips/mips/genassym.cf:1.44.12.5 Sun Sep 6 23:01:04 2009 +++ src/sys/arch/mips/mips/genassym.cf Mon Sep 7 21:54:39 2009 @@ -1,4 +1,4 @@ -# $NetBSD: genassym.cf,v 1.44.12.5 2009/09/06 23:01:04 matt Exp $ +# $NetBSD: genassym.cf,v 1.44.12.6 2009/09/07 21:54:39 matt Exp $ # # Copyright (c) 1992, 1993 # The Regents of the University of California. All rights reserved. @@ -118,6 +118,7 @@ define VM_MIN_ADDRESS VM_MIN_ADDRESS define VM_MIN_KERNEL_ADDRESS VM_MIN_KERNEL_ADDRESS +define VM_MAX_KERNEL_ADDRESS VM_MAX_KERNEL_ADDRESS define UVMEXP_SWTCH offsetof(struct uvmexp, swtch) @@ -291,19 +292,19 @@ define TF_PAD offsetof(struct trapframe, tf_pad) define CTXSWFRAME_SIZ sizeof(label_t) -define SF_REG_GP offsetof(label_t, val[12]) -define SF_REG_SR offsetof(label_t, val[11]) -define SF_REG_RA offsetof(label_t, val[10]) -define SF_REG_S0 offsetof(label_t, val[0]) -define SF_REG_S1 offsetof(label_t, val[1]) -define SF_REG_S2 offsetof(label_t, val[2]) -define SF_REG_S3 offsetof(label_t, val[3]) -define SF_REG_S4 offsetof(label_t, val[4]) -define SF_REG_S5 offsetof(label_t, val[5]) -define SF_REG_S6 offsetof(label_t, val[6]) -define SF_REG_S7 offsetof(label_t, val[7]) -define SF_REG_SP offsetof(label_t, val[8]) -define SF_REG_S8 offsetof(label_t, val[9]) +define SF_REG_S0 offsetof(label_t, val[_L_S0]) +define SF_REG_S1 offsetof(label_t, val[_L_S1]) +define SF_REG_S2 offsetof(label_t, val[_L_S2]) +define SF_REG_S3 offsetof(label_t, val[_L_S3]) +define SF_REG_S4 offsetof(label_t, val[_L_S4]) +define SF_REG_S5 offsetof(label_t, val[_L_S5]) +define SF_REG_S6 offsetof(label_t, val[_L_S6]) +define SF_REG_S7 offsetof(label_t, val[_L_S7]) +define SF_REG_GP offsetof(label_t, val[_L_GP]) +define SF_REG_SP offsetof(label_t, val[_L_SP]) +define SF_REG_S8 offsetof(label_t, val[_L_S8]) +define SF_REG_RA offsetof(label_t, val[_L_RA]) +define SF_REG_SR offsetof(label_t, val[_L_SR]) define MTX_OWNER offsetof(struct kmutex, mtx_owner) define MTX_LOCK offsetof(struct kmutex, mtx_lock) Index: src/sys/arch/mips/mips/vm_machdep.c diff -u src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.3 src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.4 --- src/sys/arch/mips/mips/vm_machdep.c:1.121.6.1.2.3 Sun Sep 6 22:57:11 2009 +++ src/sys/arch/mips/mips/vm_machdep.c Mon Sep 7 21:54:39 2009 @@ -1,4 +1,4 @@ -/* $NetBSD: vm_machdep.c,v 1.121.6.1.2.3 2009/09/06 22:57:11 matt Exp $ */ +/* $NetBSD: vm_machdep.c,v 1.121.6.1.2.4 2009/09/07 21:54:39 matt Exp $ */ /* * Copyright (c) 1992, 1993 @@ -80,7 +80,7 @@ #include "opt_coredump.h" #include <sys/cdefs.h> /* RCS ID & Copyright macro defns */ -__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.121.6.1.2.3 2009/09/06 22:57:11 matt Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vm_machdep.c,v 1.121.6.1.2.4 2009/09/07 21:54:39 matt Exp $"); #include <sys/param.h> #include <sys/systm.h> @@ -171,11 +171,14 @@ l2->l_md.md_upte[i] = pte[i].pt_entry &~ x; pcb = &l2->l_addr->u_pcb; - pcb->pcb_context[0] = (intptr_t)func; /* S0 */ - pcb->pcb_context[1] = (intptr_t)arg; /* S1 */ - pcb->pcb_context[MIPS_CURLWP_CARD - 16] = (intptr_t)l2;/* S? */ - pcb->pcb_context[8] = (intptr_t)f; /* SP */ - pcb->pcb_context[10] = (intptr_t)lwp_trampoline;/* RA */ + pcb->pcb_context.val[_L_S0] = (intptr_t)func; /* S0 */ + pcb->pcb_context.val[_L_S1] = (intptr_t)arg; /* S1 */ + pcb->pcb_context.val[MIPS_CURLWP_CARD - 16] = (intptr_t)l2; /* S? */ + pcb->pcb_context.val[_L_SP] = (intptr_t)f; /* SP */ + pcb->pcb_context.val[_L_RA] = (intptr_t)lwp_trampoline; /* RA */ +#ifdef _LP64 + KASSERT(pcb->pcb_context.val[_L_SR] & MIPS_SR_KX); +#endif #ifdef IPL_ICU_MASK pcb->pcb_ppl = 0; /* machine dependent interrupt mask */ #endif @@ -188,18 +191,19 @@ void cpu_setfunc(struct lwp *l, void (*func)(void *), void *arg) { - struct pcb *pcb; - struct frame *f; + struct pcb *pcb = &l->l_addr->u_pcb; + struct frame *f = l->l_md.md_regs; - f = (struct frame *)((char *)l->l_addr + USPACE) - 1; - KASSERT(l->l_md.md_regs == f); + KASSERT(f == (struct frame *)((char *)l->l_addr + USPACE) - 1); - pcb = &l->l_addr->u_pcb; - pcb->pcb_context[0] = (intptr_t)func; /* S0 */ - pcb->pcb_context[1] = (intptr_t)arg; /* S1 */ - pcb->pcb_context[MIPS_CURLWP_CARD - 16] = (intptr_t)l; /* S? */ - pcb->pcb_context[8] = (intptr_t)f; /* SP */ - pcb->pcb_context[10] = (intptr_t)setfunc_trampoline; /* RA */ + pcb->pcb_context.val[_L_S0] = (intptr_t)func; /* S0 */ + pcb->pcb_context.val[_L_S1] = (intptr_t)arg; /* S1 */ + pcb->pcb_context.val[MIPS_CURLWP_CARD - 16] = (intptr_t)l; /* S? */ + pcb->pcb_context.val[_L_SP] = (intptr_t)f; /* SP */ + pcb->pcb_context.val[_L_RA] = (intptr_t)setfunc_trampoline; /* RA */ +#ifdef _LP64 + KASSERT(pcb->pcb_context.val[_L_SR] & MIPS_SR_KX); +#endif #ifdef IPL_ICU_MASK pcb->pcb_ppl = 0; /* machine depenedend interrupt mask */ #endif