Module Name: src Committed By: christos Date: Thu Feb 16 02:33:38 UTC 2012
Modified Files: src/sys/arch/arm/arm32: db_interface.c db_machdep.c Log Message: move stuff between the two files, so db_interface contains the functions it needs for userland programs to link. To generate a diff of this commit: cvs rdiff -u -r1.48 -r1.49 src/sys/arch/arm/arm32/db_interface.c cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/arm32/db_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/arm/arm32/db_interface.c diff -u src/sys/arch/arm/arm32/db_interface.c:1.48 src/sys/arch/arm/arm32/db_interface.c:1.49 --- src/sys/arch/arm/arm32/db_interface.c:1.48 Wed Jun 16 18:06:53 2010 +++ src/sys/arch/arm/arm32/db_interface.c Wed Feb 15 21:33:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: db_interface.c,v 1.48 2010/06/16 22:06:53 jmcneill Exp $ */ +/* $NetBSD: db_interface.c,v 1.49 2012/02/16 02:33:37 christos Exp $ */ /* * Copyright (c) 1996 Scott K. Stevens @@ -35,7 +35,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.48 2010/06/16 22:06:53 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.49 2012/02/16 02:33:37 christos Exp $"); #include "opt_ddb.h" #include "opt_kgdb.h" @@ -64,71 +64,13 @@ __KERNEL_RCSID(0, "$NetBSD: db_interface #define db_printf printf #endif -static long nil; - -int db_access_und_sp(const struct db_variable *, db_expr_t *, int); -int db_access_abt_sp(const struct db_variable *, db_expr_t *, int); -int db_access_irq_sp(const struct db_variable *, db_expr_t *, int); u_int db_fetch_reg(int, db_regs_t *); int db_trapper(u_int, u_int, trapframe_t *, int); -const struct db_variable db_regs[] = { - { "spsr", (long *)&DDB_REGS->tf_spsr, FCN_NULL, }, - { "r0", (long *)&DDB_REGS->tf_r0, FCN_NULL, }, - { "r1", (long *)&DDB_REGS->tf_r1, FCN_NULL, }, - { "r2", (long *)&DDB_REGS->tf_r2, FCN_NULL, }, - { "r3", (long *)&DDB_REGS->tf_r3, FCN_NULL, }, - { "r4", (long *)&DDB_REGS->tf_r4, FCN_NULL, }, - { "r5", (long *)&DDB_REGS->tf_r5, FCN_NULL, }, - { "r6", (long *)&DDB_REGS->tf_r6, FCN_NULL, }, - { "r7", (long *)&DDB_REGS->tf_r7, FCN_NULL, }, - { "r8", (long *)&DDB_REGS->tf_r8, FCN_NULL, }, - { "r9", (long *)&DDB_REGS->tf_r9, FCN_NULL, }, - { "r10", (long *)&DDB_REGS->tf_r10, FCN_NULL, }, - { "r11", (long *)&DDB_REGS->tf_r11, FCN_NULL, }, - { "r12", (long *)&DDB_REGS->tf_r12, FCN_NULL, }, - { "usr_sp", (long *)&DDB_REGS->tf_usr_sp, FCN_NULL, }, - { "usr_lr", (long *)&DDB_REGS->tf_usr_lr, FCN_NULL, }, - { "svc_sp", (long *)&DDB_REGS->tf_svc_sp, FCN_NULL, }, - { "svc_lr", (long *)&DDB_REGS->tf_svc_lr, FCN_NULL, }, - { "pc", (long *)&DDB_REGS->tf_pc, FCN_NULL, }, - { "und_sp", &nil, db_access_und_sp, }, - { "abt_sp", &nil, db_access_abt_sp, }, - { "irq_sp", &nil, db_access_irq_sp, }, -}; - -const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); - int db_active = 0; db_regs_t ddb_regs; /* register state */ -int -db_access_und_sp(const struct db_variable *vp, db_expr_t *valp, int rw) -{ - - if (rw == DB_VAR_GET) - *valp = get_stackptr(PSR_UND32_MODE); - return(0); -} - -int -db_access_abt_sp(const struct db_variable *vp, db_expr_t *valp, int rw) -{ - - if (rw == DB_VAR_GET) - *valp = get_stackptr(PSR_ABT32_MODE); - return(0); -} - -int -db_access_irq_sp(const struct db_variable *vp, db_expr_t *valp, int rw) -{ - - if (rw == DB_VAR_GET) - *valp = get_stackptr(PSR_IRQ32_MODE); - return(0); -} #ifdef DDB /* @@ -361,20 +303,6 @@ cpu_Debugger(void) __asm(".word 0xe7ffffff"); } -const struct db_command db_machine_command_table[] = { - { DDB_ADD_CMD("frame", db_show_frame_cmd, 0, - "Displays the contents of a trapframe", - "[address]", - " address:\taddress of trapfame to display")}, - { DDB_ADD_CMD("panic", db_show_panic_cmd, 0, - "Displays the last panic string", - NULL,NULL) }, -#ifdef ARM32_DB_COMMANDS - ARM32_DB_COMMANDS, -#endif - { DDB_ADD_CMD(NULL, NULL, 0,NULL,NULL,NULL) } -}; - int db_trapper(u_int addr, u_int inst, trapframe_t *frame, int fault_code) { Index: src/sys/arch/arm/arm32/db_machdep.c diff -u src/sys/arch/arm/arm32/db_machdep.c:1.12 src/sys/arch/arm/arm32/db_machdep.c:1.13 --- src/sys/arch/arm/arm32/db_machdep.c:1.12 Sat Mar 14 11:36:01 2009 +++ src/sys/arch/arm/arm32/db_machdep.c Wed Feb 15 21:33:37 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: db_machdep.c,v 1.12 2009/03/14 15:36:01 dsl Exp $ */ +/* $NetBSD: db_machdep.c,v 1.13 2012/02/16 02:33:37 christos Exp $ */ /* * Copyright (c) 1996 Mark Brinicombe @@ -29,7 +29,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.12 2009/03/14 15:36:01 dsl Exp $"); +__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.13 2012/02/16 02:33:37 christos Exp $"); #include <sys/param.h> #include <sys/proc.h> @@ -37,23 +37,101 @@ __KERNEL_RCSID(0, "$NetBSD: db_machdep.c #include <sys/systm.h> #include <arm/arm32/db_machdep.h> +#include <arm/cpufunc.h> #include <ddb/db_access.h> #include <ddb/db_sym.h> #include <ddb/db_output.h> +#include <ddb/db_variables.h> +#include <ddb/db_command.h> +static long nil; +int db_access_und_sp(const struct db_variable *, db_expr_t *, int); +int db_access_abt_sp(const struct db_variable *, db_expr_t *, int); +int db_access_irq_sp(const struct db_variable *, db_expr_t *, int); + +const struct db_variable db_regs[] = { + { "spsr", (long *)&DDB_REGS->tf_spsr, FCN_NULL, NULL }, + { "r0", (long *)&DDB_REGS->tf_r0, FCN_NULL, NULL }, + { "r1", (long *)&DDB_REGS->tf_r1, FCN_NULL, NULL }, + { "r2", (long *)&DDB_REGS->tf_r2, FCN_NULL, NULL }, + { "r3", (long *)&DDB_REGS->tf_r3, FCN_NULL, NULL }, + { "r4", (long *)&DDB_REGS->tf_r4, FCN_NULL, NULL }, + { "r5", (long *)&DDB_REGS->tf_r5, FCN_NULL, NULL }, + { "r6", (long *)&DDB_REGS->tf_r6, FCN_NULL, NULL }, + { "r7", (long *)&DDB_REGS->tf_r7, FCN_NULL, NULL }, + { "r8", (long *)&DDB_REGS->tf_r8, FCN_NULL, NULL }, + { "r9", (long *)&DDB_REGS->tf_r9, FCN_NULL, NULL }, + { "r10", (long *)&DDB_REGS->tf_r10, FCN_NULL, NULL }, + { "r11", (long *)&DDB_REGS->tf_r11, FCN_NULL, NULL }, + { "r12", (long *)&DDB_REGS->tf_r12, FCN_NULL, NULL }, + { "usr_sp", (long *)&DDB_REGS->tf_usr_sp, FCN_NULL, NULL }, + { "usr_lr", (long *)&DDB_REGS->tf_usr_lr, FCN_NULL, NULL }, + { "svc_sp", (long *)&DDB_REGS->tf_svc_sp, FCN_NULL, NULL }, + { "svc_lr", (long *)&DDB_REGS->tf_svc_lr, FCN_NULL, NULL }, + { "pc", (long *)&DDB_REGS->tf_pc, FCN_NULL, NULL }, + { "und_sp", &nil, db_access_und_sp, NULL }, + { "abt_sp", &nil, db_access_abt_sp, NULL }, + { "irq_sp", &nil, db_access_irq_sp, NULL }, +}; + +const struct db_variable * const db_eregs = db_regs + sizeof(db_regs)/sizeof(db_regs[0]); + +const struct db_command db_machine_command_table[] = { + { DDB_ADD_CMD("frame", db_show_frame_cmd, 0, + "Displays the contents of a trapframe", + "[address]", + " address:\taddress of trapfame to display")}, +#ifdef _KERNEL + { DDB_ADD_CMD("panic", db_show_panic_cmd, 0, + "Displays the last panic string", + NULL,NULL) }, +#endif +#ifdef ARM32_DB_COMMANDS + ARM32_DB_COMMANDS, +#endif + { DDB_ADD_CMD(NULL, NULL, 0,NULL,NULL,NULL) } +}; + +int +db_access_und_sp(const struct db_variable *vp, db_expr_t *valp, int rw) +{ + + if (rw == DB_VAR_GET) + *valp = get_stackptr(PSR_UND32_MODE); + return(0); +} + +int +db_access_abt_sp(const struct db_variable *vp, db_expr_t *valp, int rw) +{ + + if (rw == DB_VAR_GET) + *valp = get_stackptr(PSR_ABT32_MODE); + return(0); +} + +int +db_access_irq_sp(const struct db_variable *vp, db_expr_t *valp, int rw) +{ + + if (rw == DB_VAR_GET) + *valp = get_stackptr(PSR_IRQ32_MODE); + return(0); +} + +#ifdef _KERNEL void db_show_panic_cmd(db_expr_t addr, bool have_addr, db_expr_t count, const char *modif) { int s; - s = splhigh(); db_printf("Panic string: %s\n", panicstr); - (void)splx(s); } +#endif void