Date: Wed, 12 Nov 2014 13:19:36 +0000 (UTC) From: Andrew Turner <andrew@FreeBSD.org> To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r274432 - projects/arm64/sys/arm64/arm64 Message-ID: <201411121319.sACDJaYR070508@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: andrew Date: Wed Nov 12 13:19:35 2014 New Revision: 274432 URL: https://svnweb.freebsd.org/changeset/base/274432 Log: Merge the common code to print registers. While here quieten the handlers to only print on interesting exceptions. Modified: projects/arm64/sys/arm64/arm64/trap.c Modified: projects/arm64/sys/arm64/arm64/trap.c ============================================================================== --- projects/arm64/sys/arm64/arm64/trap.c Wed Nov 12 13:19:30 2014 (r274431) +++ projects/arm64/sys/arm64/arm64/trap.c Wed Nov 12 13:19:35 2014 (r274432) @@ -158,12 +158,25 @@ data_abort(struct trapframe *frame, uint panic("vm_fault failed"); } +static void +print_registers(struct trapframe *frame) +{ + u_int reg; + + for (reg = 0; reg < 31; reg++) { + printf(" %sx%d: %llx\n", (reg < 10) ? " " : "", reg, frame->tf_x[reg]); + } + printf(" sp: %llx\n", frame->tf_sp); + printf(" lr: %llx\n", frame->tf_lr); + printf(" elr: %llx\n", frame->tf_elr); + printf("spsr: %llx\n", frame->tf_spsr); +} + void do_el1h_sync(struct trapframe *frame) { uint32_t exception; uint64_t esr; - u_int reg; /* Read the esr register to get the exception details */ __asm __volatile("mrs %x0, esr_el1" : "=&r"(esr)); @@ -172,15 +185,13 @@ do_el1h_sync(struct trapframe *frame) exception = (esr >> 26) & 0x3f; - printf("In do_el1h_sync %llx %llx %x\n", frame->tf_elr, esr, exception); - - for (reg = 0; reg < 31; reg++) { - printf(" %sx%d: %llx\n", (reg < 10) ? " " : "", reg, frame->tf_x[reg]); + if (0) { + printf("In do_el1h_sync\n"); + printf(" esr: %llx\n", esr); + printf("excp: %x\n", exception); + print_registers(frame); } - printf(" sp: %llx\n", frame->tf_sp); - printf(" lr: %llx\n", frame->tf_lr); - printf(" elr: %llx\n", frame->tf_elr); - printf("spsr: %llx\n", frame->tf_spsr); + switch(exception) { case 0x25: data_abort(frame, esr, 0); @@ -192,7 +203,6 @@ do_el1h_sync(struct trapframe *frame) default: panic("Unknown exception %x\n", exception); } - printf("Done do_el1h_sync\n"); } void @@ -200,19 +210,17 @@ do_el0_sync(struct trapframe *frame) { uint32_t exception; uint64_t esr; - u_int reg; __asm __volatile("mrs %x0, esr_el1" : "=&r"(esr)); exception = (esr >> 26) & 0x3f; - printf("In do_el0_sync %llx %llx %x\n", frame->tf_elr, esr, exception); - for (reg = 0; reg < 31; reg++) { - printf(" %sx%d: %llx\n", (reg < 10) ? " " : "", reg, frame->tf_x[reg]); + if (0) + { + printf("In do_el0_sync\n"); + printf(" esr: %llx\n", esr); + printf("excp: %x\n", exception); + print_registers(frame); } - printf(" sp: %llx\n", frame->tf_sp); - printf(" lr: %llx\n", frame->tf_lr); - printf(" elr: %llx\n", frame->tf_elr); - printf("spsr: %llx\n", frame->tf_spsr); switch(exception) { case 0x15:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201411121319.sACDJaYR070508>