Return to BSD News archive
Xref: sserve comp.os.386bsd.questions:507 comp.os.386bsd.development:101
Path: sserve!manuel.anu.edu.au!munnari.oz.au!spool.mu.edu!uwm.edu!cs.utexas.edu!sun-barr!olivea!decwrl!netcomsv!netcom.com!jmonroy
From: jmonroy@netcom.com (Jesus Monroy Jr)
Newsgroups: comp.os.386bsd.questions,comp.os.386bsd.development
Subject: Intel Bug on movsb
Message-ID: <1993Mar5.112138.2011@netcom.com>
Date: 5 Mar 93 11:21:38 GMT
Organization: Netcom - Online Communication Services (408 241-9760 guest)
Lines: 49
SORRY for the cross post... but I could not find the original article.
=======================================================================
>> I have been having some wrong results when optimizing
>> some assembly code for a Future Domain SCSI card. More specifically,
>> I took the following code:
>>
>> cld
>> movb (%esi), %al
>> movb %al, (%edi)
>> incl %edi
>>
>> and replaced it with the following:
>>
>> movb (%esi), %al
>> stosb
>>
>> The resulting code when compiled does not work. This paricular code
>> is repeated n times when data is read from an i/o port.
>>
What you have found is an Intel bug in the microcode.
It does not work as documented.
Here is a clip from a program I wrote.
It has your fix. IT is written in MASM
but is still readable.
======================================
next:
shl al, 01 ; shift bit to carry flag
jnc no_bit
mov si, offset one_char
jmp show
no_bit:
mov si, offset zero_char
show:
movsb ; move character into slot.
inc si ; explicitly increment "si" -- bug fix
movsb ; move attrib into slot.
loop next
======================================
Best of Luck.
___________________________________________________________________________
Jesus Monroy Jr jmonroy@netcom.com
/386BSD/device-drivers /fd /qic /clock /documentation
___________________________________________________________________________