From: Jason Wessel <jason.wessel@windriver.com>
To: kgdb-bugreport@lists.sourceforge.net
Cc: linux-kernel@vger.kernel.org, Sonic Zhang <sonic.adi@gmail.com>,
Jason Wessel <jason.wessel@windriver.com>
Subject: [PATCH 7/7] kgdb: Make mem access function weak in kgdb.c andkgdb.h
Date: Tue, 21 Oct 2008 14:14:53 -0500 [thread overview]
Message-ID: <1224616493-23237-8-git-send-email-jason.wessel@windriver.com> (raw)
In-Reply-To: <1224616493-23237-7-git-send-email-jason.wessel@windriver.com>
From: Sonic Zhang <sonic.adi@gmail.com>
L1 instruction memory and MMR memory on blackfin can not be accessed by
common functions probe_kernel_read() and probe_kernel_write().
Blackfin asks for 2/4 byte align access to MMR memory and DMA access to
L1 instruction memory. These functions need to be reimplemented in
architecture specific kgdb.c. Update documentation and prototypes as
well.
Signed-off-by: Sonic Zhang <sonic.adi@gmail.com>
Signed-off-by: Jason Wessel <jason.wessel@windriver.com>
---
include/linux/kgdb.h | 42 ++++++++++++++++++++++++++++++++++++++++--
kernel/kgdb.c | 6 +++---
2 files changed, 43 insertions(+), 5 deletions(-)
diff --git a/include/linux/kgdb.h b/include/linux/kgdb.h
index 8fdd3cb..3df90af 100644
--- a/include/linux/kgdb.h
+++ b/include/linux/kgdb.h
@@ -267,8 +267,46 @@ extern int kgdb_register_io_module(struct kgdb_io *local_kgdb_io_ops);
extern void kgdb_unregister_io_module(struct kgdb_io *local_kgdb_io_ops);
extern int kgdb_hex2long(char **ptr, unsigned long *long_val);
-extern int kgdb_mem2hex(char *mem, char *buf, int count);
-extern int kgdb_hex2mem(char *buf, char *mem, int count);
+
+/**
+ * kgdb_mem2hex - (optional arch override) translate bin to hex chars
+ * @mem: source buffer
+ * @buf: target buffer
+ * @count: number of bytes in mem
+ *
+ * Architectures which do not support probe_kernel_(read|write),
+ * can make an alternate implementation of this function.
+ * This function safely reads memory into hex
+ * characters for use with the kgdb protocol.
+ */
+extern int __weak kgdb_mem2hex(char *mem, char *buf, int count);
+
+/**
+ * kgdb_hex2mem - (optional arch override) translate hex chars to bin
+ * @buf: source buffer
+ * @mem: target buffer
+ * @count: number of bytes in mem
+ *
+ * Architectures which do not support probe_kernel_(read|write),
+ * can make an alternate implementation of this function.
+ * This function safely writes hex characters into memory
+ * for use with the kgdb protocol.
+ */
+extern int __weak kgdb_hex2mem(char *buf, char *mem, int count);
+
+/**
+ * kgdb_ebin2mem - (optional arch override) Copy the binary array
+ * pointed to by buf into mem.
+ * @buf: source buffer
+ * @mem: target buffer
+ * @count: number of bytes in mem
+ *
+ * Architectures which do not support probe_kernel_(read|write),
+ * can make an alternate implementation of this function.
+ * This function safely copies binary array into memory
+ * for use with the kgdb protocol.
+ */
+extern int __weak kgdb_ebin2mem(char *buf, char *mem, int count);
extern int kgdb_isremovedbreak(unsigned long addr);
diff --git a/kernel/kgdb.c b/kernel/kgdb.c
index d7a30bb..e9e0e8a 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -365,7 +365,7 @@ static void put_packet(char *buffer)
* Convert the memory pointed to by mem into hex, placing result in buf.
* Return a pointer to the last char put in buf (null). May return an error.
*/
-int kgdb_mem2hex(char *mem, char *buf, int count)
+int __weak kgdb_mem2hex(char *mem, char *buf, int count)
{
char *tmp;
int err;
@@ -395,7 +395,7 @@ int kgdb_mem2hex(char *mem, char *buf, int count)
* 0x7d escaped with 0x7d. Return a pointer to the character after
* the last byte written.
*/
-static int kgdb_ebin2mem(char *buf, char *mem, int count)
+int __weak kgdb_ebin2mem(char *buf, char *mem, int count)
{
int err = 0;
char c;
@@ -420,7 +420,7 @@ static int kgdb_ebin2mem(char *buf, char *mem, int count)
* Return a pointer to the character AFTER the last byte written.
* May return an error.
*/
-int kgdb_hex2mem(char *buf, char *mem, int count)
+int __weak kgdb_hex2mem(char *buf, char *mem, int count)
{
char *tmp_raw;
char *tmp_hex;
--
1.6.0.2
next prev parent reply other threads:[~2008-10-21 19:17 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-21 19:14 kgdb 2.6.28 merge plans Jason Wessel
2008-10-21 19:14 ` [PATCH 1/7] kgdb: Add the ability to schedule a breakpoint via a tasklet Jason Wessel
2008-10-21 19:14 ` [PATCH 2/7] tty: Fix sparse static warning for tty_driver_lookup_tty Jason Wessel
2008-10-21 19:14 ` [PATCH 3/7] kgdboc, tty: Add the rx polling call back capability Jason Wessel
2008-10-21 19:14 ` [PATCH 4/7] kgdboc, 8250: Add the rx polling hook to 8250 driver Jason Wessel
2008-10-21 19:14 ` [PATCH 5/7] kgdboc, tty: use tty open to start low level drivers Jason Wessel
2008-10-21 19:14 ` [PATCH 6/7] kgdb: kgdboc console poll hooks for serial_txx9 uart Jason Wessel
2008-10-21 19:14 ` Jason Wessel [this message]
2008-10-21 21:49 ` [PATCH 5/7] kgdboc, tty: use tty open to start low level drivers Jason Wessel
2008-10-21 22:47 ` Alan Cox
2008-10-22 1:54 ` Jason Wessel
2008-10-21 22:49 ` kgdb 2.6.28 merge plans Alan Cox
2008-10-22 2:09 ` Jason Wessel
2008-10-22 8:34 ` Alan Cox
2008-10-22 10:07 ` Jason Wessel
2008-10-22 12:25 ` Alan Cox
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=1224616493-23237-8-git-send-email-jason.wessel@windriver.com \
--to=jason.wessel@windriver.com \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=sonic.adi@gmail.com \
/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®