* [PATCH][kgdb][v3] Make mem access function weak in kgdb.c and kgdb.h
@ 2008-09-16 1:49 sonic zhang
[not found] ` <4e5ebad50809190251s16491edct7754080202790e2c@mail.gmail.com>
0 siblings, 1 reply; 2+ messages in thread
From: sonic zhang @ 2008-09-16 1:49 UTC (permalink / raw)
To: Jason Wessel; +Cc: Linux Kernel, kgdb mailing list
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>
---
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..cb8a3d6 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 c803730..aae578e 100644
--- a/kernel/kgdb.c
+++ b/kernel/kgdb.c
@@ -364,7 +364,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;
@@ -394,7 +394,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;
@@ -419,7 +419,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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH][kgdb][v3] Make mem access function weak in kgdb.c and kgdb.h
[not found] ` <48D38D04.8090505@windriver.com>
@ 2008-09-22 2:40 ` Sonic Zhang
0 siblings, 0 replies; 2+ messages in thread
From: Sonic Zhang @ 2008-09-22 2:40 UTC (permalink / raw)
To: Jason Wessel; +Cc: Linux Kernel, kgdb mailing list
The kgdb patch for blackfin is targeted to the 2.6.28 kernel, because
2.6.27 kernel doesn't accept big changes in this stage.
Sonic
On Fri, Sep 19, 2008 at 7:29 PM, Jason Wessel
<jason.wessel@windriver.com> wrote:
>
> One question I had, was if this work was targeted to the 2.6.27 kernel
> or the 2.6.28 kernel. I figure there are blackfin fin specific patches
> to go in with this, and I can attempt to sync with your blackfin pull
> requests.
>
> Thanks,
> Jason.
>
> Sonic Zhang wrote:
>> Hi Jason,
>>
>> Any comments?
>>
>> Sonic Zhang
>>
>> On Tue, Sep 16, 2008 at 9:49 AM, sonic zhang <sonic.adi@gmail.com> wrote:
>>
>>> 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>
>>>
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-09-22 2:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16 1:49 [PATCH][kgdb][v3] Make mem access function weak in kgdb.c and kgdb.h sonic zhang
[not found] ` <4e5ebad50809190251s16491edct7754080202790e2c@mail.gmail.com>
[not found] ` <48D38D04.8090505@windriver.com>
2008-09-22 2:40 ` Sonic Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox