OSDev.org
https://forum.osdev.org/

sysOutLong and sysInLong [solved]
https://forum.osdev.org/viewtopic.php?f=1&t=33161
Page 1 of 1

Author:  Klakap [ Tue Sep 04, 2018 9:10 am ]
Post subject:  sysOutLong and sysInLong [solved]

Good day!
I wanted to implement a PCI but in the method pciConfigReadWord are the methods of sysOutLong and sysInLong and I non found how I should program it. Please, what is code methods sysOutLong and sysInLong?

Author:  zity [ Tue Sep 04, 2018 9:38 am ]
Post subject:  Re: sysOutLong and sysInLong

Hi Klakap,

When you need to write or read a long (in this case long means a 32-bit unsigned integer) to an I/O port you need to use the "inl" and "outl" instructions. These instructions work in exactly the same way as their 8- and 16-bit counterparts.

For an example of how to write these commands as inline assembly in GCC, see e.g.: https://wiki.osdev.org/Inline_Assembly/Examples#OUTx

Author:  Klakap [ Tue Sep 04, 2018 9:41 am ]
Post subject:  Re: sysOutLong and sysInLong

So outl is it the same as outb? The function outb and inb I have.

Author:  zity [ Tue Sep 04, 2018 10:01 am ]
Post subject:  Re: sysOutLong and sysInLong

No, they are not the same. "outb" is used for writing an 8-bit integer, while "outl" is used for writing a 32-bit integer, but they work in the same way.

Author:  Klakap [ Tue Sep 04, 2018 10:03 am ]
Post subject:  Re: sysOutLong and sysInLong

And please what is code of method outl?

Author:  zity [ Tue Sep 04, 2018 10:05 am ]
Post subject:  Re: sysOutLong and sysInLong

In GCC inline assembly you can use:

Code:
void outportl(uint16_t port, uint32_t value)
{
   asm volatile("outl %0, %%dx" :: "a" (value), "d" (port));
}

Author:  Klakap [ Tue Sep 04, 2018 10:15 am ]
Post subject:  Re: sysOutLong and sysInLong

Very thank you! And please, what is code of Inl? Is similiar methods outw and inw?

Author:  zity [ Tue Sep 04, 2018 10:17 am ]
Post subject:  Re: sysOutLong and sysInLong

Yes, the code for "inl" is equivalent to the code for inb/inw, except that it takes a 32-bit integer as an argument instead.

Author:  Klakap [ Tue Sep 04, 2018 10:21 am ]
Post subject:  Re: sysOutLong and sysInLong

Very thank you! For these methods, I was stuck with my os development.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/