mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jie Zhang <jie.zhang@analog.com>
To: linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] Blackfin: Deal with flat binfmt differently to FDPIC ELF binfmt when dumping
Date: Thu, 16 Aug 2007 15:24:54 +0800	[thread overview]
Message-ID: <1187249094.11475.29.camel@mercury.analog.com> (raw)

This Blackfin arch patch uses the new `name' field in struct
linux_binfmt added by my first patch.


Jie


Signed-off-by: Jie Zhang <jie.zhang@analog.com>
---
 arch/blackfin/kernel/traps.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/arch/blackfin/kernel/traps.c b/arch/blackfin/kernel/traps.c
index 792a841..9961c21 100644
--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -111,9 +111,7 @@ static int printk_address(unsigned long address)
 				/* FLAT does not have its text aligned to the start of
 				 * the map while FDPIC ELF does ...
 				 */
-				if (current->mm &&
-				    (address > current->mm->start_code) &&
-				    (address < current->mm->end_code))
+				if (strcmp(current->binfmt->name, "flat") == 0)
 					offset = address - current->mm->start_code;
 				else
 					offset = (address - vma->vm_start) + (vma->vm_pgoff << PAGE_SHIFT);
@@ -533,7 +531,7 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
 		     " or you are in the kernel\n");
 	}
 
-	if (current->mm) {
+	if (current->mm && strcmp(current->binfmt->name, "flat") == 0) {
 		printk(KERN_EMERG "TEXT = 0x%p-0x%p  DATA = 0x%p-0x%p\n"
 		       KERN_EMERG "BSS = 0x%p-0x%p   USER-STACK = 0x%p\n"
 		       KERN_EMERG "\n",
@@ -544,6 +542,16 @@ void dump_bfin_regs(struct pt_regs *fp, void *retaddr)
 		       (void *)current->mm->end_data,
 		       (void *)current->mm->brk,
 		       (void *)current->mm->start_stack);
+	} else if (current->mm
+		   && strcmp(current->binfmt->name, "ELF FDPIC") == 0) {
+		printk(KERN_EMERG "TEXT = 0x%p-0x%p  DATA = 0x%p-0x%p\n"
+		       KERN_EMERG "USER-STACK = 0x%p\n"
+		       KERN_EMERG "\n",
+		       (void *)current->mm->start_code,
+		       (void *)current->mm->end_code,
+		       (void *)current->mm->start_data,
+		       (void *)current->mm->end_data,
+		       (void *)current->mm->start_stack);
 	}
 
 	printk(KERN_EMERG "return address: [0x%p]; contents of:", retaddr);
-- 
1.5.2.4

                 reply	other threads:[~2007-08-16  7:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1187249094.11475.29.camel@mercury.analog.com \
    --to=jie.zhang@analog.com \
    --cc=linux-kernel@vger.kernel.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

all inboxes | Powered by JetHome®