From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH] md: use memmap when possible
Date: Thu, 28 May 2015 12:29:32 +0200 [thread overview]
Message-ID: <1432808972-14822-1-git-send-email-s.hauer@pengutronix.de> (raw)
This adds the missing pieces for:
d8a6e1c ARM/mem: handle data aborts gracefully for md
When possible use memmap and directly and dereference the input pointer
directly in memory_display() so that the data abort occurs where we expect
it and not in the md command. With this d8a6e1c can work as expected.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
commands/md.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/commands/md.c b/commands/md.c
index c1361a6..07a03d5 100644
--- a/commands/md.c
+++ b/commands/md.c
@@ -44,6 +44,7 @@ static int do_mem_md(int argc, char *argv[])
char *filename = "/dev/mem";
int mode = O_RWSIZE_4;
int swab = 0;
+ void *map;
if (argc < 2)
return COMMAND_ERROR_USAGE;
@@ -65,6 +66,13 @@ static int do_mem_md(int argc, char *argv[])
if (fd < 0)
return 1;
+ map = memmap(fd, PROT_READ);
+ if (map != (void *)-1) {
+ ret = memory_display(map + start, start, size,
+ mode >> O_RWSIZE_SHIFT, swab);
+ goto out;
+ }
+
do {
now = min(size, (loff_t)RW_BUF_SIZE);
r = read(fd, mem_rw_buf, now);
--
2.1.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
reply other threads:[~2015-05-28 10:30 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=1432808972-14822-1-git-send-email-s.hauer@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.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