Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Thiemo Seufer <ths@networkno.de>
To: Franck Bui-Huu <vagabon.xyz@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>,
	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH] Introduce __fill_user() and kill __bzero()
Date: Wed, 14 Nov 2007 11:58:08 +0000	[thread overview]
Message-ID: <20071114115807.GL8363@networkno.de> (raw)
In-Reply-To: <473AB0B6.2070208@gmail.com>

Franck Bui-Huu wrote:
> Thiemo Seufer wrote:
> > Franck Bui-Huu wrote:
> >>  /*
> >> - * memset(void *s, int c, size_t n)
> >> + * An outline version of memset, which should be used either by gcc or
> >> + * by assembly code.
> >> + */
> >> +NESTED(memset, 24, ra)
> >> +	PTR_ADDU	sp, sp, -24
> >> +	LONG_S		a0, 16(sp)
> >> +	LONG_S		ra, 20(sp)
> >> +	jal		__fill_user
> >> +	LONG_L		v0, 16(sp)
> >> +	LONG_L		ra, 20(sp)
> >> +	PTR_ADDU	sp, sp, 24
> >> +	jr		ra
> >> +END(memset)
> > 
> > This will break on 64bit kernels.
> > 
> 
> Is the following correct ?
> 
> NESTED(memset, 16, ra)
>         PTR_ADDU        sp, sp, -16
>         LONG_S          a0,  8(sp)
>         LONG_S          ra, 16(sp)
>         jal             __fill_user
>         LONG_L          v0,  8(sp)
>         LONG_L          ra, 16(sp)
>         PTR_ADDU        sp, sp, 16
>         jr              ra
> END(memset)
> 
> I know it doesn't respect any mips ABI but in this case do
> we really care ?

In general we do (think of stack unwinding etc.).  I believe this
implementation should move to C, as it doesn't need an assembler
implementation:

void *memset (void *s, int c, kernel_size_t n)
{
	__fill_user(s, c, n);
	return s;
}

It looks much nicer that way. :-)


Thiemo

  reply	other threads:[~2007-11-14 11:58 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-11  8:48 [PATCH] Introduce __fill_user() and kill __bzero() Franck Bui-Huu
2007-11-11 13:01 ` Thiemo Seufer
2007-11-11 13:57   ` Franck Bui-Huu
2007-11-14  8:24   ` Franck Bui-Huu
2007-11-14 11:58     ` Thiemo Seufer [this message]
2007-11-14 12:34       ` Franck Bui-Huu
2007-11-14 13:48         ` Thiemo Seufer
2007-11-14 15:13           ` Franck Bui-Huu

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=20071114115807.GL8363@networkno.de \
    --to=ths@networkno.de \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=vagabon.xyz@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