Page 1 of 1

Other methods of implementing inl/outl

Posted: Fri Aug 19, 2011 12:06 pm
by Bietje
Hi,

Sometimes do you need to output more then a byte (e.g. when you configure PCI). Now you can use the Pentium i386+ 'outsd' instruction to archive that. Now is my question, are there other ways to archive that data output? Could you do 4 consecutive outb's, or does the CPU expect the data at once and not in several shots? Or is that defined by the device listening to the specific port (I mean, some device could be waiting until the buffer is full, and some other just return an error or something)..

Greets,
Bietje

Re: Other methods of implementing inl/outl

Posted: Fri Aug 19, 2011 12:26 pm
by Owen
You must use the correctly sided access instruction, whether for memory mapped or port IO. If the specification says to do 32 bit writes, do 32 bit writes.

"outl" should be implemented using the "out dx, eax" instruction. "inl" should be implemented using the "in eax, dx" instruction. "outs" and "ins" are for writing multiple values consecutively to an IO port (Generally using a prefix from the "rep" family)

Re: Other methods of implementing inl/outl

Posted: Fri Aug 19, 2011 1:18 pm
by Bietje
That clarifies things,

Thank you