All of lore.kernel.org
 help / color / mirror / Atom feed
From: Konrad Eisele <konrad@gaisler.com>
To: sparclinux@vger.kernel.org
Subject: Re: [PATCH 3/4] sparc32: return destination pointer on return from
Date: Wed, 19 Oct 2011 08:33:25 +0000	[thread overview]
Message-ID: <4E9E8B55.2060004@gaisler.com> (raw)
In-Reply-To: <1318489205-315-4-git-send-email-konrad@gaisler.com>

David Miller wrote:
> From: Konrad Eisele <konrad@gaisler.com>
> Date: Thu, 13 Oct 2011 09:00:04 +0200
> 
>> -/* In kernel these functions don't return a value.
>> - * One should use macros in asm/string.h for that purpose.
>> - * We return 0, so that bugs are more apparent.
>> - */
>> -#define SETUP_RETL
>> -#define RETL_INSN	clr	%o0
>> +#define SETUP_RETL	mov	%o0, %g6
>> +#define RETL_INSN	mov	%g6, %o0
> 
> Sigh...
> 
> The kernel uses %g6 as the global thread register, see
> include/asm/thread_info_32.h:
> 
> register struct thread_info *current_thread_info_reg asm("g6");
> 
> Your kernel would have crashed early in the boot if you actually
> tested this patch.
> 
> 

Isnt the simplest way to apply the original gdbstub.c patch instead?

-		ptr += strlen(strcpy(ptr, "thread:"));
+		strcpy(ptr, "thread:");
+		ptr += strlen(ptr);


Or even a simple

		strcpy(ptr, "thread:");
		ptr += 7;

In that case its the
"[PATCH 4/4] kernel,debug: SPARC KGDB stub strcpy fix" from [09/30/2011 03:47 PM].
instead of the memcpy patch.

It seems to me that memcpy is tightly programmed. Is saving 2 lines of gdbstub.c
diff worth a memcpy rewrite?

-- Konrad




  parent reply	other threads:[~2011-10-19  8:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-13  7:00 [PATCH 3/4] sparc32: return destination pointer on return from memcpy Konrad Eisele
2011-10-19  4:07 ` [PATCH 3/4] sparc32: return destination pointer on return from David Miller
2011-10-19  8:33 ` Konrad Eisele [this message]
2011-10-19 19:29 ` David Miller
2011-10-19 21:11 ` Kjetil Oftedal
2011-10-19 22:12 ` David Miller
2011-10-20  6:59 ` Konrad Eisele
2011-10-20  8:47 ` David Miller
2011-10-20  9:08 ` Konrad Eisele

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=4E9E8B55.2060004@gaisler.com \
    --to=konrad@gaisler.com \
    --cc=sparclinux@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.