linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <michael@ellerman.id.au>
To: <linuxppc-dev@ozlabs.org>
Cc: Paul Mackerras <paulus@samba.org>, Anton Blanchard <anton@samba.org>
Subject: [PATCH 13/20] powerpc/xmon: Use start/end_bus_error_jump() in more routines
Date: Wed, 10 Oct 2012 01:20:40 +1100	[thread overview]
Message-ID: <1349792447-15714-13-git-send-email-michael@ellerman.id.au> (raw)
In-Reply-To: <1349792447-15714-1-git-send-email-michael@ellerman.id.au>

These are not entirely equivalent to the old code. In most cases they
just gain a call to __delay() via end_bus_error_jump().

In symbol_lookup() we also move the printf() outside the protected area,
this should be safe as we are not derefencing the value we lookup, just
printing its value.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
---
 arch/powerpc/xmon/xmon.c |   39 +++++++++++++--------------------------
 1 file changed, 13 insertions(+), 26 deletions(-)

diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 45be9ce..ddae5cf 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -1321,17 +1321,16 @@ static void get_function_bounds(unsigned long pc, unsigned long *startp,
 	*startp = *endp = 0;
 	if (pc == 0)
 		return;
-	if (setjmp(bus_error_jmp) == 0) {
-		catch_memory_errors = 1;
-		sync();
+
+	if (start_bus_error_jump() == 0) {
 		name = kallsyms_lookup(pc, &size, &offset, NULL, tmpstr);
 		if (name != NULL) {
 			*startp = pc - offset;
 			*endp = pc - offset + size;
 		}
-		sync();
+
+		end_bus_error_jump();
 	}
-	catch_memory_errors = 0;
 }
 
 #define LRSAVE_OFFSET		(STACK_FRAME_LR_SAVE * sizeof(unsigned long))
@@ -2016,14 +2015,11 @@ static void dump_one_paca(int cpu)
 {
 	struct paca_struct *p;
 
-	if (setjmp(bus_error_jmp) != 0) {
+	if (start_bus_error_jump() != 0) {
 		printf("*** Error dumping paca for cpu 0x%x!\n", cpu);
 		return;
 	}
 
-	catch_memory_errors = 1;
-	sync();
-
 	p = &paca[cpu];
 
 	printf("paca for cpu 0x%x @ %p:\n", cpu, p);
@@ -2063,8 +2059,7 @@ static void dump_one_paca(int cpu)
 
 #undef DUMP
 
-	catch_memory_errors = 0;
-	sync();
+	end_bus_error_jump();
 }
 
 static void dump_all_pacas(void)
@@ -2402,17 +2397,14 @@ static void proccall(void)
 	}
 	func = (callfunc_t) adrs;
 	ret = 0;
-	if (setjmp(bus_error_jmp) == 0) {
-		catch_memory_errors = 1;
-		sync();
+	if (start_bus_error_jump() == 0) {
 		ret = func(args[0], args[1], args[2], args[3],
 			   args[4], args[5], args[6], args[7]);
-		sync();
+		end_bus_error_jump();
 		printf("return value is %x\n", ret);
 	} else {
 		printf("*** %x exception occurred\n", fault_except);
 	}
-	catch_memory_errors = 0;
 }
 
 /* Input scanning routines */
@@ -2507,13 +2499,10 @@ scanhex(unsigned long *vp)
 		}
 		tmpstr[i++] = 0;
 		*vp = 0;
-		if (setjmp(bus_error_jmp) == 0) {
-			catch_memory_errors = 1;
-			sync();
+		if (start_bus_error_jump() == 0) {
 			*vp = kallsyms_lookup_name(tmpstr);
-			sync();
+			end_bus_error_jump();
 		}
-		catch_memory_errors = 0;
 		if (!(*vp)) {
 			printf("unknown symbol '%s'\n", tmpstr);
 			return 0;
@@ -2620,17 +2609,15 @@ symbol_lookup(void)
 		break;
 	case 's':
 		getstring(tmp, 64);
-		if (setjmp(bus_error_jmp) == 0) {
-			catch_memory_errors = 1;
-			sync();
+		if (start_bus_error_jump() == 0) {
 			addr = kallsyms_lookup_name(tmp);
+			end_bus_error_jump();
+
 			if (addr)
 				printf("%s: %lx\n", tmp, addr);
 			else
 				printf("Symbol '%s' not found.\n", tmp);
-			sync();
 		}
-		catch_memory_errors = 0;
 		termch = 0;
 		break;
 	}
-- 
1.7.9.5

  parent reply	other threads:[~2012-10-09 14:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-09 14:20 [PATCH 01/20] powerpc/udbg: Remove unused udbg_read() Michael Ellerman
2012-10-09 14:20 ` [PATCH 02/20] powerpc/xmon: Remove unused xmon_expect() & xmon_read_poll() Michael Ellerman
2012-10-09 14:20 ` [PATCH 03/20] powerpc/xmon: Remove empty xmon_map_scc() Michael Ellerman
2012-10-09 14:20 ` [PATCH 04/20] powerpc/xmon: Make xmon_getchar() static Michael Ellerman
2012-10-09 14:20 ` [PATCH 05/20] powerpc/xmon: Merge start.c into nonstdio.c Michael Ellerman
2012-10-09 14:20 ` [PATCH 06/20] powerpc/xmon: Remove renaming #defines of scanhex() and skipbl() Michael Ellerman
2012-10-09 14:59   ` David Laight
2012-10-09 22:15   ` Paul Mackerras
2012-10-10  1:00     ` Michael Ellerman
2012-10-09 14:20 ` [PATCH 07/20] powerpc/xmon: Remove unused #defines Michael Ellerman
2012-10-09 14:20 ` [PATCH 08/20] powerpc/xmon: Use STACK_FRAME_OVERHEAD in xmon_show_stack() Michael Ellerman
2012-10-09 14:20 ` [PATCH 09/20] powerpc/xmon: Fiddle xmon_depth_to_print logic " Michael Ellerman
2012-10-09 14:20 ` [PATCH 10/20] powerpc/xmon: Factor out the oft-repeated setjmp logic Michael Ellerman
2012-10-09 22:23   ` Paul Mackerras
2012-10-10  0:59     ` Michael Ellerman
2012-10-09 14:20 ` [PATCH 11/20] powerpc/xmon: Move handle_fault() next to related routines Michael Ellerman
2012-10-09 14:20 ` [PATCH 12/20] powerpc/xmon: Do so simple conversions to start/end_bus_error_jump() Michael Ellerman
2012-10-09 14:20 ` Michael Ellerman [this message]
2012-10-09 14:20 ` [PATCH 14/20] powerpc/xmon: Convert read/write_spr() to use start_bus_error_jump() Michael Ellerman
2012-10-09 14:20 ` [PATCH 15/20] powerpc/xmon: Deindent stop/restart_spus() Michael Ellerman
2012-10-09 14:20 ` [PATCH 16/20] powerpc/xmon: Use start_bus_error_jump() in spu routines Michael Ellerman
2012-10-09 14:20 ` [PATCH 17/20] powerpc/xmon: Make less variables global Michael Ellerman
2012-10-09 14:20 ` [PATCH 18/20] powerpc/xmon: Use kallsyms_lookup_size_offset() in get_function_bounds() Michael Ellerman
2012-10-09 14:20 ` [PATCH 19/20] powerpc/xmon: Remove externs for non-existant routines Michael Ellerman
2012-10-09 14:20 ` [PATCH 20/20] powerpc/xmon: Fallback to printk() in xmon_printf() if udbg is not setup Michael Ellerman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1349792447-15714-13-git-send-email-michael@ellerman.id.au \
    --to=michael@ellerman.id.au \
    --cc=anton@samba.org \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).