Go Back   EQEmulator Home > EQEmulator Forums > Support > Support::Linux Servers

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

Reply
 
Thread Tools Display Modes
  #1  
Old 11-06-2008, 04:25 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

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.
Reply With Quote
  #2  
Old 11-06-2008, 04:46 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

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;
Reply With Quote
  #3  
Old 11-06-2008, 04:53 PM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default

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.
Reply With Quote
  #4  
Old 11-06-2008, 06:25 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

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
Reply With Quote
  #5  
Old 11-06-2008, 07:25 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

You have to change

Code:
: "bx", "cx", "dx", "si", "di"
to

Code:
: "cx", "dx", "si", "di"
as well as save and restore ebx
Reply With Quote
  #6  
Old 11-06-2008, 07:42 PM
Angelox
AX Classic Developer
 
Join Date: May 2006
Location: filler
Posts: 2,049
Default

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
Reply With Quote
  #7  
Old 11-06-2008, 07:51 PM
Kobaz
Hill Giant
 
Join Date: Nov 2008
Location: Gold Coast, Oz
Posts: 119
Default

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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

   

All times are GMT -4. The time now is 10:27 PM.


 

Everquest is a registered trademark of Daybreak Game Company LLC.
EQEmulator is not associated or affiliated in any way with Daybreak Game Company LLC.
Except where otherwise noted, this site is licensed under a Creative Commons License.
       
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Template by Bluepearl Design and vBulletin Templates - Ver3.3