Re: [PATCH] pre8/asm-i386/string.h + de4x5 -> no go

Torsten Duwe (duwe@ns.lst.de)
Wed, 20 Jan 1999 18:58:53 +0100 (MET)


Jamie> Alan Cox wrote:
>> You can't win that battle. Your fix breaks IDE CDROMS for me. strstr
>> has to go non inline

Jamie> Yes, for heaven's sake take strstr out of line! It's never used
Jamie> anywhere time critical.

Jamie> Write it in C -- the proliferation of architecture specific code
Jamie> doesn't need totally non time critical things like this in it.

Hm. Could some kind soul please enlighten me what was wrong with my patch ?
AFAIK %ebx isn't used globally in the kernel (like PIC in userland). When I
check the asm output in -pre8 I get (ewrk3.s:3503):

...
movl 24(%esp),%esi
movl (%ebx,%edx,4),%edi
#APP
cld
movl %esi,%edi
repne
scasb
notl %ecx
decl %ecx
movl %ecx,%edx
1: movl %esi,%edi
movl %esi,%eax
...

where especially the last two lines look confusing to me. What exactly is
%esi supposed to hold ? Why does %edi get overwritten so early before it gets
used at all ? ? ?

IMNSHO after the patch that got applied for -pre8 the %8 had to be changed to
%9 to accomodate for the extra operand somehow, and "4" should probably read
"5" as well, but then the whole thing doesn't compile any more.

On the other hand, my version produces:

...
movl 32(%esp),%esi
movl (%ebx,%edx,4),%ebx
#APP
cld
movl %ebx,%edi
repne
scasb
notl %ecx
decl %ecx
movl %ecx,%edx
1: movl %ebx,%edi
movl %esi,%eax
...

Which looks OK to me. Opinions ?

[ I changed asm-i386/string.h line 213,8 (?) to read:
"jne 1b\n\t"
"xorl %%eax,%%eax\n\t"
"2:"
:"=a" (__res), "=&c" (d0), "=&S" (d1), "=&d" (d2), "=&D" (d3)
: "0" (0), "1" (0xffffffff), "2" (cs), "b" (ct));
return __res;
}

and no need for d4 since %ebx remains unaltered ]

Please give it a (last) try !

Torsten

P.S.: I too prefer processors that have _registers_, not crooks like
Intel&compats.

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