Other methods of implementing inl/outl

Programming, for all ages and all languages.
Post Reply
Bietje
Member
Member
Posts: 100
Joined: Wed Apr 20, 2011 6:57 am

Other methods of implementing inl/outl

Post 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
User avatar
Owen
Member
Member
Posts: 1700
Joined: Fri Jun 13, 2008 3:21 pm
Location: Cambridge, United Kingdom
Contact:

Re: Other methods of implementing inl/outl

Post 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)
Bietje
Member
Member
Posts: 100
Joined: Wed Apr 20, 2011 6:57 am

Re: Other methods of implementing inl/outl

Post by Bietje »

That clarifies things,

Thank you
Post Reply