|
|
 |
 |
 |
 |
|
 |
 |
|
 |
 |
|
 |
|
Support::Linux Servers Support forum for Linux EQEMu users. |

11-06-2008, 04:25 PM
|
Hill Giant
|
|
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
|
|
I'm no expert on asm coding by any means, but in crc32.cpp, why does the code go:
Code:
__asm __volatile (
"xorl %%ebx, %%ebx\n"
"movl %1, %%esi\n"
(cut many lines)
"xorl (%%edi,%%ebx,4), %%eax\n"
"2:\n"
:
: "a" (val), "g" (buf), "g" (bufsize)
: "bx", "cx", "dx", "si", "di"
);
return val;
instead of:
Code:
__asm __volatile (
"push %%ebx"
"xorl %%ebx, %%ebx\n"
"movl %1, %%esi\n"
(cut many lines)
"xorl (%%edi,%%ebx,4), %%eax\n"
"pop %%ebx"
"2:\n"
:
: "a" (val), "g" (buf), "g" (bufsize)
: "cx", "dx", "si", "di"
);
return val;
This bug has nothing to do with the Perl version btw.
|

11-06-2008, 04:46 PM
|
Hill Giant
|
|
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
|
|
Fixed code seems to be:
Code:
__asm __volatile (
"push %%ebx\n"
"xorl %%ebx, %%ebx\n"
"movl %1, %%esi\n"
(cut many lines)
"xorl (%%edi,%%ebx,4), %%eax\n"
"2:\n"
"pop %%ebx\n"
:
: "a" (val), "g" (buf), "g" (bufsize)
: "cx", "dx", "si", "di"
);
return val;
|

11-06-2008, 04:53 PM
|
Developer
|
|
Join Date: Feb 2004
Location: UK
Posts: 1,540
|
|
I'll test those changes out and incorporate them. I'll probably also get around to downloading the latest GCC and updating the source at some point so it compiles under it, as these issues come up on a fairly regular basis. Thanks.
|
 |
|
 |

11-06-2008, 06:25 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
Am I doing this right;
Code:
__asm __volatile (
"push %%ebx" //Kobaz
"xorl %%ebx, %%ebx\n"
"movl %1, %%esi\n"
"movl %2, %%ecx\n"
"movl $CRC32Table, %%edi\n"
"shrl $2, %%ecx\n"
"jz 1f\n"
".align 4\n"
"0:\n"
"movb %%al, %%bl\n"
"movl (%%esi), %%edx\n"
"shrl $8, %%eax\n"
"xorb %%dl, %%bl\n"
"shrl $8, %%edx\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"movb %%al, %%bl\n"
"shrl $8, %%eax\n"
"xorb %%dl, %%bl\n"
"shrl $8, %%edx\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"movb %%al, %%bl\n"
"shrl $8, %%eax\n"
"xorb %%dl, %%bl\n"
"movb %%dh, %%dl\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"movb %%al, %%bl\n"
"shrl $8, %%eax\n"
"xorb %%dl, %%bl\n"
"addl $4, %%esi\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"decl %%ecx\n"
"jnz 0b\n"
"1:\n"
"movl %2, %%ecx\n"
"andl $3, %%ecx\n"
"jz 2f\n"
"movb %%al, %%bl\n"
"shrl $8, %%eax\n"
"xorb (%%esi), %%bl\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"decl %%ecx\n"
"jz 2f\n"
"movb %%al, %%bl\n"
"shrl $8, %%eax\n"
"xorb 1(%%esi), %%bl\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"decl %%ecx\n"
"jz 2f\n"
"movb %%al, %%bl\n"
"shrl $8, %%eax\n"
"xorb 2(%%esi), %%bl\n"
"xorl (%%edi,%%ebx,4), %%eax\n"
"2:\n"
"pop %%ebx" //Kobaz
:
: "a" (val), "g" (buf), "g" (bufsize)
: "bx", "cx", "dx", "si", "di"
);
return val;
}
It still 'clobbers' on the clobber machine, and on the server where the code works I get 'Bad register name' error
|
 |
|
 |

11-06-2008, 07:25 PM
|
Hill Giant
|
|
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
|
|
You have to change
Code:
: "bx", "cx", "dx", "si", "di"
to
Code:
: "cx", "dx", "si", "di"
as well as save and restore ebx
|

11-06-2008, 07:42 PM
|
AX Classic Developer
|
|
Join Date: May 2006
Location: filler
Posts: 2,049
|
|
Ok, but now I get this;
Quote:
../common/crc32.cpp:240: Error: bad register name `%ebxxorl %ebx'
../common/crc32.cpp:291: Error: bad register name `%ebx2:'
|
If you need a SSH to my machine so you can make tests, send me a PM
|

11-06-2008, 07:51 PM
|
Hill Giant
|
|
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
|
|
I really need new glasses....
You are missing the \n at the end of the push and pop lines. Look at the last post I made that starts "Fixed code seems to be:".
It's things like that that remind me how much I hated assembler back in the day when I had to do it. And that was on 8 and 16 bit processors.
|
Thread Tools |
|
Display Modes |
Hybrid Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 10:27 PM.
|
|
 |
|
 |
|
|
|
 |
|
 |
|
 |