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?
sysOutLong and sysInLong [solved]
sysOutLong and sysInLong [solved]
Last edited by Klakap on Tue Sep 04, 2018 10:21 am, edited 1 time in total.
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
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
Re: sysOutLong and sysInLong
So outl is it the same as outb? The function outb and inb I have.
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.
Re: sysOutLong and sysInLong
And please what is code of method outl?
Re: sysOutLong and sysInLong
In GCC inline assembly you can use:
Code: Select all
void outportl(uint16_t port, uint32_t value)
{
asm volatile("outl %0, %%dx" :: "a" (value), "d" (port));
}
Re: sysOutLong and sysInLong
Very thank you! And please, what is code of Inl? Is similiar methods outw and inw?
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.
Re: sysOutLong and sysInLong
Very thank you! For these methods, I was stuck with my os development.