diff options
author | 2016-02-26 09:29:20 +0000 | |
---|---|---|
committer | 2016-02-26 09:29:20 +0000 | |
commit | 76c36b79aa5dcb71b1afca3631274db7fe0344dc (patch) | |
tree | f758b73307849f108d4178e6a654bdedbef4b495 /sys | |
parent | Remove stale RAIDframe entries from chrtoblktbl. (diff) | |
download | wireguard-openbsd-76c36b79aa5dcb71b1afca3631274db7fe0344dc.tar.xz wireguard-openbsd-76c36b79aa5dcb71b1afca3631274db7fe0344dc.zip |
Rename and move x86 calllframe definitions in <machine/frame.h> to use
it in MI code.
ok mlarkin@, visa@
Diffstat (limited to 'sys')
-rw-r--r-- | sys/arch/amd64/amd64/db_trace.c | 36 | ||||
-rw-r--r-- | sys/arch/amd64/include/frame.h | 8 | ||||
-rw-r--r-- | sys/arch/i386/i386/db_trace.c | 32 | ||||
-rw-r--r-- | sys/arch/i386/include/frame.h | 8 |
4 files changed, 42 insertions, 42 deletions
diff --git a/sys/arch/amd64/amd64/db_trace.c b/sys/arch/amd64/amd64/db_trace.c index ef8863443c6..7c86efe5edc 100644 --- a/sys/arch/amd64/amd64/db_trace.c +++ b/sys/arch/amd64/amd64/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.13 2015/06/28 01:16:28 guenther Exp $ */ +/* $OpenBSD: db_trace.c,v 1.14 2016/02/26 09:29:20 mpi Exp $ */ /* $NetBSD: db_trace.c,v 1.1 2003/04/26 18:39:27 fvdl Exp $ */ /* @@ -100,12 +100,6 @@ db_x86_64_regop(struct db_variable *vp, db_expr_t *val, int opcode) */ #define INKERNEL(va) (((vaddr_t)(va)) >= VM_MIN_KERNEL_ADDRESS) -struct x86_64_frame { - struct x86_64_frame *f_frame; - long f_retaddr; - long f_arg0; -}; - #define NONE 0 #define TRAP 1 #define SYSCALL 2 @@ -118,8 +112,8 @@ db_addr_t db_kdintr_symbol_value = 0; boolean_t db_trace_symbols_found = FALSE; void db_find_trace_symbols(void); -int db_numargs(struct x86_64_frame *); -void db_nextframe(struct x86_64_frame **, db_addr_t *, long *, int, +int db_numargs(struct callframe *); +void db_nextframe(struct callframe **, db_addr_t *, long *, int, int (*) (const char *, ...)); void @@ -143,7 +137,7 @@ db_find_trace_symbols(void) * reliably determine the values currently, just return 0. */ int -db_numargs(struct x86_64_frame *fp) +db_numargs(struct callframe *fp) { return 0; } @@ -159,7 +153,7 @@ db_numargs(struct x86_64_frame *fp) * of the function that faulted, but that could get hairy. */ void -db_nextframe(struct x86_64_frame **fp, db_addr_t *ip, long *argp, int is_trap, +db_nextframe(struct callframe **fp, db_addr_t *ip, long *argp, int is_trap, int (*pr)(const char *, ...)) { @@ -167,7 +161,7 @@ db_nextframe(struct x86_64_frame **fp, db_addr_t *ip, long *argp, int is_trap, case NONE: *ip = (db_addr_t) db_get_value((db_addr_t)&(*fp)->f_retaddr, 8, FALSE); - *fp = (struct x86_64_frame *) + *fp = (struct callframe *) db_get_value((db_addr_t)&(*fp)->f_frame, 8, FALSE); break; @@ -190,7 +184,7 @@ db_nextframe(struct x86_64_frame **fp, db_addr_t *ip, long *argp, int is_trap, (*pr)("--- interrupt ---\n"); break; } - *fp = (struct x86_64_frame *)tf->tf_rbp; + *fp = (struct callframe *)tf->tf_rbp; *ip = (db_addr_t)tf->tf_rip; break; } @@ -201,7 +195,7 @@ void db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif, int (*pr)(const char *, ...)) { - struct x86_64_frame *frame, *lastframe; + struct callframe *frame, *lastframe; long *argp; db_addr_t callpc; int is_trap = 0; @@ -226,7 +220,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, } if (!have_addr) { - frame = (struct x86_64_frame *)ddb_regs.tf_rbp; + frame = (struct callframe *)ddb_regs.tf_rbp; callpc = (db_addr_t)ddb_regs.tf_rip; } else { if (trace_proc) { @@ -235,13 +229,13 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, (*pr) ("db_trace.c: process not found\n"); return; } - frame = (struct x86_64_frame *)p->p_addr->u_pcb.pcb_rbp; + frame = (struct callframe *)p->p_addr->u_pcb.pcb_rbp; } else { - frame = (struct x86_64_frame *)addr; + frame = (struct callframe *)addr; } callpc = (db_addr_t) db_get_value((db_addr_t)&frame->f_retaddr, 8, FALSE); - frame = (struct x86_64_frame *)frame->f_frame; + frame = (struct callframe *)frame->f_frame; } lastframe = 0; @@ -304,7 +298,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, * We have a breakpoint before the frame is set up * Use %esp instead */ - argp = &((struct x86_64_frame *)(ddb_regs.tf_rsp-8))->f_arg0; + argp = &((struct callframe *)(ddb_regs.tf_rsp-8))->f_arg0; } else { argp = &frame->f_arg0; } @@ -323,7 +317,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, if (lastframe == 0 && offset == 0 && !have_addr) { /* Frame really belongs to next callpc */ - lastframe = (struct x86_64_frame *)(ddb_regs.tf_rsp-8); + lastframe = (struct callframe *)(ddb_regs.tf_rsp-8); callpc = (db_addr_t) db_get_value((db_addr_t)&lastframe->f_retaddr, 8, FALSE); @@ -337,7 +331,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, * back to just above lastframe so we can find the * trapframe as with syscalls and traps. */ - frame = (struct x86_64_frame *)&lastframe->f_retaddr; + frame = (struct callframe *)&lastframe->f_retaddr; } lastframe = frame; db_nextframe(&frame, &callpc, &frame->f_arg0, is_trap, pr); diff --git a/sys/arch/amd64/include/frame.h b/sys/arch/amd64/include/frame.h index dcf53bba447..e71d4093274 100644 --- a/sys/arch/amd64/include/frame.h +++ b/sys/arch/amd64/include/frame.h @@ -1,4 +1,4 @@ -/* $OpenBSD: frame.h,v 1.5 2011/03/23 16:54:34 pirofti Exp $ */ +/* $OpenBSD: frame.h,v 1.6 2016/02/26 09:29:20 mpi Exp $ */ /* $NetBSD: frame.h,v 1.1 2003/04/26 18:39:40 fvdl Exp $ */ /*- @@ -160,4 +160,10 @@ struct switchframe { int64_t sf_rip; }; +struct callframe { + struct callframe *f_frame; + long f_retaddr; + long f_arg0; +}; + #endif /* _MACHINE_FRAME_H_ */ diff --git a/sys/arch/i386/i386/db_trace.c b/sys/arch/i386/i386/db_trace.c index a8cf498e4cd..72d968afe57 100644 --- a/sys/arch/i386/i386/db_trace.c +++ b/sys/arch/i386/i386/db_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: db_trace.c,v 1.15 2015/06/28 01:11:27 guenther Exp $ */ +/* $OpenBSD: db_trace.c,v 1.16 2016/02/26 09:29:20 mpi Exp $ */ /* $NetBSD: db_trace.c,v 1.18 1996/05/03 19:42:01 christos Exp $ */ /* @@ -68,12 +68,6 @@ struct db_variable *db_eregs = db_regs + nitems(db_regs); */ #define INKERNEL(va) (((vaddr_t)(va)) >= VM_MIN_KERNEL_ADDRESS) -struct i386_frame { - struct i386_frame *f_frame; - int f_retaddr; - int f_arg0; -}; - #define NONE 0 #define TRAP 1 #define SYSCALL 2 @@ -86,8 +80,8 @@ db_addr_t db_kdintr_symbol_value = 0; boolean_t db_trace_symbols_found = FALSE; void db_find_trace_symbols(void); -int db_numargs(struct i386_frame *); -void db_nextframe(struct i386_frame **, db_addr_t *, int *, int, +int db_numargs(struct callframe *); +void db_nextframe(struct callframe **, db_addr_t *, int *, int, int (*pr)(const char *, ...)); void @@ -108,7 +102,7 @@ db_find_trace_symbols(void) * Figure out how many arguments were passed into the frame at "fp". */ int -db_numargs(struct i386_frame *fp) +db_numargs(struct callframe *fp) { int *argp; int inst; @@ -141,7 +135,7 @@ db_numargs(struct i386_frame *fp) * of the function that faulted, but that could get hairy. */ void -db_nextframe(struct i386_frame **fp, db_addr_t *ip, int *argp, int is_trap, +db_nextframe(struct callframe **fp, db_addr_t *ip, int *argp, int is_trap, int (*pr)(const char *, ...)) { @@ -149,7 +143,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, int *argp, int is_trap, case NONE: *ip = (db_addr_t) db_get_value((int) &(*fp)->f_retaddr, 4, FALSE); - *fp = (struct i386_frame *) + *fp = (struct callframe *) db_get_value((int) &(*fp)->f_frame, 4, FALSE); break; @@ -172,7 +166,7 @@ db_nextframe(struct i386_frame **fp, db_addr_t *ip, int *argp, int is_trap, (*pr)("--- interrupt ---\n"); break; } - *fp = (struct i386_frame *)tf->tf_ebp; + *fp = (struct callframe *)tf->tf_ebp; *ip = (db_addr_t)tf->tf_eip; break; } @@ -183,7 +177,7 @@ void db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, char *modif, int (*pr)(const char *, ...)) { - struct i386_frame *frame, *lastframe; + struct callframe *frame, *lastframe; int *argp; db_addr_t callpc; int is_trap = 0; @@ -214,7 +208,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, count = 65535; if (!have_addr) { - frame = (struct i386_frame *)ddb_regs.tf_ebp; + frame = (struct callframe *)ddb_regs.tf_ebp; callpc = (db_addr_t)ddb_regs.tf_eip; } else if (trace_thread) { (*pr) ("db_trace.c: can't trace thread\n"); @@ -224,11 +218,11 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, (*pr) ("db_trace.c: process not found\n"); return; } - frame = (struct i386_frame *)p->p_addr->u_pcb.pcb_ebp; + frame = (struct callframe *)p->p_addr->u_pcb.pcb_ebp; callpc = (db_addr_t) db_get_value((int)&frame->f_retaddr, 4, FALSE); } else { - frame = (struct i386_frame *)addr; + frame = (struct callframe *)addr; callpc = (db_addr_t) db_get_value((int)&frame->f_retaddr, 4, FALSE); } @@ -292,7 +286,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, * We have a breakpoint before the frame is set up * Use %esp instead */ - argp = &((struct i386_frame *)(ddb_regs.tf_esp-4))->f_arg0; + argp = &((struct callframe *)(ddb_regs.tf_esp-4))->f_arg0; } else { argp = &frame->f_arg0; } @@ -311,7 +305,7 @@ db_stack_trace_print(db_expr_t addr, boolean_t have_addr, db_expr_t count, if (lastframe == 0 && offset == 0 && !have_addr) { /* Frame really belongs to next callpc */ - lastframe = (struct i386_frame *)(ddb_regs.tf_esp-4); + lastframe = (struct callframe *)(ddb_regs.tf_esp-4); callpc = (db_addr_t) db_get_value((int)&lastframe->f_retaddr, 4, FALSE); continue; diff --git a/sys/arch/i386/include/frame.h b/sys/arch/i386/include/frame.h index a1bc4ceba8a..2220c30b7d3 100644 --- a/sys/arch/i386/include/frame.h +++ b/sys/arch/i386/include/frame.h @@ -1,4 +1,4 @@ -/* $OpenBSD: frame.h,v 1.10 2010/07/03 04:54:32 kettenis Exp $ */ +/* $OpenBSD: frame.h,v 1.11 2016/02/26 09:29:20 mpi Exp $ */ /* $NetBSD: frame.h,v 1.12 1995/10/11 04:20:08 mycroft Exp $ */ /*- @@ -112,6 +112,12 @@ struct switchframe { int sf_eip; }; +struct callframe { + struct callframe *f_frame; + int f_retaddr; + int f_arg0; +}; + /* * Signal frame */ |