| To: | Franck Bui-Huu <vagabon.xyz@gmail.com> |
|---|---|
| Subject: | Re: [PATCH] Introduce __fill_user() and kill __bzero() |
| From: | Thiemo Seufer <ths@networkno.de> |
| Date: | Wed, 14 Nov 2007 11:58:08 +0000 |
| Cc: | Ralf Baechle <ralf@linux-mips.org>, linux-mips <linux-mips@linux-mips.org> |
| In-reply-to: | <473AB0B6.2070208@gmail.com> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <4736C1EA.2050009@gmail.com> <20071111130130.GB8363@networkno.de> <473AB0B6.2070208@gmail.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
| User-agent: | Mutt/1.5.16 (2007-06-11) |
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
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: smp8634 add memory at dram1, Ralf Baechle |
|---|---|
| Next by Date: | Re: [PATCH] Introduce __fill_user() and kill __bzero(), Franck Bui-Huu |
| Previous by Thread: | Re: [PATCH] Introduce __fill_user() and kill __bzero(), Franck Bui-Huu |
| Next by Thread: | Re: [PATCH] Introduce __fill_user() and kill __bzero(), Franck Bui-Huu |
| Indexes: | [Date] [Thread] [Top] [All Lists] |