Re: Want comments regarding patch

From: Bodo Eggert
Date: Fri Dec 29 2006 - 19:05:46 EST


Jan Engelhardt <jengelh@xxxxxxxxxxxxxxx> wrote:
> On Dec 29 2006 07:57, Daniel Marjamäki wrote:

>> It was my goal to improve the readability. I failed.
>>
>> I personally prefer to use standard functions instead of writing code.
>> In my opinion using standard functions means less code that is easier to
>> read.
>
> Hm in that case, what about having something like
>
> void *memset_int(void *a, int x, int n) {
> asm("mov %0, %%esi;
> mov %1, %%eax;
> mov %2, %%ecx;
> repz movsd;",
> a,x,n);
> }

This would copy the to-be-initialized buffer somewhere, if it compiles.

1) You want stosd, "store string", not "move string"
2) You'll want to set %%di (destination index) instead of %%si.
3) repz should be illegal for movs, it might be interpreted as rep by
defective assemblers, since it generates the same prefix. "rep" is
correct here, since you don't want to break on (non-)zero-words.
4) Mind the direction flag.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/